- Create a polygon shape of your choice, and light it with a few spot lights.
- Select the polygon shape and select the Polygons menu set.
- In the Color menu, select Color Set Editor.
- In the Color Set Editor, create 2 color sets using the New button.
- Name a color set 'surfaceColor' and name the other color set 'displacementColor'.
- Select the 'surfaceColor' color set.
- In the Color menu, select the Paint Vertex Color Tool item.Paint the surface as you like, leaving some visible areas unpainted. Avoid using the Flood button. You can try varying the opacity slider while painting in ‘RGBA’ mode.
- Back in the Color Set Editor, select the displacementColor color set.
- Since we are only going to use the alpha channel of this color set, use any color you want, but make sure the Channels radio button is set to ‘RGBA’. The surface is going to be displaced where you paint; you can adjust the Opacity slider and check the Accumulate opacity checkbox if you want.
- Bring up the Hypershade Editor and create a surface node, such as Blinn.
- Create a RenderMan Code node (listed in the Utilities section) and then select the RenderMan Code node and bring up the Attribute Editor.
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.
- Back in the Hypershade editor, connect the 'outColor' plug of the RenderMan Code node to the color input plug of the Blinn node.
- Create a 2D Texture node, such as Fractal, and connect its color output plug to the 'defaultColor' input plug of the RenderMan Code node.
- Create a Displacement node.
- Create a new RenderMan Code node.
- Select the new RenderMan Code node and bring up the Attribute Editor.
- Click on the Text Editor button next to the Shading Parameters text field.
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.
- Connect the 'displacement' output plug of the RenderMan code node to the 'Displacement' input plug of the Displacement node.
- Connect the 'displacement' output plug of the Displacement node to the 'displacementShader' plug of the shading group connected to your surface node.
- Assign the material you just created to your polygon shape.
- Because we are doing displacement, we need to specify a displacement bound. Bring up the Assignment Panel by selecting its entry in the 3Delight menu (or by clicking on the Assignment Panel button in the 3Delight Shelf).
- Make sure your polygon shape is selected.
- In the Assignment Panel, create a geometry attribute node by clicking on the texture button next to the Attribs option menu.
- Click on the AE button to edit this node in the Attribute Editor.
- In the Displacement group, assign a value for the 'Displacement Bound' attribute. The value should be as high as the maximum possible displacement value, so it is safe to assign here the same value as the multiplier used in the RenderMan Code above (in this example, the multiplier is ‘2’).
- Choose the 3Delight > Render menu item to render your masterpiece.
The following example shows how to export vertex colors; additionally, the RenderMan Code node will be used to visualize the color sets in a rendered image.
Overview
Content Tools