Graphics Features Added

Part 1: Bounding-Volume Hierarchy (BVH)

Prior to this final project, I realized that my ray tracer performed slowly when rendering obj meshes. I wanted the ability to render obj meshes more efficiently so that I could render more complex scenes. To improve performance, I implemented a BVH spatial data structure. My BVH representation is a binary tree. Each node has a bounding box that encloses all the geometry beneath it. Each node also has left and right pointers to nodes representing smaller regions of space. To construct the BVH, triangles are sorted by their center coordinates and then split into two groups (these groups are assigned to the left and right attributes of a node). The subdivision repeats until each triangle is a leaf of the tree.

Baseline Scene Timings

Scene 1: Ico Sphere (80 triangles)


Scene 2: Bunny in an Enclosed Room (5,552 triangles)


Scene 3: Trophy (59,124 triangles)


Part 2: Monte Carlo Ray Tracer

To simulate global illumination (indirect lighting/color bleeding), I implemented Monte Carlo sampling. When a ray is shot into the scene, I generated sample points using cosine weighting to determine where to aim the scattered rays. The colors obtained by these secondary rays are then averaged and combined with the color of the object that was initially hit. My ray tracer allows me to specify how many sample points to generate and how many bounces to allow. I focused specifically on scenes with purely diffuse surfaces.

Baseline Scenes + Results

Scene 1: Diffuse Spheres

Before (Left: Phong | Right: Foggy Day Diffuse)

After (Monte Carlo)


Scene 2: Cornell Box

Before (Left: Phong | Right: Foggy Day Diffuse)

After (Monte Carlo)


Additional Renders

Below are some extra renders of scenes I created throughout CSC 473.

Resources