Filtering alters the statements
in a Rib file, or files, before they are rendered.
Filters can be written in C++ using Pixar's Rif API or they can be
written in python using Pixar's
"PRMan for Python".
This tutorial deals with the use of Ri Filters
(Rifs) written in python.
The goal of the tutorial is to encourage readers to experiment
with python Rifs.
Applying a Rif using Maya & RfM
Rifs enable outputs and effects to be achieved that might either be very tedious or impossible to do directly via the Maya/RfM interface. Rifs also enable shape and shading experimentations to be done efficiently because ribgen need not repeatably occur prior to rendering. Depending on the type of filtering to be performed a sequence of ribs can be filtered/rendered and re-filtered/re-rendered several times before it is necessary to generate a fresh set of ribs.
The tutorial RfM: Batch Rendering demonstrates how a
sequence of frames to be rendered with the the stand-alone version of PRMan.
Listing 1 (rif_it.py)
Applying a Rif with Maya
Open the script editor in Maya and enter the following command. A rendered image should appear in an "it" window.
batchRenderRI("rif_it", 1,1); or, batchRenderRI("rif_it.Rif()", 1,1);
The batchRenderRI procedure does the following.
What to do if the Rif fails to work
Check the following if the scripts fail to work. Most importantly have the scripts presented
in the tutorial RfM: Customizing been downloaded and
Applying a Rif using Cutter
When developing a Rif it is best to apply it directly to a rib file using a
small python script - such as the one shown in listing 2. This can be conveniently done with
Cutter. The script makes direct use of Pixar's
Listing 2 (rif_tester.py)
Display "renderman/test/images/test.iff" "it" "rgba"
If the reader wishes to apply the Rif and render an image they should change,
ri.Begin('-') # See the contents of the processed rib to ri.Begin(ri.RENDER) # See the rendered image
Alternatively, if the reader wishes to save the filtered rib statements in another file
they should change,
ri.Begin('-') # See the contents of the processed rib to ri.Begin(ribout) # Create an output rib file
If the Rif fails to work it is most probably because the PYTHONPATH environment variable has not been set Cutter's run script (run.bat on Windows). For example, for Linux and MacOSX.
export RMANTREE=PATH_TO_YOUR_RPS_INSTALLATION export PYTHONPATH=$PYTHONPATH:$RMANTREE/bin export RMS_SCRIPT_PATHS=./:FULL_PATH_TO/RfM_ini java -Xms256m -Xmx256M -classpath .:cutter.jar Cutter
For Windows the run.bat file should contain the following.
set RMANTREE=PATH_TO_YOUR_RPS_INSTALLATION set PYTHONPATH=$PYTHONPATH:$RMANTREE\bin set RMS_SCRIPT_PATHS=.\:FULL_PATH_TO\RfM_ini java -Xms256m -Xmx256M -classpath .:cutter.jar Cutter
Applying a Rif(s) to a sequence of ribs with Cutter
The next script demonstrates how a sequence of ribs can be filtered.
Listing 3 (batch_tester.py)
Note this script over-writes the original input rib files. You may wish to edit the code so that the edited ribs do not replace the original rib files
© 2002- Malcolm Kesson. All rights reserved.