About Primitive Variables
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:
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
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
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 primvar | This could be used to provide color based on the mesh data |
s | The one-dimensional S texture value |
t | The one-dimensional T texture value |
u_uvSet | The one-dimensional U texture value if UVsets are defined |
v_uvSet | The one-dimensional V texture value if UVsets are defined |
tangent | Tangent space normals if specified |
N | Shape Normals if supplied by the mesh |
NURBS
s | The one-dimensional S texture value |
t | The one-dimensional T texture value |
Subdivision Surfaces
s | The one-dimensional S texture value |
t | The one-dimensional T texture value |
Hair (does not apply to Xgen)
P | Position |
varying color Os | Opacity |
varying color Cs | Color |
varying float width | Hair width |
vertex float t | Vertex number |
constant string linetype | Returns the type of PaintFX curve |
uniform float diffuseRand | Diffuse Randomization/Noise |
uniform float specularRand | Specular Randomization/Noise |
uniform float hueRand | Randomized Hue |
uniform float satRand | Randomized Saturation |
uniform float valRand | Randomized Value |
uniform float scalpS | One-dimensional scalp S coordinate |
uniform float scalpT | One-dimensional scalp T coordinate |
vertex normal N | Hair vertex normals |
Particles
P | Position |
varying float width | Varying particle width (if they have assigned radii) |
constant float width | If there is no specified radii |
varying color Cs | Varying color if there is colorRed, colorGreen, colorBlue, or rgbPP |
varying color Os | Varying opacity if there is opacity or opacityPP |
constant float __threshold | Specified particle threshold |
ageNormPP* | Particle Age Normalized (0-1) per particle |
incandescencePP* | Incandescence specified per particle |
spriteNumPP* | The assigned sprite number per particle |
falloffpower | Used 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 Cs | Fluid color |
float density | Fluid density |
vector dPdtime | Motion vector |
vector velocity | Motion velocity |
float pressure | Fluid pressure |
float temperature | Fluid temperature |
float fuel | Fluid fuel |
float falloffField | Falloff |
float[3] UVW | UVW output |