The Ray Tracer Challenge

A Test-Driven Guide to Your First 3D Renderer

by: Jamis Buck

Published 2019-02-26
Internal code jbtracer
Print status In Print
Pages 290
User level Intermediate
Keywords ray tracing, graphics, rendering, constructive solid geometry, reflection, refaction, geometric primitives
Related titles
  • “Mazes for Programmers” (recreational programming)
  • “Learn Game Programming in Ruby” (recreational programming)
  • “Seven Languages in Seven Weeks” (exploration and discovery)
  • “Exercises for Programmers” (focus on tests, challenges)
ISBN 9781680502718
Other ISBN Channel epub: 9781680506785
Channel PDF: 9781680506792
Kindle: 9781680506761
Safari: 9781680506778
Kindle: 9781680506761
BISACs COM012000 COMPUTERS / Computer Graphics
COM087000 COMPUTERS / Digital Media / General
COM087000 COMPUTERS / Digital Media / General

Highlight

Brace yourself for a fun challenge: build a photorealistic 3D renderer from scratch! It’s easier than you think. In just a couple of weeks, build a ray tracer that renders beautiful scenes with shadows, reflections, brilliant refraction effects, and subjects composed of various graphics primitives: spheres, cubes, cylinders, triangles, and more. With each chapter, implement another piece of the puzzle and move the renderer that much further forward. Do all of this in whichever language and environment you prefer, and do it entirely test-first, so you know it’s correct. Recharge yourself with this project’s immense potential for personal exploration, experimentation, and discovery.

Description

The renderer is a ray tracer, which means it simulates the physics of light by tracing the path of light rays around your scene. Each exciting chapter presents a bite-sized piece of the puzzle, building on earlier chapters and setting the stage for later ones. Requirements are given language-agnostically; it’s up to you to translate them into tests and code using whatever language you prefer. When the project is complete, you’ll look back and realize you’ve built an entire system test-first!

There’s no research necessary — all the necessary formulas and algorithms are presented and illustrated right here. Dive into intriguing topics from fundamental concepts such as vectors and matrices; to the algorithms that simulate the intersection of light rays with spheres, planes, cubes, cylinders, and triangles; to geometric patterns such as checkers and rings. Lighting and shading effects, such as shadows and reflections, make your scenes come to life, and constructive solid geometry (CSG) enables you to combine your graphics primitives in simple ways to produce complex shapes.

Play and experiment as you discover the fun of writing a ray tracer. Accept the challenge today!

Contents and Extracts