![]() |
Sdr is a shading-specialized version of Ndr, and provides the following specialized classes:
For more details on the registry, nodes, or properties, see the base Ndr classes:
For a high-level view of the system and how all the parts work together, see the overview page for Ndr.
Sdr defines a limited set of types:
The SdrPropertyType is not written out to a USD layer, but with the aid of other information and metadata gathered from a node's shader definition, the SdrPropertyType is mapped to an SdfValueTypeName that is written into USD layers. The SdfValueTypeNames are a much richer and wider set of types, and it is this type that is looked at during opinion composition.
For most of the basic SdrPropertyTypes, we have direct mappings to SdfValueTypeNames given the Sdr type and if it is an array. For some of the SdrPropertyTypes, we use metadata to aid the translation to a particular SdfValueTypeName (see below).
Clients writing NdrParserPlugin sub-classes for Sdr need only be concerned with a property's SdrPropertyType. Sdr will handle the details of assigning the correct SdfValueTypeName.
Some SdrPropertyTypes are a little special because there is no reasonable corresponding SdfValueTypeName, so we map them all to SdfValueTypeName->Token, which is typically reserved for an Unknown type.
The special SdrPropertyTypes that map to 'Token' are:
As described, these special SdrPropertyTypes cannot be represented as a SdfValueTypeName, which is why we simply map them to 'Token'. A user can find the original struct type or terminal type of one of these properties by examining the 'renderType' metadata on the property, since this original type information is not preserved in either the SdrPropertyType or SdfValueTypeName.
As mentioned previously, metadata can be used to drive the parsing of a SdrPropertyType. This metadata does need to be authored by shader writers. Some of these metadata tags are:
Some metadata is used to drive the conversion of an SdfValueTypeName. Metadata that is used for SdfValueTypeName conversion is NOT authored by shader writers, and it should instead be injected into an SdrShaderProperty by a parser plugin writer. This includes:
In the above example, the properties would be translated as follows:
Property | SdrPropertyType | SdfValueTypeName |
---|---|---|
foo | SdrPropertyTypes->Color | SdfValueTypeNames->Color |
bar | SdrPropertyTypes->String | SdfValueTypeNames->String |
surface | SdrPropertyTypes->Terminal | SdfValueTypeNames->Token |