![]() |
|
SdrShaderNode represents a dataflow-connectable computation, intended to be a node in a computational network. It has the following core fields.
| Field | Description |
|---|---|
| identifier | Concise string including what the node does, type specialization, and versioning information |
| name | Concise string including what the node does, and type specialization |
| function | Concise string consisting of what the node does |
| version | SdrVersion that indicates the node's version |
| shadingSystem | Describes a system that usually has its own standard, language, and/or runtime |
| properties | Represents computational inputs and outputs (SdrShaderProperty) |
| definitionURI | Asset providing the definition of the node, determined during Discovery |
| implementationURI | Asset providing implementation of the node's computation, determined during Parsing |
SdrShaderNode is uniquely identified by a combination of identifier and shadingSystem. As a consequence of the assigned meanings above, this means a node can alternately be uniquely identified by name, version, and shadingSystem. Convenience API on SdrRegistry allows for identifying nodes using various combinations of these fields.
Note that in some cases, definitionURI and implementationURI may be the same.
SdrShaderNodeMetadata contains named metadata for SdrShaderNode and has support for custom user-defined metadata.
Below is a table of the most frequently used named metadata for easy reference. Descriptions below mirror the documentation on SdrShaderNodeMetadata itself. These named metadata items are tokenized here. In code to reference, for example, the "label" metadata key, use SdrNodeMetadata->Label.
| Key | Description |
|---|---|
| label | UI hint for a user-friendly string representation |
| help | Help message for this node |
| domain | Defines groups for the broadest system categories, "rendering" by default |
| subdomain | Defines domain subsystems; e.g. "shading", "filtering", "lighting" in domain "rendering" |
| context | Describes usage group in a subdomain; e.g. "pattern", "surface", "bxdf" in subdomain "shading" |
| role | Provides finer granularity for contexts that contain many nodes |
| targetRenderer | Describes that a node was designed for (but not necessarily limited to) a specific renderer |
| collections | Provides a way to arbitrarily group nodes in ways that aren't captured by other metadata |
| implementationName | Implementation source's name for the shader, needed by some runtimes |
| openPages | Pages that should be opened/expanded by default |
| pagesShownIf | Per-page shownIf expressions; see SdrShaderProperty::GetShownIf |
| primvars | Primvars used by this node |
Note that the following metadata items and core fields form a hierarchy useful for logically grouping nodes for UI display (see helper function SdrShaderNodeQueryUtils::GroupQueryResults).
In general, metadata can be authored either by shader writers or parser plugin writers. Choice of when to author these items depends on the desired workflow.
While SdrShaderNode does allow usages that don't match the descriptions above, adherence to these soft standards helps with consistent organization.
identifier, name, and function should follow the below format with components separated by underscores.
<function> describes what the node does. <version> is either in form <major>_<minor> or <major>. <typeSpecialization> represents the type of the node and has the following recommendations.
| Field | Example 1 | Example 2 | Example 3 |
|---|---|---|---|
| identifier | add_float_3 | position_vectorFloat_1_9 | convert_float4_surfaceShader_1 |
| name | add_float | position_vectorFloat | convert_float4_surfaceShader |
| function | add | position | convert |