COS 526 - Advanced Computer Graphics

Fall 2003

Course home Outline and lecture notes Assignments


Programming Assignment 3: Path Tracer

Due Wednesday, Dec. 3

For this assignment, you will implement a Monte Carlo path tracer. Your program must do the following:

  1. Generate multiple primary rays for each pixel.
  2. Trace the rays into the scene (see CS 426 notes for details).
  3. At each intersection, generate secondary rays to estimate the direct illumination and indirect (specular and diffuse) illumination. Be careful to weight these terms correctly when combining them.
  4. Terminate tracing paths with Russian roulette (see [Arvo 90]).

In addition, you must implement one of the following:

Getting Started

There is code available here as a starting point for your assignment (courtesy Tom Funkhouser). To allow you to focus on the nuts and bolts of the actual Monte Carlo path tracing, you are provided with a libaries (in the "pkgs" subdirectory) that provide a host of data structures for basic math and data manipulation operations (pkgs/RNBasics), 2D geometry (pkgs/R2Shapes), 3D geometry (pkgs/R3Shapes), and computer graphics rendering (pkgs/R3Graphics).   "Documentation" for each C++ class is provided in the "docs" subdirectory, and example programs appear in the "apps" subdirectory.  In particular, you should start by editing the code in apps/rdraw.C and/or apps/monte/rmonte.C, which implements simple ray casters and provide a good initial structure for your program.

After you copy the provided files to your directory (e.g., /u/sue/assn1), the first thing to do is compile all the existing code. If you are developing on a Windows NT machine, running Microsoft Visual C++, from the MS-DOS prompt, type:

% cd /u/sue/assn1
% "c:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32"
% nmake

Then, you can begin editing the code in /u/sue/assn1/apps/monte/monte.C.  it is recommended that you develop incrementally (implement in small steps, and test each step separately) and that you do most of your testing on simple, well-designed examples (simple scenes, small images, few paths per pixel, stresses feature of interest, etc.) because execution/debugging times will be quite long otherwise.

The code provides a function (R3ReadRayFile in R3Graphics/R3Io.C) to read simple scene files.  The syntax of the .ray file format is described here.  Those of you who took CS426 will recognize it as a subset of the .ray file format used for the ray tracing assignment (with a few minor changes).  Most significantly, groups with arbitrary transformations are not included, which makes intersection and sampling of rays much simpler. A repository of sample .ray files will be provided here.

Submitting

Please put your code and writeup in a .zip or .tar.gz file and attach it in an email to smr@cs.princeton.edu, with "CS526" in the subject line. Please see the general notes on submitting your assignments, as well as the late policy and the collaboration policy.


Last update 29-Dec-2010 12:02:55
smr@cs.princeton.edu