Primitive Variables

Primitive Variables

About PrimVars

It is often useful to attach data to the surface of an object. In RenderMan this is done by including the data as a token value pair when a surface primitive is declared. Once data is attached it is available as parameters to the shaders that are bound to the surface primitive. Parameters that are attached to surface geometry in this way are called primitive variables, or primvars, for short. RenderMan for Maya provides both simple and flexible access to primvars.

At the simplest level, RfM includes Prim Var nodes, accessible via the Maya Hypershade, that can be attached to Maya nodes as needed. The various tools can then leverage those primvars at shading time. Nodes are provided for Color, Float (1, 2, and 3), Normal, Point, and Vector primvars.


RfM's Prim Var Nodes

Under the Covers

RenderMan for Maya infers the request for a primitive variable by combining the Maya attribute type with the naming convention:


A special character must be provided to hint at the Ri primvar type. Additional special characters can be provided to request specific detail and array representation. It is up to the user to provide properly sized Maya attributes.

The three forms for special names are:

  1. rmanTprimvarName: where T is one of:

    'F', 'C', 'V', 'N', 'P', 'H', 'M', 'S'

    which are interpreted as the RenderMan types:

    float, color, vector, normal, point, hpoint, matrix, string

  2. rmanDTprimvarname: where T is as above and D provides a detail hint:

    'c', 'u', 'f', 'v', 'x'

    indicating standard RenderMan details:

    constant, uniform, facevarying, varying, vertex

  3. rmanaDTprimvarname: where T and D are as above and the letter a indicates that an array of the given type and detail is requested.

For More Information

Users interested in learning more about primitive variables should consult the PRMan Application Note.