Sierpinski Gasket
             | 
    
            Introduction
            The python scripts presented in this tutorial generate Sierpinski gaskets rendered
			as RenderMan "Points" and "Blobby's". The python code was a direct port from the 
			RSL code presented in the tutorial
			RSL: Sierpinski Point Clouds. The technique used
			by both tutorials is taken from,
			 inputs = [ [0,0,1], [1,0,-1], [-1,0,-1] ] #, [0,1.5,-0.2] ] Listing 1 (sierpinski.py) 
 Listing 2 is a rib file that uses the unmodified version of the sierpinski.py script to generate a 3D Sierpinski gasket - figure 2.  | 
    
| 
			 Listing 2 (sierpinski.rib) 
  | 
    
			Sierpinski BlobbyListing 3 uses the 3D points it generates to define a RenderMan Blobby - figure 3. For other examples of how to generate other Blobby shapes procedurally refer to the tutorial RenderMan Procedural Primitives:Blobbies  | 
    
| 
			 Listing 3 (sierpinski_blobby.py) 
  | 
    
			ExplorationsSome interesting effects can be achieved by editing the halfStep function so that it can divide the distance between between two points by any value. For example, def halfStep(p1, p2, div):
    x = (p2[0] - p1[0])/div
    y = (p2[1] - p1[1])/div
    z = (p2[2] - p1[2])/div
    result = [p1[0] + x, p1[1] + y, p1[2] + z]
    return result
			Figures 4 and 5 show what happens when the "div" parameter changes from 0.6 to 0.7.  | 
    
© 2002- Malcolm Kesson. All rights reserved.