CS155 Computer Graphics

Snowman Lab - Part 2

Now you'll repeat the snowman exercise using 3D transforms.





  1. Copy the following rayfile into notepad, save it, then eliminate the .txt exension.
    #version HMCCS155FALL2005
    
    
    #camera
    	    0.0     0.0     10.0 	// position
    	    0.0     0.0     -1.0 	// facing
    	    0.0     1.0     0.0 	// up
    	    20.0                	// heightAngle
    
    #background   0.0  0.0  0.5
    
    #ambient
    	1.0 1.0 1.0 //intensity
    
    
    
    #material -n white  --
    	    1.0     1.0     0.6 // ambient
    	    0.0     0.0     0.0 // diffuse
    	    0.0     0.0     0.0 // specular
    	    0.0     0.0     0.0 // emissive
    	    0.0     0.0         // kspec    ktrans
    	    1.0                 // refind
    
    
    #material -n black  --
    	    0.0     0.0     0.0 // ambient
    	    0.0     0.0     0.0 // diffuse
    	    0.0     0.0     0.0 // specular
    	    0.0     0.0     0.0 // emissive
    	    0.0     0.0         // kspec    ktrans
    	    1.0                 // refind
    
    #group_begin -n firstGroup --
    #translate 0 0 -10
    #rotate 45 0 0 1
    #scale 2 1 1
    
    #sphere -m white --
    	    0.0     0.0     0.0 // position
    	    1.0                 // radius
    
    #group_end
    
    
    #rayfile_end
    
  2. There are a couple of differences between this file and the last one. First the version number at the top is different. We'll come back to that in a moment. The second difference is that we begin with a sphere of radius 1 centered at the origin, then scale, rotate, and translate it. Open this file in the ray tracer and render it.
  3. A group in a rayfile starts with the directive
    group_begin
    You can specify a name for the group using the -n option. In the example the name is firstGroup. This is useful to make complex scenes understandable, but also because the name is read in as part of the object description and can be used in debugging.

    After the group directive, are a zero or more transform directives. The sample rayfile gives one of each type. Note that the first transform is applied last. If you use these transform directives the first non-blank line of your ray file must be #version HMCCS155FALL2005. (You should use this as a default. Originally we specified transforms by explicitly providing a transformation matrix; this type of input is still supported if you should want to use it but using the transform directives is usually easier.)

    After the transforms one or more objects are defined. In this case there is a single sphere. Note that all group transforms are applied to all objects in the group.

    The group ends with
    #group_end
    Your job is to eliminate the group in the sample and replace it with groups for your spheres. For this part of the lab you are only allowed to use spheres of radius 1 centered at the origin. You must use transforms to scale and translate them as needed.

    Render your scene using the ray tracer.
  4. Now create two new ray files that make the snowman nod her head; one by rotating the head up and one that rotates the head down. Render an image with each.
  5. Augment one of the nodding ray files so that the snowman ends up sitting on the positive x axis, pointed in the <1,0,1> direction. Render an image.
  6. Upload your images to Sakai (both partners' accounts). /ol>

    Last updated Aug. 09