About PrimVars for Maya

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 assigned 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. This effectively drives parameters or provides them with the data they need to achieve special effects. One such example could be to supply a color based on vertices locations on the mesh

 

Nodes are provided for Color, Float (1, 2, and 3), Normal, Point, and Vector types of primvars.

 

Under the Covers

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

rman?[?[?]]primvarname

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.

 

Available (or possible) PrimVars

Some of these options are automatically provided even if they are empty but some, like radiusPP or Radius Per Particle, must be supplied by the user in any case. Below are some of these settings not included on the Geometric Settings page since they may already be provided or have limited or special use.

Meshes

Cs, each color set goes out as a primvarThis could be used to provide color based on the mesh data

s

The one-dimensional S texture value
tThe one-dimensional T texture value
u_uvSetThe one-dimensional U texture value if UVsets are defined
v_uvSetThe one-dimensional V texture value if UVsets are defined
tangentTangent space normals if specified
NShape Normals if supplied by the mesh

 

NURBS

sThe one-dimensional S texture value
tThe one-dimensional T texture value

 

Subdivision Surfaces

sThe one-dimensional S texture value
tThe one-dimensional T texture value

 

Hair (does not apply to Xgen)

PPosition
varying color OsOpacity
varying color CsColor
varying float widthHair width
vertex float tVertex number
constant string linetypeReturns the type of PaintFX curve
uniform float diffuseRandDiffuse Randomization/Noise
uniform float specularRandSpecular Randomization/Noise
uniform float hueRandRandomized Hue
uniform float satRandRandomized Saturation
uniform float valRandRandomized Value
uniform float scalpSOne-dimensional scalp S coordinate
uniform float scalpTOne-dimensional scalp T coordinate
vertex normal NHair vertex normals

 

Particles

PPosition
varying float widthVarying particle width (if they have assigned radii)
constant float widthIf there is no specified radii
varying color CsVarying color if there is colorRed, colorGreen, colorBlue, or rgbPP
varying color OsVarying opacity if there is opacity or opacityPP
constant float __thresholdSpecified particle threshold
ageNormPP*Particle Age Normalized (0-1) per particle
incandescencePP*Incandescence specified per particle
spriteNumPP*The assigned sprite number per particle
falloffpowerUsed to create "fuzzy" particles

 

These attributes influence other settings, like Cs, Os, orientation of particle:

opacityPP*Opacity specified per particle
radiusPP*Radius specified per particle
spriteScaleXPP*Sprite scale in X axis
spriteScaleYPP*Sprite scale in Y axis
spriteTwistPP*Sprite twist if specified

Attributes marked with an asterisk * must be supplied by the user. An example of this are Per Particle attributes added to Maya particles in the attribute editor.

 

Fluids

color CsFluid color
float densityFluid density
vector dPdtimeMotion vector
vector velocityMotion velocity
float pressureFluid pressure
float temperatureFluid temperature
float fuelFluid fuel
float falloffFieldFalloff
float[3] UVWUVW output