A4 + FAQ


What if my A3 doesn't work?
You can use the code from another student in class. Make sure to document from who. If someone is using your code make sure to indicate who. We will give a bonus to the person whose code is used the most.

The Assignment

Your job is to extend your ray casting program into a full ray tracer. This is an open-ended assignment.

The program reads commands from standard input (one command per line) and generates the resulting ray-traced images. The input commands are as follows:

scale sx sy sz
rotate axis angle
translate tx ty tz
shear axis1 axis2 amount

camera fromX fromY fromZ  atX atY atZ [upX upY upZ]
perspective width height distance
lens focusDistance lensRadius

light x y z intensity [radius]
material red green blue Ka Kd Ks n [Kr Kt indexOfRefraction [textureID]]
background red green blue


trace x y fileName [numSamples]

include filename
// any string

There are several new commands and extensions of existing commands.

The light command puts a light source at the indicated position with the indicated intensity, and optionally, radius.

The material command modifies the "current" material description. It has been extended to allow for a full ray tracer along with an optional texture ID. A non-zero texture ID selects one of several solid textures. The default is (1, 1, 1), 0.2, 0.6, 0.7, 50.0, 0.0, 0.0, 1.0 0.

The trace command has been extended to allow for anti-aliasing. An optional numSamples indicates how many samples to shoot per pixel.

The lens command allows you to specify the focusing distance and the radius of the lens.

You need to print and hand in to me the source code of the files that you changed along with a one-page document indicating what you were able to complete and what still doesn't work. You must also electronically submit your a4 directory which includes both source and executable.

You are to work in pairs on this assignment.