Chapter 11Reflection and Refraction

All right. Hang on to your passenger assist handle, because you’re about to add another bit of material finesse to your ray tracer. Check out this sneak preview:

images/reflection/reflect-refract.png

That’s right, boys and girls. You’re going to make objects reflective and transparent. Mirrors and glass marbles will be your oyster.

Both of these work through similar means: spawning an additional ray at the point of intersection and recursively following it to determine the color at that point. You’ll tackle them one at a time: reflection first, and then transparency and refraction.

Are you ready? Here goes!

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.