Tracking Intersections
Currently, your intersect function returns a set of t values, but imagine for a moment a beautifully complex scene, full of spheres, cubes, cylinders, cones and dozens of creative combinations. You cast your ray into that scene and get back a double handful of intersections. You now know where the intersections occurred (thanks to the t values), but you have no idea how to draw them. What object was intersected at that point? What color is it? What are its material properties? Should there be a reflection or not? You just don’t know.
With the addition of one more property, you’ll have the foundation of what you need to answer those questions. You’re going to create a new data structure, called an intersection, which will ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access