The Teapot

This page demonstrates the basics of scripting shapes RenderMan scene description (RIB) protocol. Writing RIB files by hand focuses attention on the use of color, opacity and the fundamental concepts related to xyz coordinate system. The preliminary renders have been done using basic shading so that the geometry can be more easily seen.

The Teapot Archive Code:


#Teapot

    AttributeBegin #Teapot - Attribute
    #Teapot Body
        AttributeBegin #Teapot Body - Attribute
        #Surface "plastic"
        #Color 1 1 1
           TransformBegin #Teapot Body - Transform    
        #Teapot Body - Main    
            TransformBegin    
                AttributeBegin
                    Attribute "identifier" "name" ["Body Bottom"]
                    Translate 0 -.17 0
                    Rotate -90 1 0 0
                    Scale 1 1 .7
                    Sphere .5 -.35 0.2 360        
                AttributeEnd        
                AttributeBegin
                    Attribute "identifier" "name" ["Body Base"]
                    Translate 0 -.5 0
                    Rotate 90  1 0 0
                    ReverseOrientation
                    Torus .4 0.1 160 250 360
                AttributeEnd
                AttributeBegin
                    Attribute "identifier" "name" ["Body Middle"]
                    Translate 0 .39 0
                    Scale 1 2.1 1
                    Rotate 90  1 0 0
                    ReverseOrientation
                    Torus .45 0.2 86 230 360
                AttributeEnd
                AttributeBegin
                    Attribute "identifier" "name" ["Body Edge"]
                    Translate 0 .7 0
                    Rotate 90  1 0 0
                    Torus .32 0.02 0 360 360
                AttributeEnd        
                AttributeBegin
                    Attribute "identifier" "name" ["Body Ring"]
                    Translate 0 -.03 0
                    Rotate 90  1 0 0
                    Torus .45 0.02 0 360 360
                AttributeEnd            
            TransformEnd

        #Teapot Body - Main - End        
        #Teapot Body - Handle
            TransformBegin        
                Translate .4 .55 0 
                Rotate 90 1 0 0
                Scale 1.3 1.3 1.3                
                AttributeBegin
                    Attribute "identifier" "name" ["Handle Top"]
                    Rotate 90  0 1 0
                    Cylinder .03 -.2 0 360
                AttributeEnd
                AttributeBegin
                    Attribute "identifier" "name" ["Handle Mid"]
                    Translate 0 0 .1
                    Rotate 90 1 0 0
                    Rotate -90 0 0 1
                    Torus .1 0.03 0 360 120
                AttributeEnd        
                AttributeBegin
                    Attribute "identifier" "name" ["Handle Bot"]
                    Translate .045 0 .23
                    Rotate -30 0 1 0
                    Cylinder .03 -.1 0.2 360
                AttributeEnd
            TransformEnd

        #Teapot Body - Handle - End    
        #Teapot Body - Spout
            TransformBegin                
                Translate -.65 .21 0
                Rotate 90 1 0 0
                Scale 1.3 1.3 1.3        
                AttributeBegin
                    Attribute "identifier" "name" ["Spout Mid"]
                    Rotate 0  0 1 0
                    Cylinder .035 -.2 .1 360
                AttributeEnd                
                AttributeBegin
                    Attribute "identifier" "name" ["Spout Edge"]
                    Translate -.1 0 -.2
                    Rotate 90 1 0 0
                    Rotate -90 0 0 1
                    Torus .1 0.035 0 360 90
                AttributeEnd                    
                AttributeBegin
                    Attribute "identifier" "name" ["Spout End"]
                    Translate .15 0 .1
                    Rotate 90 1 0 0
                    Rotate 90 0 0 1
                    Torus .15 0.035 0 360 90
                AttributeEnd                        
                AttributeBegin
                    Attribute "identifier" "name" ["Spout Joint"]
                    Translate .13 0 .26
                    Sphere .07 1 -1 360        
                AttributeEnd            
            TransformEnd        
        TransformEnd #Teapot Body - Transform - End    
        AttributeEnd #Teapot Body - Attribute - End                
    #Teapot Body - End        
    #Teapot Lid        
        AttributeBegin #Teapot Lid - Attribute - End
        #Surface "plastic"
        #Color 1 0 0        
        TransformBegin #Teapot Lid - Transform - End        
            Translate 0 1 0
            AttributeBegin
                Attribute "identifier" "name" ["Lid Main"]
                    Translate 0 0 0
                    Rotate 90  1 0 0
                    Paraboloid .3 0 .33 360
                    AttributeEnd            
            AttributeBegin
                Attribute "identifier" "name" ["Lid Neck"]
                    Translate 0 0 0
                    Rotate 90  1 0 0
                    ReverseOrientation
                    Torus .085 0.05 180 250 360
            AttributeEnd    
            AttributeBegin
                Attribute "identifier" "name" ["Lid Head"]
                    Translate 0 .045 0
                    Rotate 90  1 0 0
                    Scale 1 1 .8
                    Sphere .07 .5 0 360
               AttributeEnd    
            AttributeBegin
                    Attribute "identifier" "name" ["Lid Extra"]
                    Translate 0 .08 0
                    Rotate 90  1 0 0
                    Scale 1 1 1.3
                    Sphere .035 1 -1 360
                AttributeEnd    
            TransformEnd #Teapot Lid - Transform - End

	AttributeEnd #Teapot Lid - Attribute - End
        #Teapot Lid - End    
    AttributeEnd #Teapot -Attribute -End
