Computer Graphics, Fall 2017

Michael Kazhdan

Assignment 2: Ray Tracing

Due on October 26 (Thursday) at 11:59 PM



In this assignment you will implement a basic raytracer. To allow you to focus on the nuts and bolts of the actual ray tracing, you are provided with a host of data structures for managing the ray traced objects, linear algebra functions (vector and matrix objects and operations), a function for loading scene graph files into a prescribed node tree stucture, BMP and JPEG image file importers/exporters (for images and textures, etc), and a couple of supporting data structures for lights, materials, etc.

An overview of the code you will be using can be found here or downloaded here.

An overview of the .ray file syntax can be found here.

A description of what your ray-tracer should do as you implement the different parts of the assignment can be found here.

The code skeleton can be downloaded here.

For people compiling under windows who do not have the glut libraries installed on their machine, you will also need to download the library and include the files in same directory as executable.

Getting Started

You should use the code available here (, as a starting point for your assignment. We provide you with a number of files, some of which will only need to be modified in future assignments. As in assignment 1, code modification should be relegated to the *.todo.cpp files.

After you copy the provided files to your directory, the first thing to do is compile the program. To do this, you will first have to compile the JPEG library and then compile the assignment2 executable.

On a Windows Machine
Begin by double-clicking on Assignment2.sln to open the workspace in Microsoft Visual Studios.
On a Unix Machine

How the Program Works

The program takes in to mandatory arguments, the input (.ray) .ray file name, the output image file name (.bmp/.jpeg/.jpg), the dimensions of the output image, the recursion depth, and the cut-off value for early termination. It is invoked from the command line with:
% Assignment2 --in in.ray --out out.bmp --width w --height h --rLimit r --cLimit c
Feel free to add new arguments to deal with the new functionalities you are implementing. Just make sure they are documented.

What You Have to Do

The assignment is worth 30 points. The following is a list of features that you may implement. The number in parentheses corresponds to how many points it is worth.

The assignment will be graded out of 30 points. In addition to implementing these features, there are several other 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 30 points. However, after 30 points, each point is divided by 2, and after 32 points, each point is divided by 4. If your raw score is 29, your final score will be 29. If the raw score is 33, you'll get 31.25. For a raw score of 36, you'll get 32.

What to Submit

Submission intstructions are specified here.
Please include the following in your submission: