Ray Tracer

CS426 Assignment 5

Assigned Nov. 23, 1998, due Sunday Dec. 13, 1998, 11:59pm

Last modified: Fri Dec 4 22:25:15 EST 1998


In this assignment you will implement a basic raytracer. Use a recursive approach, as suggested in paragraph 6.10.1 of the Angel book.

Your program will read Inventor scene files and support:

Note that you have to work with a different partner from the one you worked with on assignment 4. Send us e-mail when you've found a partner, or when you have trouble finding one.

Scene geometry

Read your scenes from an Inventor file, then traverse the resulting scenegraph and convert it to whatever datastructure you want to use. Note that you need to support only a few Inventor nodes (SoIndexedFaceSet, SoSphere, SoMaterial, SoDirectionalLight, SoPointLight, SoSpotLight, SoPerspectiveCamera, ...).


The lecture notes of lecture 6 describe lighting models, and the notes of lecture 11 explain ray tracing. The notes of lecture 12 deal with some of the extra credit options.

Similarly, paragraphs 6.1-6.5 of the Angel book talk about shading, and paragraph 6.10.1 talks a little about ray tracers.

Implementation notes


Pay careful attention to this quote:
Novice programmers often neglect the design phase, instead diving into coding without giving thought to the evolution of a piece of software over time. The result is a haphazard, poorly modularized code which is difficult to maintain and modify. A few minutes of planning short-term and long-term goals at the beginning is time well spent.

- Paul Heckbert, ``Writing a Ray Tracer,'' in An Introduction to Ray Tracing, edited by Andrew Glassner (Note that this book is an excellent reference for all sorts of ray tracing techniques)

You should think very carefully about the structure of your system. You need to intersect rays with triangles, spheres, and possibly with your acceleration structures. You want some kind of generic object with function pointers to the intersection functions (in C++ you would use inheritance with virtual functions). Start early, and you've got plenty of time to finish.


What to submit

Source, makefile, Inventor scenefiles from both your fourth assignments, and a writeup, containing:

Do not submit image files. Instead, put a URL in your writeup.html pointing to a page with ray-traced images of the files from the 4th assignment, and images showing off your extra features.


If you implement all the required features, you'll score 14 out of 20 points. A number of extra credit options are listed below. The ones we think are the easiest are marked with a .

Many more are possible. Foley & van Dam, paragraph 16.12 is a good source for ideas. Also see the next section for pointers to extra credit ideas.

The winning digit "2" for the art contest2 points
Non-winning digit "2" (if it's pretty :-)1 point
Cones and cylinders1 point
Constructive solid geometry (Foley & van Dam, 12.7)3 points
Area lights, soft shadows1 point
A user interface which shows the ray tracing in progress, showing a coarse picture quickly, becoming progressively finer1 point
Adaptive oversampling using a priority queue, displaying intermediate results in real-time (Foley & van Dam, 15.10.4)2 points
Motion blur (of animated objects) (Foley & van Dam, 16.10)2 points
Depth of field (Foley & van Dam, 16.10)1 point
Real camera lenses (see this SIGGRAPH paper (in PDF format) for more info) 2 points
Texture mapping1 point
Texture antialiasing using mip-mapping1 point
Bump mapping1 point
Procedural textures (checkerboard, wood, marble, wavy water, etc.) 2 points
Environment mapping (Foley & van Dam, 16.6)2 points
Bounding volumes1 point
Hierarchical bounding volumes2 points
Octree (Foley & van Dam, 12.6.3)2 points
BSP tree (Foley & van Dam, 12.6.4)4 points
Intersections with actual curved surfaces (e.g. tensor product surface, extrusion)(use a root finding method, and explain in your writeup why your method converges and is correct)3 points
Parallelize your raytracer, using one master and several "compute slaves". Make sure your system is nicely load-balanced.2 points


There is an enormous amount of info on raytracing on the web. The POVRAY site is a good starting point. Or take a look at the Ray Tracing News magazine. Not to mention the SIGGRAPH proceedings...

Check out these images:

CS426, CS Department, Princeton University