RenderMan
Curve Normals


return to main index



Introduction

This tutorial covers the basic issues of dealing with RenderMan's Curves and issues relating to the specification of their normals. A rib file can either specify the surface normals of a curve or it can let the renderer orientate the curve so that is always faces the camera. Figure 1 shows four colored Curves rendered without their normals being specified.



Figure 1


The rib file that rendered the curves is shown in listing 1.


Listing 1


ObjectBegin 1
    Basis "b-spline" 1 "b-spline" 1
    Curves "cubic" [8] "nonperiodic" 
           "P" [0.1 0 0   0.1 0 0    0.1 0 0      
                1 2 0     1.5 2 0    2 1 0   
                2 1 0     2 1 0 ]
           "constantwidth" [0.125]
           "Cs" [0.090 0.501 0.090   0.090 0.501 0.090   
                 0.090 0.501 0.090   0.090 0.501 0.090   
                 1 1 0   1 1 0]
ObjectEnd
# Note the use of this Hider to improve the rendering of
# the curves
Hider "stochastic" "int sigma" [1] "float sigmablur" [1.0]
  
Display "curve_normals" "it" "rgba"
Format 427 240 1
Projection "perspective" "fov" 40
ShadingRate 1
LightSource "distantlight" 1 "intensity" 2.5 
            "from" [0 0 0] "to" [0 0 1]
  
Translate  0 -0.8 4.7
Rotate -30 1 0 0
Rotate 40   0 1 0
Scale 1 1 -1
WorldBegin
    ReadArchive "cutrAxes.rib"
    AttributeBegin
        Surface "plastic"
        # Again, note the use of these attributes
        Attribute "dice" "hair" [1]
        Attribute "stochastic" "int sigma" [1]
  
        ObjectInstance 1
        Rotate -90 0 1 0
        ObjectInstance 1
        Rotate -90 0 1 0
        ObjectInstance 1
        Rotate -90 0 1 0
        ObjectInstance 1
    AttributeEnd
WorldEnd

So that the b-spline curve starts and ends at it first and last control vertex the the point data "P" duplicates the xyz's of the first and last cv.



Figure 2


Figure 2 shows the same curves rendered with normals ("N") and the rib file is shown in the next listing. It appears that with prman version 13 (and higher) the negative z-axis scaling applied by the camera transformations requires the use of ReverseOriention within the Attribute block. The scaling is applied so that the world coordinate system is right-handed ie. it matches the handedness of Maya and Houdini. Refer to the tutorial "Rib: Left-hand & Right-hand Coordinate Systems".


Listing 2


ObjectBegin 1
    Curves "cubic" [8] "nonperiodic" 
           "P" [0.1 0 0   0.1 0 0    0.1 0 0      
                1 2 0     1.5 2 0    2 1 0   
                2 1 0     2 1 0 ]
           "constantwidth" [0.125]
           # arbitary normals!
           "N"  [0 1 0  0 1 0  0 1 0  
                 0 1 0  0 1 0  0 1 0]
           "Cs" [0.090 0.501 0.090   0.090 0.501 0.090   
                 0.090 0.501 0.090   0.090 0.501 0.090   
                 1 1 0   1 1 0]
ObjectEnd
Display "curve_normals" "it" "rgba"
Format 427 240 1
Projection "perspective" "fov" 40
ShadingRate 1
  
LightSource "distantlight" 1 "intensity" 2.5 
            "from" [0 0 0] "to" [0 0 1]
Translate  0 -0.8 4.7
Rotate -30 1 0 0
Rotate 40   0 1 0
Scale 1 1 -1
WorldBegin
    ReadArchive "cutrAxes.rib"
    AttributeBegin
        ReverseOrientation #<<-- required
        Surface "plastic"
        ObjectInstance 1        
        Rotate -90 0 1 0
        ObjectInstance 1
        Rotate -90 0 1 0
        ObjectInstance 1
        Rotate -90 0 1 0
        ObjectInstance 1
    AttributeEnd
WorldEnd

The Basis statement in rib files generated by RenderMan for Maya Pro (RfM Pro) is shown below.

    
Basis [-0.166667 0.5     -0.5      0.166667  
            0.5     -1        0.5      0  
           -0.5      0        0.5      0  
            0.166667 0.666667 0.166667 0 ] 1 
          [-0.166667 0.5     -0.5      0.166667  
            0.5     -1        0.5      0  
           -0.5      0        0.5      0  
            0.166667 0.666667 0.166667 0 ] 1



© 2002- Malcolm Kesson. All rights reserved.