Using agent metadatas inside a shader

Each render engine procedural takes care of transferring the agent metadata onto the render meshes, this process adds an "atoms_" prefix to all metadata names. You can use these metadata within shaders to have better control over your agent variations at render time.

For instance, you can create an agent group with an addMetadata module. In the addMetadata options set "myColor" as name for your metadata, the type to "vector" and then open the agent override dialog to set random values on your agents.





Go back to your variation scene. Create a simple renderman pxrsurface shader and connect a pxrattribute node to the diffuse color. Set the "variable name" attribute to "atoms_myColor" and the type to vector.
Assign this material to all your meshes and re-export the variations with the variation builder (make sure to select renderman as target render engine).

In your simulation scene, import your variations again and set the variations onto your agents. Once you render, you will see a render similar to the picture on the right, where the shader color is taken from the myColor metadata
(the addMetadata module should still be applied on your agent group and set up as explained above).

This can also be done in Arnold using the aiUserDataVector/Int/Float/... node or in V-Ray using a VrayUserColor node.


Copyright © 2017, Toolchefs LTD.