RenderMan Procedural Primitives
|
IntroductionBeing able to generate points distributed randomly within or over a surface can be useful when modeling phenomena such as fireworks. This tutorial presents in listings 1 to 9 some useful utility procs implemented in Python, Tcl and the 'C' programming language. The implementations of the utility procs will be given followed by examples of their use. |
Proc randBetweenThis proc returns a random value between two input values. Although it is a very simple it is surprisingly useful for positioning objects, such as RenderMan points and curves, as well as setting randomized rgb components of colors. Listing 1 - Python Implementation
Listing 2 - Tcl Implementation
Listing 3 - 'C' Implementation
|
Procs length & normalize
The proc Listing 4 - Python Implementation
Listing 5 - Tcl Implementation
Listing 6 - 'C' Implementation
|
Proc scaleVectorThis proc returns the xyz values of a vector re-sized to a specified length. Listing 7 - Python Implementation
Listing 8 - Tcl Implementation
Listing 9 - 'C' Implementation
|
Examples of UseThis section provides some simple examples of how the procs given in listing 1 to 9 can be used with RenderMan's point primitive. For brevity, the examples are only given in Python. RiPoints in a Rectangular Volume
Listing 10 - rectangular box
|
RiPoints in a Ring
Listing 11 - Ring
|
RiPoints on a Disk
Listing 12 - Disk
|
RiPoints on a Cone
Listing 13 - Cone
|
RiPoints on a Cylinder
Listing 14 - Cylinder
|
Spheres on a Sphere
Listing 15 - Sphere
|
© 2002- Malcolm Kesson. All rights reserved.