Click on the Text Editor button next to the Shading Parameters text field and append the following lines in the text editor:
shader_input varying color surfaceColor shader_input varying float surfaceColor_alpha color defaultColor output color outColor |
The first line defines a RGB color input parameter that varies for each vertex. Since it is named identically to a color set that we will export, the painted colors of that color set are passed automatically to it. The second line defines an input parameter for the alpha channel of the 'surfaceColor' color set. Note that the RGB data is exported to a variable named identically to the color set, while the alpha channel is exported to a variable that has '_alpha' appended to the color set name. The third line defines a color input plug for the RenderMan Code node. Finally, the last line defines an output plug in the same fashion.
Click on the Text Editor button next to the Shading Code text field and append the following lines in the text editor:
outColor = mix(defaultColor, surfaceColor, surfaceColor_alpha); |
This line of code simply assign to the 'outColor' plug a mixture of the colors 'surfaceColor' and 'defaultColor' based on the alpha channel of the 'surfaceColor' color set.
In the text editor, append the following lines:
shader_input varying float displacementColor_alpha output float displacement |
These lines defines the following: the first line defines a float parameter that varies for each vertex. It will automatically receive the alpha channel of the 'displacementColor' color set. The second line simply defines a float output plug.
Click on the Text Editor button next to the Shading Code text field. In the text editor, append the following line:
displacement = 2 * displacementColor_alpha; |
This line simply assigns to the displacement output plug two times the alpha channel of the 'displacementColor' color set. Note that you can increase or decrease the multiplier value to make the displacement more or less obvious.