cos426.jpg (39279 bytes)

Computer Graphics, Spring 2007

Assignment 3: Ray Tracing

Due on Wed, April 9 at 11:59 PM

Art Contest Results


In this assignment you will create a simple ray tracing program. The program will read in a scene and output an image.

Getting Started

You should use the following skeleton code ( as a starting point for your assignment. We provide you with several files, but you should mainly change raytrace.cpp.

After you copy the provided files to your diectory, the first thing to do is compile the program. If you are developing on a Windows machine and have Visual Studio .NET 2005 installed, use the provided project files to build the program. If you are developing on a Mac, type make in the assignment3 directory. In either case, two executables will be created: raypro and rayview (or raypro.exe and rayview.exe). raypro is the program that reads a scene and outputs a mesh, while rayview provides a way for you to visualize scenes interactively before executing the ray tracer. Of course, you are welcome to change rayview.cpp any way you wish to provide visualizations.

The skeleton code is able to read scenes in a simple scene file format, This format was created to provide the features required by this assignment -- a simple scene graph along with materials, lights, and cameras. We provide several sample scenes that you can use to test your program. However, of course, you are not limited to these files -- you are encouraged to create your own files, either by hand, or with your programs from assignment #2. Note that it is very easy to combine multiple meshes and scenes in a single scene file using the "mesh" and "include" commands, and it is convenient to size and position scene elements with the transformations provided by the "begin" and "end" commands.

How the Program Works

The user interface for this assignment was kept as simple as possible, so you can concentrate on the ray tracing issues. The raypro program runs on the command line. It reads a scene from a .scn file (the first program argument) and writes an image to a new file (the second program argument). The program allows a few program arguments that control features of the raytracer. For example, ...
% raytrace in.scn out.jpg   -width 512   -height 512
creates a 512x512 image (out.jpg) of the scene in in.scn.

Alternatively, you could view the scene interactively with OpenGL using ...

% rayview in.scn -image out.jpg
in which case you could select a desired view and image size interactively and then hit the 'S' key to begin raytracing to produce an image of the scene with the current camera parameters. The rayview program allows you to view the bounding box hierarchy ('B') and to print the current camera parameters ('') in a form that can be added into a .scn file.

Of course, you are welcome to create your own program arguments by editing raypro.cpp and/or rayview.cpp. However, please do not change the program arguments already provided.

What You Have to Do

The assignment is worth 20 points. The following is a list of features that you may implement (listed roughly from easiest to hardest within each group). The number in front of the feature corresponds to how many points the feature is worth. The features in bold face are required. The other ones are optional. Refer to the examples web page to see images of inputs and outputs for several of these filters.

For each feature that you implement, include a screenshot with your writeup. Features without screenshots will not be graded.

By implementing all the required features, you get 14 points. There are many ways to get more points:

For images or movies that you submit, you also have to submit the sequence of commands used to created them, otherwise they will not be considered valid.

It is possible to get more than 20 points. However, after 20 points, each point is divided by 2, and after 22 points, each point is divided by 4. If your raw score is 19, your final score will be 19. If the raw score is 23, you'll get 21.25. For a raw score of 26, you'll get 22.

Extra credit points cannot replace the required features (bold items). Your final score will be calculated by adding 14 to the number of extra credit points you achieve, applying the above formula for diminishing returns, and then subtracting the number of required points that you missed.

What to Submit

Note: The submission materials are slightly different from before
You must submit one archive (zip or tar file). Use your Princeton LDAP username for the archive's name. It should have the following directory structure inside the zip:

The writeup should be a HTML document called assignment3.html. You will use the writeup to demonstrate the effects of the features you have implemented. List each implemented feature in the format given above, and along with the feature name, include a rendered picture (or pictures) that demonstrates it. The caption must indicate the regions of interest. If it is reasonable to demonstrate multiple features in a single picture, you may do so, for example, the entire ray-primitive intersection features can be demonstrated with a single, well-chosen scene.

Some features that improve quality will require a comparison of two or more images, for example, showing the effect of various reconstruction filters, motion blur, etc. Features that improve speed (octrees, grid accelerators) do not require a picture, but should include a brief comparison of performance on a scene with and without acceleration.

The included script must generate all pictures shown in the writeup, and run entirely in the script/ directory. Please make sure that you include all input files.

NOTE: Please convert your art contest and writeup images to JPEG format before submitting them (to save space).

Should you choose to create a video, there are many options for video encoders available, however we have found that FFMPEG works well and runs on both Windows and Mac. MEncoder is another option.

Always remember the late policy and the collaboration policy.


A few hints: