RfM Reyes
|
IntroductionThis tutorial extends the shading technique introduced in the tutorial RSL: Color By Collision to the implementation of a custom hypershade node. The node detects collisions and outputs a color that can, for example, be wired into the "Surface Color" input of RMSGPSurface or RMSMatte. An example animation is shown below. This tutorial is in two parts. First, it outlines how to install, register and use the cutrColorByCollision.h node script. Secondly, it provides an overview of how the code for the node was developed. |
Installation & Registration
It is assumed the reader has customized the scripting environment of RenderMan Studio by
following the suggestions in the
RfM: Customizing
tutorial.
/* <rman id="rslt"> slim 1 extensions cutter { extensions fundza cutr { template void ColorByCollision { userdata { rfm_nodeid 1053511 rfm_classification rendernode/RenderMan/utility }
The path on line 56 must also be edited so that the RSLPlugin RfMShadeops RSLInclude {FULL_PATH_MUST_BE_EDITED/cutrColorByCollision.h} RSLFunction {} } Registration of the node is done in the users custom RenderMan_for_Maya.ini file. Open the file and enter the following text. # 1053511 LoadExtension rslt "/FULL_PATH_MUST_BE_EDITED/cutrColorByCollision.h" RAT::LogMsg INFO "cutrColorByCollision has been loaded" |
Using the NodeBecause the node writes data to a pointcloud it is necessary to assign three attributes to the geometry that will change color when they collide with other objects. Also, a display channel must be declared. For some background information about display channels refer to the RSL: AOVs - Secondary Images tutorial. Step 1 - Adding the Baking AttributesOpen the RenderMan Controls window and change the View to "Geometric Settings" figure 1.
Click on the "Create" button followed by the "Add/Remove Settings" button.
Add these attributes (using a right mouse click),
Select the objects in the scene whose surface color will change as result of collisions and click the "Attach" button. |
Step 2 - Adding the Display Channel
The custom node, by default, expects to write and read pointcloud data via a
variable, of data type "float", named "collisions". By adding a display channel it enables
PRMan to "pipe" the values of the "collisions" variable to a pointcloud.
Right-mouse click on the
Step 3 - Using the Custom NodeSelect the objects that should change color when they collide with other surfaces and assign either RMSGPSurface or RMSMatte to them. Click on the "Surface Color" connection icon and select cutrColorByCollision - figure 6. |
|
In the attribute editor assign a path for the ptc file - figure 7.
In Render Settings change the "Frame/Animation ext" to name.#.ext and set the "Start frame" to 0. The node creates a new pointcloud or initializes an existing pointcloud at frame zero.
Render the scene or an animation using the RenderMan menu's Batch Render item or the batchRenderRI
command presented in the tutorial, |
How the Node was DevelopedAlmost 100% of the time spent in developing the techniques used by the node was taken by writing the collision shader presented in the RSL: Color By Collision tutorial. The tutorial provides an overview of the "shader-to-function" developmental process. Function-to-Node ConversionThe ColorByCollision function given in listing 4 of the "RSL: Color By Collision" tutorial was opened in Cutter. The entire text of the function was selected. After right-mouse clicking the "Export As HyperShade Node" menu was used to generate the node script. Another example of this work-flow is given in the RfM: HyperShade Node Development tutorial. |
© 2002- Malcolm Kesson. All rights reserved.