User guide

128
Using Primvars In RenderMan
RenderMan has a feature called primvars that allow you to directly override the value of any shader parameter. This
means that you can have a single instance of a shader used by multiple pieces of geometry (for example by being
placed high up in the hierarchy and inherited) with string parameters for textures, but each piece of geometry can
use its own specific textures by creating a primvar with the same name as the shader parameter.
In Katana any string attribute called textures.xxx is automatically written out to RenderMan as a primvar called
xxx. For instance if your shader has a string parameter called BumpMap, setting an attribute called
textures.BumpMap on a piece of geometry means a primvar called BumpMap is created on the geometry, with
the value of the textures.BumpMap attribute.
This means that with suitably named shader parameters you can create attributes in Katana called textures.xxx on
geometry locations, allowing each piece of geometry to pick up its individual textures.
You can also do per-face assignment of textures using primvars. If textures.xxx is set to an array of string values,
with the number of elements matching the number of faces, that array is written out as a varying primvar instead of
a constant, so each face picks up its own value.
Using Custom User Data
Some renderers don't support RenderMan style primvars, but allow some form of custom user data that can be
looked up by shaders. With a little more work and suitable shaders these can be used to give similar results.
For instance, in Arnold if you have shaders designed to look for user data that contain strings declaring the paths to
textures (instead of the paths to the textures being direct parameters on the shaders) you can use user data to have
a shared material on multiple objects and each object picks up its own individual textures.
Any string attribute called textures.xxx is automatically written out to Arnold as a piece of string user data called
xxx, which is looked up inside applicable shaders.
You can also do per-face assignment of textures using user data. If textures.xxx is set to an array of string values,
with the number of elements matching the number of faces, that array will be written out as a per-face array of user
data so each face can pick up its own value.
Using Pipeline Data to Set Textures
Different pipelines often use different methods to specify which textures should be used on a particular asset.
As discussed above, the normal convention in Katana is to use attributes called textures.xxx on geometry to hold
the individual texture paths needed for that piece of geometry. That data can be set in a number of different ways.
17 HANDLING TEXTURES |