MP 2

CS 296: Machine Problem 2

Due: April 6, 11:55pm

Bounding Volume Hierarchy

For your first programming assignment you will implement a Bounding Volume Hierarchy to accelerate your ray-tracer.
Your BVH can employ either Axis-Aligned Bounding Boxes (AABBs) or Bounding Spheres. Your BVH should be able to store both triangles and spheres, with each leaf containing exactly one primitive.

Implementation should be in C++ but is otherwise up to you. You can use either an array-based structure or pointer-based for the BVH. Your construction can be either bottom-up or top-down.

There numerous resources you can find to help with your implmentation:

In addition to implementing the acceleration structure, you will perform a small scalability study.:
+ Rendering three different scenes with a growing number of spheres (e.g. 100 spheres, 1000 spheres, and 10,000 spheres).
+ Record the time it takes to render with the BVH and without the BVH

Hand-in

You will hand in your code, report, and 1 image:

Your code

A report (link to a google doc or PDF) with a paragraph describing your implementation of the BVH and a graph or table recording you render times for the scalability study. Be sure to include information about how the spheres were generated in terms of their distribution in space (e.g. uniformly random inside a cubic volume).

One perspective rendering of the largest number of spheres you tested (e.g. 10,000 spheres)

Hand-in will be done on Compass and detailed instructions will be forthcoming

Technical Details

You should use C++

You can use any image library you want (e.g. libpng) or write your own code to write a ppm file

You can use any math library you want (e.g. glm)

Keep in mind that if you use code you didn’t write, you must document the use of that code