CMSC 435/634: Computer Graphics

Lab 6: Ray tracing

Due December 7, 2000



Note: There is a bug in the Windows version of the edge library EdgeDrawScanline function Below is the correct glDrawPixels command
glDrawPixels( NumPixels, 1, GL_RGBA, GL_FLOAT, Scanline );




Purpose:

To gain experience in 3D hiddens surface removal and rendering using a simple raytracer.


Assignment

Implement a program that will allow defining spheres in a world space and viewing any part of it in screen space.

Implement the following commands.

observer_position: posX posY posZ or observer: posX posY posZ
coi: coiX coiY coiZ
head_tilt: tilt

hither_yon: hither yon
view_angle: angle or angle: angle
Position the observer in world space and set the viewing parameters: observer position, center-of-interest, head tilt (angle), hither and yon clipping distances, and horizontal half-angle-of-view.
viewport: vxl vxr vyb vyt
Clip and display the visible lines in a viewport on the screen defined by the four parameters. The four values are, in order, x-left, x-right, y-bottom, y-top limits of the world window and screen viewport.
device: keyword
input either the word ``screen'' (for drawing to the screen or a filename to write the image to a file.
PPM File Format:
    P3
    xsize ysize
    255
    r g b r g b r g b r g b .... r g b \n
    r g b r g b r g b r g b .... r g b \n
    r g b r g b r g b r g b .... r g b \n
    r g b r g b r g b r g b .... r g b \n
where r g b are int's between 0 and 255

shadows: 1
calculate shadows
shadows: 0
don't calculate shadows
reflections: 1
calculate reflections
refraction: 1
calculate refracted rays
light_position: x y z
set light source position.
1 or more commands of the form:
sphere: red green blue cx cy cz radius
Position a sphere in world space of radius radius at location (cx,cy,cy) with color (red,green,blue)
illumination_parameters: ka kd ks exp
set illumination parameters for ambient, diffuse, specular, and specular exponent. Note: this is per sphere.
texture_function: function_name (optional command)
        a function to texture map some shading parameter of the object.
end or <end of file>
Terminates the program
#
Ignore the rest of the line; this is a comment line

Notes