Developers can add their own custom functions to the RenderMan Shading Language
by writing 'C++' "plugins" that conform to Pixar's RslPlugin API (Application
Programming Interface). This tutorial demonstrates how a relatively simple
plugin called "aveOpacity" can be built and tested using Cutter. The plugin
implements a RSL function that creates a text file containing some simple statistics
about the geometry to which the shader has been assigned. However, the main
purpose of this tutorial is not to produce a file containing statistics but rather
to enable the reader to set up Cutter so that
they can develop useful plugins.
Create a folder (project directory) in which you can save the plugin files.
Set the locations of your
In Cutter's->Edit->Preferences set the root directory of Pixar's devkit - figure 3. This will generally be the same folder as the RenderManProServer installation directory.
Save the file aveOpacity.cpp into your project directory. Use the keyboard shortcut Alt+e or Control+e to build the plugin. If the Cutter's Process Monitor window shows an error you must fix the problem before continuing. For example, under Linux you may get this error.
g++ -Wall -fPIC -I/usr/include -I./ -I"/opt/pixar/RenderManProServer-15.2/include" -c aveOpacity.cpp /bin/sh: g++: command not found make: *** [aveOpacity.o] Error 127
This particular problem has been caused by a compiler named
Step 5 - Customizing Cutter's Makefile
If, during the previous step, no errors were reported in the Process Monitor you
can ignore this step.
Cutter comes with many template makefiles so be careful to select the correct one.
Replace all instances of
Listing 1 (Makefile.rslplugin_LINUX)
Without making any other edits save the document in your
Step 6 - Preparing a Shader
Assuming the reader has got this far the next step is to compile a shader that uses the plugin. The source code for a simple shader that uses the aveOpacity plugin is shown in listing 2.
Listing 2 (plugtest.sl)
Save the code for the shader in your
Step 7 - Rendering
A rib file that uses the plugtest shader is shown below.
Listing 3 (plugtest.rib)
After rendering the rib you should find a data file named "polygon.txt" in the Cutter directory. It will contain the following information.
1.000 1.000 1.000 1.155 33728
The first line gives the average values for the rgb opacities of the entire polygon. The second line is a summation of the area's of all the micro-polygons and the last value is a count of the micro-polygons. Fairly useless information but if the reader is able to successfully produce the data file they can be sure their RslPlugin development environment is properly set up.
© 2002- Malcolm Kesson. All rights reserved.