Assignment #4 -- Ray Tracing and Shading
This assignment is due at 11:59pm on Thursday, April 14th. Projects
turned in late will lose points as described in the policies
handout. This assignment should be done alone or in pairs. You may
share ideas with other groups, but you may not share code.
You may submit on either Unix, OS X, or Windows. The platform you submit on will
be the one used to grade assignments.
We will be using Prof. Hilfinger's submit software for
submission of this assignment, but as a backup you
are encouraged to also send a README file as described below.
The other comments about what you need to submit (makefile, etc)
Do not touch any file after the submission date. Readers will check
the file time stamps. Regardless of which platform you used for the assignment,
you should have an as4 directory in both of your Unix and Windows accounts.
You should put a README file into both of these directories that at the
minimum contains the following data:
You should also e-mail your README file to firstname.lastname@example.org.
On the subject line you should specify your account names and the
assignment number (e.g: cs184-aa, cs184-ab: as3).
Your (and your partner's) name,
The platform your code runs on,
The location of your source code (i.e. indicate who in your group has
done the submission, Windows or Unix). So only one of you in your group
needs to submit the code, but everyone has to create as4 directory
that contains the README file.
All files needed to compile your code should appear in the Windows or Unix
directory of the user indicated in your README file. It is your
responsibility to make sure that they will compile and run properly.
You will also need to set the permissions properly.
You will also turn in some images. These should be named
"image-nn.xxx" where nn is a number (e.g. 01, 02, 03...) and xxx is an
appropriate extension (e.g. tif, jpg, ppm, etc.) The main input files
needed to render those images should be named "input-nn". Finally
there should be a "notes-nn" file for each input stating: the command
line used to produce image-nn, how long it took to run, what features
are demonstrated by the image, any other comments you'd like to add
about the image.
Windows: The grader should be able to recompile your program by
simply opening the project and rebuilding it from scratch.
Unix: Remember that the grader should be able to recompile
your program simply by typing make.
Do not wait until the last minute to start this assignment. Even
a minor bug in a ray tracer typically produces a black image with no
other clue about what is wrong... that makes them very hard to
debug. If you don't give yourself enough time, you will be most
Check the news group regularly for updates on the assignment or
other clarification. We will assume that anything posted there is
henceforth known to all.
For this assignment, you will write a ray tracer that can at least:
- Render ellipsoids (axis aligned ellipsoids is sufficient, but you must be able to apply transformations).
- Render polygons (triangles are sufficient)
- Use simple Phong Shading (in color)
- Compute shadows
- Compute reflections
- Use point and directional lights
- Use some reasonable method for accelerating ray tests (e.g. BSP tree)
- Write its output to a standard image format such as jpg, ppm,
png, or tif.
Optional features that you can implement for extra credit are:
You will use your program to render 5 or more example scenes that
demonstrate the features you have implemented. You will turn in the
images rendered by your code, the code, and some documentation (see
above). Your images must demonstrate the features you implemented or
you cannot get points for those features. You will also receive
points for the aesthetics and creativity demonstrated by your images.
- Transparency with refraction
- Lens effects / depth of field
- Super quadrics
- Programmable shading
- Texture, bump, and/or displacement mapping
- Spot lights and/or area lights
- Other interesting features
Grave Warning: It will be considered cheating to turn in images
that were not generated by your code. Cheating on an assignment will
earn a zero for the assignment and possibly subject you to
The input file can be in any format you like. You are responsible for
coming up with something reasonable and creating inputs for
interesting images. An input may consist of multiple files.
We recommend starting with the input format used for
assignment 3 since you already have a parser for this format. However, you
will want/need to make some changes to this format, like including Krefl. Also,
it is easier to specify the camera as a center of projection (eye) point and the
four corners of the image plane.
Your output needs to be in a standard image format that most image
viewers can read. Suggested formats are: JPEG, TIFF, PNG or PPM. Do
not use an indexed color format. You can write your own code to write
the files or you can use a standard library. PPM is very easy to
write, but offers no compression. JPEG, TIFF, and PNG are supported
by many standard libraries. (libTIFF, libPNG, ImageMagik, nd many
others) You are responsible for figuring out how to use these
Your images should be at least 640x480 and no more than 1024x1024.
This assignment is purposefully open ended. I am continually
impressed by what Berkeley undergrads can do when given a bit of
freedom, so here it is. You are encouraged to be creative and enjoy
Questions should be posted to the news group