Computer Graphics – HW 4

This assignment asked of my partner, Del Slane, and I, to write a simple raytracer. Raytracers can produce some of the most impressive renderings, with high quality shadows and re?ections.  They are also conceptually very simple. However, the actual implementation of them can be considerably difficult.

The final code can be downloaded here

MILESTONE – Progress Report

We’ve successfully completed the basic camera module and have begun to implement the basic ray tracing engine. We’ve already established two basic geometric object classes: a Sphere class and a Triangle class. Both have corresponding intersections codes, though we’re in the process of testing and debugging said codes. We need to further revise the sphere intersection code, and thoroughly test the triangle intersection code.

Below we’ve included three images from the output of the scene1.test file. We’ve only included the 1st, 2nd and 4th perspectives specified, as we are having problems validating the output of the 3rd perspective stated in the scene1.test file. We are also in the process of verifying and correcting the camera module as well. We know that the output for the 2nd and 4th perspective are wrong. In particular, it seems that either we are not reading the coordinates correctly, or the ray from the camera is being projected incorrectly. However, we are confident that we will fix these problems shortly.

At the time, we do not have a specific scene in mind to render. Yet, for our timeframe, we expect to have completed with all the basic requirements between November 30 – December 2. This will give us plenty of time to debug and fully test our code. Time permitting, we will implement additional features like soft shadows, adding more primitives, etc.

Perspective 1 - Scene1.test file

Perspective 2 - Scene1.test file

Perspective 4 - Scene1.test file

NOTE: After submitting the milestone, we’ve realized that one of our problems with the camera module is that we are inverting the axes. We are working to rectify this problem.


We were able to overcome the difficulties the encountered during our milestone project, and as such have successfully completed the requirements for this assignment.

First, we tested our code against the original demo scenes provided to us by the professor. For scene1.test,  this was our output:

Output of scene1.test file from camera 1

Output of scene1.test file from camera 2

Output of scene1.test file from camera 3

Output of scene1.test file from camera 4

These outputs demonstrate that we are able to correctly read in the camera and geometry parameters specified by our given file format, and also that we are able to accurately ray trace simple, geometric objects.

To further demonstrate the capabilities of our ray trace engine, we now wish to show the output of a complex object ray traced by our program. For this, we chose to render the die specified in the “scene2.test” file. Our outputs for this file are:

Output of Scene2.test file from Camera 1

Output of scene2.test file from camera 2

Output from scene2.test file from Camera 3

We also chose to render this scene with illumination, to demonstrate that our system can handle illumination. Our results are as follows:

Scene 2 Lit from Camera 1

Scene 2 with illumination, colored lights and specularity with shininess

Scene 2; Camera 3

As can be seen, our images illustrate that our ray tracing program can handle not only complex geometric structures, but also illuminations, shadows and specular objects with shine.

We also rendered the image specified by our scene3.test file. Here are the results

Scene 3

Demo image  #1

The image above demonstrates that our system is able to handle reflections by reflecting on the table’s surface the four spheres placed on top of it.

Final DEMO Images

The images we present here show the full gamut of the capabilities of our ray tracing system. They include reflection, refraction (both partial and complete), shadows and illumination by multiple light sources.

Demo image #2

Scene 3, reflectance 2

Final image for demo