Simple PxrVary Example
One of the most common requirements of shading in animation or visual effects is varying the shader attributes efficiently for many objects. This can be anything from crowd simulations to leaves in a forest. This variation can make scenes more realistic and visually appealing. However, having to hand-alter dozens to hundreds of shaders can be prohibitive. This is where PxrVary comes in!
Attached is a Katana example file showing how to use OpScripts to generate the source variables when using the pattern. Read about the logic of the scene setup below.
- Notice that Identifier ID will work without OpScripts to define the ID. We auto-generate both identifier ID and identifier Name, so they will work without an OpScript.
- For Attribute selections, be sure and prefix with "user:" in the PxrVary node. In our example we use, user:rmanFloatAttr
- You may find more useful information on Primvars in the Katana documentation.
This is an example OpScript used to create an ID on a sphere.
The OpScript is assigned just below the primitive create. Each one is slightly different to ensure variation.
From here you will notice there are four different outputs, illustrating the different results from using different PxrVary sources (Name, ID, PrimVar, Attribute). Rendering each of these will produce different colored spheres. Download the scene to experiment!