#Teapot

Basic Shading:



Code:

 
 WorldBegin
    Surface "plastic"
    AttributeBegin
        Translate 0 -.55 0
        Scale 50 50 50
        Color 1 1 1
        Polygon "P" [-0.5 0 -0.5  -0.5 0 0.5 
		     0.5 0 0.5  0.5 0 -0.5] 
                "st" [0 0  0 1  1 1  1 0]
    AttributeEnd        
    AttributeBegin
        ReadArchive "My_Teapot_Archive_01.rib"

    AttributeEnd
 worldEnd




Traced Occlusion:



Code:


 WorldBegin
        Attribute "visibility" "trace" [1]
        Surface "tracedOcclusion"
                "Ko" 1.0
                "samples" 1024.0
                "coneangle" 90.0
                "bakename" [""]                            
        AttributeBegin
            Translate 0 -.53 0
            Scale 50 50 50
            Color 1 1 1
            Polygon "P" [-0.5 0 -0.5  -0.5 0 0.5  
                        0.5 0 0.5  0.5 0 -0.5] 
                   "st" [0 0  0 1  1 1  1 0]
        AttributeEnd        
        AttributeBegin
            ReadArchive "My_Teapot_Archive_01.rib"

        AttributeEnd
 WorldEnd


Advanced Lighting - Shadows:



Code:


 WorldBegin
    LightSource "ambientlight" 1 "intensity" 0.1
    LightSource "shadowspot" 1
        "intensity" 15
        "lightcolor" [1.0 1.0 1.0]
        "from" [2 3 1]
        "to" [0 0 0]
        "shadowname" ["spot1.tx"]        
    LightSource "shadowspot" 2
        "intensity" 20
        "lightcolor" [0.733 0.847 0.886]
        "from" [-5 1 2]
        "to" [0 0 0]
        "shadowname" ["spot2.tx"]    
    LightSource "shadowspot" 3
        "intensity" 20
        "lightcolor" [0.941 0.874 0.705]
        "from" [-1 3 -4]
        "to" [0 0 0]
        "shadowname" ["spot3.tx"]
    Surface "plastic"

    AttributeBegin
        Translate 0 -.55 0
        Scale 50 50 50
        Color 1 1 1
        Polygon "P" [-0.5 0 -0.5  -0.5 0 0.5  
	    		0.5 0 0.5  0.5 0 -0.5] 
               "st" [0 0  0 1  1 1  1 0]
    AttributeEnd    
    AttributeBegin
        ReadArchive "My_Teapot_Archive_01.rib"

    AttributeEnd
 WorldEnd