CS 4810: Introduction to Computer Graphics
Spring 2016


Home | Schedule | Assignments

Programming Assignment 2: Ray Tracer

Due Tuesday, 3/29 at 11:59PM

Overview

In this assignment you will implement a basic ray tracer. 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.

Skeleton code and project files for several platforms and common IDEs:

Notes on GLUT: This assingment relies on the external library GLUT which is distributed along with the Windows starter code. Those of you using Unix will need to be sure GLUT is installed on your machine. On most Linux distros the GLUT library is not installed by default, but there are many good (and free) GLUT implementations out there. Here is how you would install freeglut on a Debian system (this includes Ubuntu and other forks): apt-get install freeglut3 freeglut3-dev. If you are running Ubuntu, chances are you will probably need to add sudo to run this command as root: sudo apt-get install freeglut3 freeglut3-dev. Other package managers such as YaST on SuSE and BSD ports may have different syntax. For Cygwin, use the Cygwin setup tool to install OpenGL and GLUT libraries. If you are using your own machine and need to install GLUT I recommend freeglut.

Notes on Mac OS X: Apple uses a "framework" system for most of their libraries, including OpenGL and GLUT. You'll need to use ⟨GLUT/glut.h⟩ instead of ⟨GL/glut.h⟩. Similarly, you need to use a different syntax to link to the OpenGL and GLUT libraries: -framework OpenGL -framework GLUT. Finally, note that malloc.h is deprecated on OS X.

P.S. To learn more about how library dependencies and platform-dependent code are managed in real-world applications, take a look at GNU automake and autoconf tools.


Getting Started

We are providing starter code for this assignment (read above). There are 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 opening Assignment2.sln using Microsoft Visual Studio.
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: