Utah teapot in reflective room Triangle rendering was painfully slow, as mentioned yesterday. Putting a little reflective shine on the floor and walls of the room took rendering time past 90 minutes. After a bit of research i tried a binary bounding volume hierarchy, dividing the list of shapes into subtrees, split evenly on the largest axis of the bounding box, recursively. This way we get a spacially balanced binary tree with the actual shapes as leaves, and theoretically get \(O(log\ n)\) instead of \(O(n)\) search time per ray. Huge difference, especially with rays branching recursively for reflections and refractions. Down from 90 to 6 minutes for the same scene.

High-poly Utah teapot Edit: As a surprise bonus, the high polygon version only took 11 minutes.

This marks the end of Devember 2018, but there’s still some more work to do on the raytracer before I let it go. The flat shading of triangles needs some normal interpolation, and the primitive volumes needs some constructive solid geometry operations to really shine.