From the Preface
Getting Started
Okay. You are officially awesome. You’re one of those programmers, the ones who actively seek out new ways to apply their craft and tackle challenges for the thrill of it. You’re in good company! With this book, you’re going to build a 3D renderer from scratch. Specifically, you’ll build a ray tracer, casting rays of light backward into a scene and following their paths as they bounce around toward a light source. It’s generally not a very fast technique (and so isn’t well-suited for real-time rendering) but it can produce very realistic results. By the end of this book, you’ll be able to render scenes like this one the one included here. And you don’t have to be a mathematician or computer scientist to do it!
Beginning at the bottom, you’ll build a foundation of basic routines and tools. You’ll use those to bootstrap other routines, making light rays, shapes, and functions to predict how they’ll interact.
Then things start moving quickly, and within a few chapters you’ll be producing realistic images of 3D spheres. You’ll add shadows and visual effects like geometric patterns, mirror reflections, and glass. Other shapes follow—planes, cubes, cylinders, and more.
By the end of the book, you’ll be taking these primitive shapes and combining them in complex ways using set operations. There’ll be no stopping you!