RenderVar

A quantity or ‘channel’ of computed data, produced by a renderer. These are sometimes referred to as arbitrary output variables (AOVs). Examples of render variables include geometric measurements such as camera-space depth, quantities emitted by material shaders such as color or alpha channels, light path expressions (LPE’s), and quantities intrinsic to the renderer such as computation time per pixel.

The name of the RenderVar prim drives the name of the data variable that the renderer will produce. For example, a RenderVar named “alpha” typically would indicate the renderer should produce alpha channel data, named “alpha”, in the render output. Note that USD does not yet enforce a set of universal RenderVar names and formats, so renderer-specific RenderVars are expected.

RenderVars can also specify “source” information for the data, such as output from a shader, renderer outputs such as depth or normals, or a light path expression (LPE).

The following are a few example RenderVars. The “color” RenderVar specifies a color output channel, using the “Ci” source. The “alpha” RenderVar specifies an alpha output channel using the “a” source. The “directDiffuse” RenderVar specifies a output channel named “directDiffuse” that uses a light path expression to define the source data, with a sourceType of “lpe” indicating that the expression will need to be parsed accordingly. Finally, the “id” RenderVar specifies an “id” output channel that uses a non-standard data source, such as a custom identifier of the rendered object(s).

def RenderVar "color" {
    string sourceName = "Ci"
}
def RenderVar "alpha" {
    token dataType = "float"
    string sourceName = "a"
}
def RenderVar "directDiffuse" {
    string sourceName = "C<RD>[<L.>O]"
    token sourceType = "lpe"
}
def RenderVar "id" {
    token dataType = "int"
    string sourceName = "id"
}

RenderVars are communicated to a renderer or rendering pipeline via RenderProduct. A RenderProduct will specify (via orderedVars relationships) one or more RenderVars that the renderer will combine to produce the output artifact. See Understanding RenderVars for an example RenderProduct that includes the RenderVars defined above.

Properties

dataType

USD type: token

Fallback value: color3f

The type of this quantity, as a USD attribute type (color3f, float, etc.).

sourceName

USD type: string

Fallback value: ``

The name of the data source that contains the computed value(s) for the RenderVar. For example, the sourceName ‘a’ might be used for an ‘alpha’ RenderVar to denote that the computed alpha values are available in the ‘a’ channel of a data source.

sourceType

USD type: token

Fallback value: raw

The type of the quantity data source. The types provided by USD are:

  • “raw”: The name should be passed directly to the renderer. This is the default behavior.

  • “primvar”: This source represents the name of a primvar. Some renderers may use this to ensure that the primvar is provided; other renderers may require that a suitable material network be provided, in which case this is simply an advisory setting.

  • “lpe”: Specifies a Light Path Expression in the OSL Light Path Expressions language as the source for this RenderVar. Some renderers may use extensions to the OSL LPE syntax, which will necessarily be non-portable.

  • “intrinsic”: This setting is currently unimplemented, but represents a future namespace for UsdRender to provide portable baseline RenderVars, such as camera depth, that may have varying implementations for each renderer.