CSC473 - Final Project
by Travis McMillon

Overview

For my final project in CSC473, I chose to implement a Bounding Volume Hierarchy, Texture Mapping, and Photon Mapping in my Ray Tracer. I unfortunately was unable to get photon mapping working completely, so I have no pictures showing that off.

  • Picture 1 shows reflection and refraction through a variety of different objects. In the picture is a refractive sphere, surounded by refractive and reflective chaos emeralds. On each side of the scene, there is a reflective plane, making it look like there is 3 sets of sphere/chaos emeralds.
  • Picture 2 shows a mesh of Sonic ported to PovRay (the format of scene file we used in our ray tracers).
  • Picture 3 shows Super Sonic on a reflective and texture-mapped "planet" surrounded by the chaos emeralds.
  • Picture 4 is just a simple example of texture mapping.


Screen Shots



Bounding Volume Hierarchy (BVH)

Before the BVH, our Ray Tracers would iterate over every object in the scene, doing an intersection test against each object to see what the closest object to the camera was (that actually should be drawn in the current pixel). This is incredibly inefficient.

BVH solved this problem by placing each object in the scene (sphere, plane, triangle, etc) in its own "bounding box." The bounding box was axis-aligned, meaning that is contained a min and max value for each dimension (x, y, and z). This box "bounded" the object. This way, if the current ray hit the box, then that means that it COULD hit the object inside it.

Each bounding box was then turned into a node. If the node was a leaf node, it contained an object in the scene. Otherwise, it had 1 or 2 children (being other bounding box nodes). So now we just traverse the tree, testing the current ray against each bounding box. If the ray hits the left child, then we should traverse down that side of the tree. If it doesn't, we can cull off that part of the tree.

Using a bvh on small scenes actually increased the run time due to added intersection tests. However on large scenes, it made a HUGE difference. I have seen about a 95% increase in speed on average.



Texture Mapping

Texture Mapping is relatively straight-forward. All that needs to be done is figuring out a way to map a 2D image to a 3D surface. There is generally an equation used to do this mapping. Picture 4 of the screenshots demonstrates a simple texture mapping to a sphere.