RenderManPost Processing Curve Widths

Introduction

Prior to 2007 Pixar's high-end production software for Maya was RenderMan Artist Tools (RAT).
While it enabled Maya curves to become renderable objects
it only allowed a constant width to be assigned to a curve. The RenderMan Specification,
however, allows curves to be defined with varying widths and colors. In fact any user-defined
attribute can be bound to the curve. With the introduction in 2007 of Pixar's RenderMan Studio (RMS)
it became possible to assign, from within the Maya interface, a "base width" and a
"tip width" to a curve. Curves generated by RMS smoothly interpolate the width of the curve.
Curve widths cannot be assigned on a segment by segment basis. Refer to the tutorial
"RenderMan: Maya Curves to Rman Curves" for
an explanation of how to blend colors along the length of a curve.

Figure 1
Before post-processing

Figure 2
After post_-processing

Although RMS does not enable more than two widths to be assigned to a curve there are times
when it is useful to be able to render curves whose segments have differing multiple widths
and/or differing normals. This and another tutorial propose two "work-arounds". The first
technique, and the subject of this tutorial, uses a script to post-process the rib file(s)
generated by RMS. The second technique is outlined in
"RenderMan: Post Processing Curve Normals"
and relies on hiding data in the name that Maya assigns
to a curve. A script is also used to post-process the rib files but instead of assigning arbitary
attribute values to a curve it extracts numeric data from the name of each curve that it applies
as additional attributes to the curve.

Adding Arbitary Widths

This tutorial describes the simpliest of the post-processing techniques. In listing 1
a sequence of differing but fixed widths are added to a curve. The values could be
semi-randon values. The technique is relatively simple because the values do not depend on
any information derived from the Maya scene. Instead the additional values depent solely on
the values the Tcl script "decides" to add to a curve or curves.
Post processing a sequence of rib files consists of,

Any general purpose scripting/programming language can be used to post-process
rib files. Listing 1 provides an example written in Tcl. The script
processes the rib files located in a "target" or "source" directory. The script assumes
the post-processed rib's are to be saved in a "destination" directory. Before continuing you may wish to
review the tutorial
"Tcl: File Filtering".

The script assumes,

the original Maya curves ALL have 4 cv's, as a consequence

each RenderMan Curves statement in the rib files produced by RMS has
8 cv's.

Because the Curves statements in the rib files consist of 8 cv's each
curve will have 6 segments and as such we will be able to add 6 widths. Refer to the
tutorial that deals with curve segments
for more details.

Before using this script decide what width values you wish to use and edit the
script appropriately. Other than that the only other edit you will need to make is
to change the paths leading to the input and output directories on the last lines of
the script.

For example, figure 1 shows that the "source" rib's are located in the
default mtor "rib" directory while the "destination" directory is called "out_ribs".
To run the script save it as "addCurveWidths.tcl". Then "cd" to the directory in which
it is saved and enter this command,

tclsh addCurveWidths.tcl

The time taken to produce the copies will obviously depend on the number of rib's
and their size. Rib files 1MB in size will each take about 2.5 seconds to process.
Once the copies have been produced they can be batch rendered.