Using Bounding Boxes to Optimize Large Scenes

One of the most computationally expensive things a ray tracer does is find the intersections between a ray and an object, and what makes things even worse is that it has to do this repeatedly for every pixel. To render a scene of ten objects to a small 200×200 canvas, your ray tracer must perform at least 400,000 intersection tests, plus however many additional intersections are needed to generate shadows, reflections, and refraction. Adding insult to injury, the majority of those rays won’t even come close to most of the objects in a typical scene.

What a waste, right? If only you could test just the objects that were reasonably close to any given ray…

The good news is that there are a variety of ...

Get The Ray Tracer Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.