In this last assignment you are to implement refraction through spheres and construct two scenes of your own design. The first scene will be graded for apparent correctness. Put simply, the refraction through the sphere should be readily apparent and correct. The second scene is your opportunity to show off. In addition to rendering correctly, 10 points of the 100 for this assignment will be reserved for 'Wow' factor; that may mean your rendering is subtle and artistic, that may mean your rendering is impressive, it may even mean that your rendering is instructive. You are being asked to use judgement in addition to technical skill.

More about Scenes

Keep in mind the goals for scene 1 and scene 2 are different.

Scene 1
Keep this scene simple. You are strongly encouraged to work with a single sphere and checkerboard pattern and configure the scene so that the checkerboard seen through the sphere shows clearly how refraction works. However, you may design this scene however you like so long as refraction is clearly illustrated and also so that the solid (not semi-transparent) object is polygonal (not a sphere). To assist you on this Scene, here is an example of a checkerboard with multiple colors that you could use to break the symmetry when seen through the spheres.
Scene 2
Unlike scene 1, no need to keep this scene simple. Instead, strive to produce a rendering you would want to show off to friends and possibly have added to the growing set of CS410 Masterworks on display outside Professor Beveridge's office. In particular, since this semester you now have rendering of smooth solid complex polygonal models such as the cow give some thought of how to put this feature to good use. As a concession to practicality, make sure to build a scene that can be test rendered at relatively low resolution, for example 256 pixels accross, in a reasonably short time. Then, if a high resolution (4096 across) version is desired, it is expected rendering may take considerable time.

Extra Credit

Some students asked that there be a means of doing something a little extra in this last assignment. Therefore, while the assignment as described so far is worth 100 points, below is a list of extras that if carried out correctly will add 10 additional points. To be clear, while here are a list of extras, pick one and only one. Doing more than one from the list below may be personally rewarding but will not add any points beyond the 10 extra being offered.

Here are three suggested extras. As you read these, if you find yourself thinking the first is perhaps easier than the other two, you are likely correct.

Extra 1: Anti-Aliased Ray Tracing
Instead of firing a single ray to determine the color of a pixel, instead shoot a bundle of rays. For example, 8, 16 or 32 rays shot out in slightly different directions. The result from these are then simply 'averaged'. While this has been described for a ray originating from a pixel, it is equally applicable in the case of reflection rays. If you choose this extra please see John Tsiombikas's Generating multiple sample positions per pixel posting.
Extra 2: Translucent Bunnies (or Cows)
It would be excellent to have refraction for polygonal solids. So, for example, if the holes were plugged in the Stanford Bunny and surface normals interpolated across the surface, the resulting 'crystal' bunny could be stunning. Recall you can get the Stanford Bunny from the Assignment 1 models.tar file. You may also want to consider a translucent cow given our prior work with the cow this semester. If considering this option, do not under estimate the complexity of this extra, with great visual rewards comes a significant amount of additional book keeping code to manage the process of entering and leaving a semi-transparent solid polygonal object.
Extra 3: Thin Lens and Depth of Field
Real cameras have variable focus and that in turn means objects at one depth will be in sharp focus while objects further from the camera, or closer, will be out of focus. Traditional pinhole camera ray tracing, which we are using this semester, may be extended to generate depth of field effects using what is commonly called a 'thin lens'. If you choose this extra, you may find this older CS510 lecture, Thin Lens Models, a useful resource.
Extra 4: Pitch Us an Idea
If something you want to add to your ray tracer is missing above, send an email to the Instructor and GTA and we will let you konw if it is a reasonable option.

If you do implement something extra you must include a description of what you did and how it is apparent in your Scene 2. This text should be part of the README file you submit with your assignment.


Submit a tar file via the CANVAS assignment page that includes:

    Driver files (driver01.txt and driver02.txt) and model files necessary to render scene 1 and scene 2.
    PPM files generated for driver01.txt and driver02.txt
    Your source files
    A makefile if appropriate
    README.txt file that explicitly contains (1) A command to compile your program and (2) A command to execute it.

If you are using C++, your executable should be named 'raytracer'. If your are using java, the main executable class should be named 'Raytracer'. Notice the change in case for the first letter between C++ and Java. It is must for this assignment to take exactly two arguments as described above.


There is no “late period”. It is essential to start earlier and finish earlier. The program is due when it is due. All work you submit must be your own. You may not copy code from colleagues or the web or anywhere else. Cheating will not be tolerated, and will be handled in accordance with university and department policy.