You can use the ModifyRIB node to insert RIB (RenderMan Interface Bytestream) statements into your script to modify a RIB stream before it’s passed to the PrmanRender node. This can be useful in situations where you might want to adjust the shading on the surface of an object, replace it, or perform a variety of transformations and adjustments to multiple objects in a scene. For example, to replace an object in your script with basic geometry from RenderMan:
1. | Add a Scene node to the basic script that you created at the beginning of the chapter and connect two Light nodes and a Camera. |
2. | Click 3D > Modify > RenderMan > ModifyRIB and insert the node between the Cube and the Scene. |
3. | Next to the archive field, uncheck use. This activates the statements field. |
NOTE: You can load a RIB archive by leaving use checked and clicking the Select file button to locate it.
4. | In the ModifyRIB control panel select replace from the operation dropdown menu and enter the following RIB statement in the statements field: |
Sphere 0.25 -0.25 0.25 360
You should now see a basic sphere in the Viewer where the cube was.
5. | To change the color of the sphere and add a basic surface shader to the sphere, enter the following statements underneath: |
Color 0.4 0.6 0.1
Surface "wood"
This changes the color of the sphere to green and applies a wood-like finish to the surface.
NOTE: If you’re copying statements directly from a RIB file, only copy statements from between WorldBegin and WorldEnd as copying the entire contents of the file may result in instability issues.
For more information on RIB statements, please refer to the documentation provided with RenderMan.