RenderMan
|
Introduction
This tutorial is a continuation of
"RenderMan: Post Processing Curve Widths".
The introduction to that turorial provides background information
about RenderMan Studio (RMS) and RenderMan's |
|
|
RMS Directory Structure & File NamesRMS has a complex structure of directories and multiple rib files per frame. If a Maya scene, say "untitled", has a curve named "curve1" the rib data for the curve will be found (in the scenes project directory) at, renderman/untitled/job/curveShape1_0.job.rib
If "curve1" in Maya is renamed so that data about its normals (to three decimal places of accuracy) forms part of its name the rib file generated by RMS would look something like, |
curveShape1_n408_p816_p408_n764_n445_p465_p929_n357_p86_p711_n405_n573_0.job.rib
|
Based on the file name following the prefix -0.408 0.816 0.408
The job.rib file will contain statements similiar to those shown below. ##RenderMan RIB version 3.04 Declare "cubic" "" Declare "nonperiodic" "" Curves "cubic" [8] "nonperiodic" "P" [-1 0 0 -1 0 0 -1 0 0 1 1 0 -2 2 1 1 3 4 1 3 4 1 3 4] "constant float constantwidth" [0.2] "constant string primtype" ["curves"] In particular, notice there is no reference to the name of the curve within the file. For example, the rib statement, Attribute "identifier" "name" "..."
is not present. Therefore, the name of the job.rib must be used as the sole source of information about the normals of the curve. How the information about the normals at each cv is encoded into the name of the shape node is the subject of the next section. |
Curve Creation and EncodingThree mel scripts are responsible for creating a cluster of curves, naming the shape nodes and adding the appropriate rman shaded geometric attributes that ensure the curves will be rendered by prman ie. curveEncode.mel
Listing 1 renames the shape node of a curve so
that data about the normals at each of its 4 cv's is encoded in its
name. The xyz components of the normals are represented by a four
character string, accurate to three decimal places, where
the first character, " |
Listing 1 (curveEncode.mel)
Listing 2 creates an arbitary number curves that are intended to look like a "clump" of grass. Listing 2 (curvesCreate.mel)
Listing 3 creates a Shared Geometric Attribute (SGA), adds three rman attributes to it, and then assigns the SGA to the curves. Listing 3 (curveAddSharedAttrRI.mel)
The scripts can be tested with the following mel commands entered into Maya's script window. source "FULL_PATH/curveEncode.mel"; source "FULL_PATH/curveCreate.mel"; source "FULL_PATH/curveAddSharedAttrRI.mel"; select -all; delete; string $grasses[] = curveCreate(50, <<0,2,0>>,<<0,0,0>>); curveAddSharedAttrRI($grasses, 0.05, 0.01); After executing the commands shown above, generate the rib files with the following command. rman genrib Now that the rib files have been produced you are ready to post-process them. The rib files that require post-processing will be found in the Maya project directory ie. renderman/untitled/rib/job
|
Decoding and Re-writing the Job.rib FileListing 4 provides a Tcl script that will decode and modify the job.rib files. Listing 4 (processJobFiles.tcl)
|
© 2002- Malcolm Kesson. All rights reserved.