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.
|