# Day 32, Smoothly interpolated normals

Devember has officially ended, but there are still a few more things left to do, so I’ll keep on in the same spirit until the project is finished.

The high-poly teapot still looked quite chunky with its flat polygon rendering, but with a little normal interpolation we can simulate a perfectly smooth surface.

## Next related

### Day 33, Domain-Specific Language

Not a single feature improvement today, but instead a bit of quality of life improvements.

## Previous related

### Tea, Cocktails, and a Happy New Year

### Day 31, Optimizing triangles

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.

### Day 30, Triangles and teapots

The last of the primitive shapes, the triangle. By them selves they’re pretty boring, but when you stick loads of them together they make pretty teapots. Very. Slowly. And quite chunky, because low-polygon model. It sums up to 240 triangles after dividing some larger polygons, and takes about 20–30 minutes to render at the whopping resulution of 320x256 and no reflections. I probably need to research some kind of bounding hierarchy algorithm to automagically subdivide large groups of objects.