RfM
|
IntroductionThis tutorial provides information about the scripting of curves in Maya for use with RenderMan for Maya (RfM). RfM identifies a Maya curve as one that should be rendered if it has been assigned the attributes, rman__toattr___curveTipWidth rman__toattr___curveBaseWidth
These attributes can can be assigned via the GUI, figure 1, by selecting a curve and then choosing, Attributes->RenderMan->Add Rendering Attrs
It is often convenient, especially if a number of curves have been created with a mel script, to assign the rman attributes from the same script that produced the curves, refer to listing 2. Listing 1 (mel script)
|
Maya cv's & RenderMan cv'sThe number of cv's specified by a mel script may not result in the same number of cv's defined in the corresponding rib statement. For example, a Maya curve created using this mel command, curve -d 1 -p 0 0 0 -p 1 0 0; would be expressed in a (pre-baked) rib file as, Listing 2 (curveShape1_0.job.rib)
|
Because of the way that RfM Pro structures its rib files the Basis for the curve is specified in another rib file that is read by the renderer immediately before rendering the curve, listing 3. Listing 3 (curveShape1_0_attr.job.rib)
Because b-spline curves must be defined by no less than 4 cv's, RfM Pro repeats the first and last points when it produces the rib file shown in listing 2. Lets take a look at another example. In mel we might have a cubic curve defined by 5 cv's ie. curve -d 3 -p 0 0 0 -p 1 1 0 -p 2 -1 0 -p 3 1 0 -p 4 -1 0; The same curve written into a rib file would look like this, Listing 4
|
Curve SegmentsThe RenderMan Interface Specification allows "attributes" to be bound to each segment or span of a curve. Looking at a curve, from the "outside", it is defined by,
Another tutorial, "RenderMan: Curve Basics", illustrates how different curve types produce curves with different shapes even when they have identical cv's. From the point of view of the renderer, a curve consists of a number of segments (spans).
For example, figure 2 shows a b-spline curve that consists of 9 cv's (the first and last cv's have been repeated twice). The curve has (cv's - 2) segments and each of them has been assigned a width ie. Curves "cubic" [9] "nonperiodic" "P" [0 0 0 0 0 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 4 0 0 4 0 0] # one width for each of the 7 segments "width" [0.01 0.1 0.01 0.1 0.01 0.1 0.01]
To make it easier to see the overlaps between the cv's and the segments, the curve is shown
as a straight line even though it is, infact, a cubic curve.
The RenderMan Interface Specification allows any attribute to be assigned to the segments
of a curve. Surface color "
Curves "cubic" [9] "nonperiodic" "P" [0 0 0 0 0 0 0 0 0 1 1 0 2 -1 0 3 1 0 4 -1 0 4 -1 0 4 -1 0] "constantwidth" [0.03] "Cs" [1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1 1 1] |
© 2002- Malcolm Kesson. All rights reserved.