RSL
|
Introduction
Point clouds are generated by a specialized shader. They bake "expensive to calculate"
shading data into a file using the RSL function Geometry "brickmap" "filename" "PATH/sierpinski.bkm"
Information about this rib statement can be found at,
|
To demonstrate the technique the shader in listing 1 generates a 3D
version of a
Sierpinski gasket.
An example of which is shown in figure 1. The shader in listing 2 is, computationally,
extremely expensive because it uses a for-loop that repeats a calculation
10's of thousands, 100's of thousands, or even more times per micro-polygon. Such a
shader cannot be used to shade a "regular" surface. However, there is a RenderMan
primitive that can be rendered with the shader because it will run the shader only once.
That object is a RenderMan point (aka RiPoint).
|
Basic Code
The shader code consists of two files, sierpinski.sl and sierpinski_lib.h,
listing 1 and 2 respectively. When the shader is assigned to a RenderMan
point (aka RiPoint) a point cloud is written that contains a point cloud
in the shape of a 3D Sierpinski gasket. After the bake-pass the point cloud
must be converted to a brickmap in preparation for its use as renderable
geometry - listing 5.
|
Listing 1 (sierpinski_lib.h)
|
Listing 2
|
Bake Pass - Beauty PassListing 3 provides a rib file suitable for baking the Sierpinski point cloud. Listing 3 (bake-pass)
|
Listing 4 provides a rib file suitable for rendering a beauty pass of the Sierpinski brickmap. Listing 4 (beauty-pass)
|
Listing 5 gives the code for a shader that considers the normal of the micro-polygon being shaded to face the incident ray ie. the viewing vector. This ensures that when the brickmap is rendered as geometry all parts of the Serpinski cloud have equal brightness. Listing 5
|
© 2002- Malcolm Kesson. All rights reserved.