CS 551/651-2: Advanced Computer Graphics
Assignment #1
Updates:
Goal: Write a basic ray tracer with support for rendering polygonal models
Assigned: Tuesday, January 23, 2001
Due: Thursday, February 1, 2001
Relevant reading:
Relevant software:
Synopsis: You will write a simple ray tracer which can read in and render a polygonal model on a checkerboard ground plane. Your code will support both reflection and shadows.
Details: Your ray tracer will read models in the .poly format. Several such models are given here. The format should be almost self-explanatory. Note that vertices are given as {x y z nx ny nz} and faces are given as 3 or 4 vertex indices for triangles or quads, respectively. Note: vertices are numbered starting at vertex #1.
You will also read in a scene description file that contains global information such as the placement of lights, and material information about the models. The scene description file will have the suffix .scene and will follow the following format:
E <float> <float> <float> The X, Y, Z coordinates of the view point
V <float> <float> <float> The X, Y, Z vector of the viewing direction
U <float> <float> <float> The X, Y, Z "up vector" of the viewport
W <int> <float> Image width (pixels) and horizontal FOV (radians)
H <int> <float> Image height (pixels) and vertical FOV (radians)
X <float> Distance from view point to screen
G <float> The y-intercept of the X-Z ground plane
C <float> Size of the ground plane checkerboard squares
L <float> <float> <float> The R, G, B intensity of the light source
<float> <float> <float> followed by the X, Y, Z coordinates of the light
O <int> The number of objects
The following information is then repeated for every object:
F <filename> Path and filename of the object's .poly file
A <float> <float> <float> Set the R, G, B ambient intensity components D <float> <float> <float> Set the R, G, B diffuse reflectivity components S <float> <float> <float> Set the R, G, B specular reflectivity components N <float> Set the n(shiny) coefficient
R <float> Reflectivity from 0 (no reflection) to 1 (chrome)
M <float> <float> <float> <float> Set a matrix which will transform this object <float> <float> <float> <float> Note: matrices do not accumulate; each object <float> <float> <float> <float> is transformed separately <float> <float> <float> <float>
For this initial assignment you need support only one object and three light sources, though in the future you will extend this assignment to support multiple objects. Your program will output images in PPM format. The PPM file format is extremely simple and can be read by many programs, including the UNIX viewer xv. The format looks like this:
P3 # This is a PPM file. Note that it’s text, not binary 640 480 255 183 134 59 183 134 59 183 134 59 183 134 59 59 183 134 59 183 134 59 183 134 59 183 134 […]
The first line contains the header "P3", which indicates the PPM version. The next line is a comment and can say anything after the "#" character. The next two numbers are the width and height of the image. I don’t know what the next number is, but it always seems to be "255"—probably an indication that color values range from 0-255 (i.e., 1 byte). After this header information follows the actual data: the red, green, and blue intensities of every pixel in the image, in row-major order, scaled from 0 (black) to 255 (bright).
Along with your assignment you should turn in two sample scenes that illustrate your ray-tracer in action. You can compile and test your ray tracer on either the SGIs in Small Hall or on a PC under Visual C++.
Grading: All assignments will be graded on a 10-point scale. Doing everything well earns you nine points; to get the tenth point requires adding additional features, creating particularly nice sample scenes, etc. You will lose points for bugs or not supporting required features (e.g., shadows). You will lose LOTS of points (maybe all of them) if your assignment doesn't compile!
1 day late: 1 point off
2 days late: 3 points off
3 days late: no credit
Turning in the assignment: Before class starts on Thursday, February 1, you should send me mail containing:
Advice: