HDK
|
HUSD Interface for passing Cryptomatte AOV information through Hydra. More...
#include <UT_HUSDExtraAOVResource.h>
Public Types | |
using | MapFunc = std::function< void *(int)> |
using | UnmapFunc = std::function< void(int)> |
Public Member Functions | |
SYS_FORCE_INLINE | UT_HUSDExtraAOVResource ()=default |
SYS_FORCE_INLINE | UT_HUSDExtraAOVResource (MapFunc map, UnmapFunc unmap) |
SYS_FORCE_INLINE | ~UT_HUSDExtraAOVResource () |
SYS_FORCE_INLINE void | addPlane (const std::string &name, int hd_format) |
Convenience function to add an extra plane. More... | |
SYS_FORCE_INLINE void | addMetadata (const std::string &key, const std::string &value) |
Convenience method to add metadata. More... | |
SYS_FORCE_INLINE void | setMetadata (const std::map< std::string, std::string > &md) |
Convenience function to set the metadata map. More... | |
Public Attributes | |
MapFunc | myMap |
UnmapFunc | myUnmap |
std::vector< std::string > | myNames |
List of names for the affiliated AOV buffers. More... | |
std::vector< int > | myFormats |
std::map< std::string, std::string > | myMetadata |
Dictionary of extra metadata for the AOV. More... | |
HUSD Interface for passing Cryptomatte AOV information through Hydra.
Hydra has no facility for managing Cryptomatte AOVs. This class can be used to pass information between a render delegate and the HuskEngine.
This class is specifically created to not rely on any Houdini or USD classes, so it should be relatively save to include this header in any delegate's interface (see below for SYS_Inline.h)
The class is defined in UT so that it does not have to be part of the Houdini USD bridge and introduce any unwanted dependencies on the HUSD library.
If a render delegate wants to have a single AOV declare multiple child AOVs (extra/affiliated AOVs) in offline rendering in husk, the delegate can create a subclass for it's AOV buffers from HdRenderBuffer. The sub-class should implement the GetResource
virtual and return VtValue storing a UT_HUSDExtraAOVResourcePtr.
This class lets a single AOV have multiple extra AOVs associated with it.
An example of this might be Cryptomatte AOVs where a single AOV is defined in the USD file, but then additional AOVs are created in the renderer to store additional data for cryptomatte layers. This interface isn't limited to cryptomatte, but can be used for any affiliated AOVs.
For example, a delegate might do something like
For example, in Karma, when an AOV sees a render var for cryptomatte:
Karma will internally create additional buffers for "MaterialChan" AOV and provide the function to map the AOVs. The resource object would look something like:
While it may be possible to store a UT_HUSDExtraAOVResourcePtr directly in the VtValue, the preferred method for passing this resource to husk
is to store to return a VtValue holding a HdAovSettingsMap. This is due to symbol visibility and other issues.
The value in the map should be shared pointer stored behind an opaque shared void ptr. Houdini/husk will look for a shared_ptr<void> with the "extra_aov_resource" key and use a static cast to a UT_HUSDExtraAOVResourcePtr. The void
pointer is only used to pass the shared ptr through the libraries. This mechanism allows the delegate to construct it's own struct, in its own codebase without relying on Houdini's libraries at all. For example:
Definition at line 145 of file UT_HUSDExtraAOVResource.h.
using UT_HUSDExtraAOVResource::MapFunc = std::function<void *(int)> |
Definition at line 147 of file UT_HUSDExtraAOVResource.h.
using UT_HUSDExtraAOVResource::UnmapFunc = std::function<void(int)> |
Definition at line 148 of file UT_HUSDExtraAOVResource.h.
|
default |
|
inline |
Definition at line 151 of file UT_HUSDExtraAOVResource.h.
|
inline |
Definition at line 156 of file UT_HUSDExtraAOVResource.h.
|
inline |
Convenience method to add metadata.
Definition at line 165 of file UT_HUSDExtraAOVResource.h.
|
inline |
Convenience function to add an extra plane.
Definition at line 159 of file UT_HUSDExtraAOVResource.h.
|
inline |
Convenience function to set the metadata map.
Definition at line 171 of file UT_HUSDExtraAOVResource.h.
std::vector<int> UT_HUSDExtraAOVResource::myFormats |
List of the data formats for each of the affiliated AOV buffers. The integer stored should match the HdFormat enum. The length of the array should match the myNames
array. It's stored as int
to remove dependencies on the USD library. There may be issues if the HdFormats enum changes between versions.
Definition at line 193 of file UT_HUSDExtraAOVResource.h.
MapFunc UT_HUSDExtraAOVResource::myMap |
Function to map the AOV buffer (similar to HdRenderBuffer::Map, but for an affiliated AOV).
Definition at line 179 of file UT_HUSDExtraAOVResource.h.
std::map<std::string, std::string> UT_HUSDExtraAOVResource::myMetadata |
Dictionary of extra metadata for the AOV.
Definition at line 196 of file UT_HUSDExtraAOVResource.h.
std::vector<std::string> UT_HUSDExtraAOVResource::myNames |
List of names for the affiliated AOV buffers.
Definition at line 186 of file UT_HUSDExtraAOVResource.h.
UnmapFunc UT_HUSDExtraAOVResource::myUnmap |
Function to unmap the AOV buffer (similar to HdRenderBuffer::Unmap, but for an affiliated AOV).
Definition at line 183 of file UT_HUSDExtraAOVResource.h.