Filtering alters the statements in a Rib file, or Rib files, before they are rendered.
Filters can be written in C++ using
Pixar's RifPlugin 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. It is assumed the reader has downloaded
and installed the scripts
presented in the tutorial RfM 23: Customizing.
What Are the Benefits of Rif'ing?
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 many shape and shading experimentations to be done efficiently because ribgen need not repeatedly occur prior to rendering. Depending on the type of filtering to be performed a rib (or a sequence of ribs) can be filtered/rendered and re-filtered/re-rendered several times before it is necessary to generate a new rib (or sequence of ribs). Using Cutter to develop a python Rif is efficient because it minimizes the use of Maya, or Houdini or any other bridge product.
Listing 1 (rif_it.py)
Using a Rif with 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 1 (rif_tester.py)
As an example of using a specific rif, change
Display "FULL_PATH_TO/rib__perspShape_beauty.0001.exr" "openexr" "Ci,a" "string camera" ["|persp|perspShape"]will be changed to,
Display "FULL_PATH_TO/rib__perspShape_beauty.0001.exr" "it" "rgba"
If the reader has downloaded
the scripts provided in the tutorial "RfM 23: Customizing" there
will be no need to save listing 2 as rif_it.py in their
Listing 2 (rif_it.py)
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/maya/rfm_scripts/image_tool 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\maya\rfm_scripts\image_tool java -Xms256m -Xmx256M -classpath .:cutter.jar Cutter
© 2002- Malcolm Kesson. All rights reserved.