Who konws the function of "Cd" and "diff&quot

   2852   1   1
User Avatar
Member
83 posts
Joined: Dec. 2005
Offline
Who konws the function of “Cd” and “diff” ? Thanks…
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Cd is the name of the local variable associated with the default vertex, point or primitive color bound to the geometry. It isn't there by default. You add it by using a Vertex, Point or Primitive SOP. Just choose to add color in the respecitve SOPs and you have created the attribute Cd.

To access this attribute in SOPs, just use $CR, $CG and $CB in any of the Sops that accept this local variable.

To access this in shaders, you need to import the attribute Cd and use it accordingly. It isn't in all shaders by default. Just create a parameter called Cd and make it invisible. If it is present, it will be picked up and used. It is nice in VOPs to press the option in the Parameter VOP, use attribute if attribute is bound. It will make it invisible to the UI as well.

As for diff, this is usually what shader writers accustomed to writing for Mantra call the diffuse color internally. You can call it whatever you want really. It is more convention than anything else. Renderman has no “real” convention but I believe that “diff” is also used to designlate color value for the surface.

As with Cd, if you create a vector vertex, point or primitive attribute of name “diff” bound to your geometry, your shader will inherit this attribute and override any values for diff that you set in the shader's UI.

Hope that clears things up.
There's at least one school like the old school!
  • Quick Links