CS 371
Computer Graphics
Spring 2005


Program 1: A Simple Ray Tracer

Due on 2/21/05 before MIDNIGHT

In this assignment you will be implementing a rudimentary ray tracer. Your ray tracer should be able to read different scene files, then render the scene most recently read.

Program Requirements

Help!

In order to ensure that you can complete this assignment in a reasonable amount of time, I am providing several classes (some complete, some skeletal) to get you started.

You will have to build the program which performs the rendering, as well as provide a Sphere3D class for dealing with spheres and a Material class for dealing with material properties. You may also wish to design other classes.

The classes provided are in a directory called program1 in the directory ~/shared/cs371Fall05/. Also provided are some makefiles. You should copy the entire program1 directory to your own file system. Typing gmake within this directory should compile all of the programs. By following the Makefile approach I use, you should be able to create additional makefiles for your own classes, which simplifies the compilation process greatly.

Enhancements and Extensions

There are countless ways to have fun with this assignment. Here are some:

What to turn in

There will be a "turn-in" directory available into which you can drop your work. To turn in your work, create a directory containing all files necessary to make your program run (source code, header files, object code, makefiles, README file, etc).

Call your directory yourlastnameProg1 and pack it into a single "tar" file. Then drop the tar file off in the drop-off directory. The files in your directory should be correctly set up so that I can compile and run them without having to make changes.

For more information...

Any news flashes will be added to the course home page. There are also links to the source code for the programs that we have been discussing in class. And, again, there's me.

A Typical Scene File

// Here is a sample scene. The keyword // indicates a comment that extends
// the end of the current line.  Other keywords are:
// 	ambient, eye, light, size, sphere, and material.
// A material applies to all spheres after it but before the next material
// Any spheres defined before the first material get the default material
// The 'size' value (number of spheres in the scene) must appear before
// any spheres are read.
ambient (0.5,0.5,0.5)
eye (0,0,1.5)
light ((-5,5,10),(.6,.6,.6),(.6,.6,.6))
size 17
material ((0.19125, 0.07355, 0.0225),(0.7038, 0.27048, 0.0828),
(0.0256777, 0.137622, 0.086014),12.8)
// some small spheres
sphere ((-3,0,-4.5),.2)
sphere ((3,0,-4.5),.2)
sphere ((1,2.66,-4.5),.2)
sphere ((3,2.66,-4.5),.2)
// a big sphere
sphere ((-1,-1,-6),1)
// change materieal
material ((0.329412, 0.223529, 0.027451),(0.780392, 0.568627, 0.113725),
(0.992157,0.941176,0.807843),27.8974)
// some small spheres
sphere ((-3,-2,-4.5),.2)
sphere ((-1,-2,-4.5),.2)
sphere ((3,.66,-4.5),.2)
// a big sphere
sphere ((0,0,-7),1)
material ((0.25, 0.25, 0.25),(0.4, 0.4, 0.4),
(0.774597, 0.774597, 0.774597),76.8)
// a small sphere
sphere ((3,2,-4.5),.2)
// a big sphere
sphere ((1,1,-6),1)
material ((0.10588, 0.058824, 0.113725),(0.427451, 0.470588, 0.541176),
(0.3333, 0.3333, 0.521569),9.84615)
// some small spheres
sphere ((-3,-1.33,-4.5),.2)
sphere ((-1,1.33,-4.5),.2)
sphere ((1,1.33,-4.5),.2)
sphere ((3,1.33,-4.5),.2)
// big sphere
sphere ((-1,1.5,-5.7),1)
//

lenhart@cs.williams.edu