What's Next?
Congratulations
You've built the mathematical foundation of a 3D ray tracer from scratch: vectors, colors, matrices, transformations, ray-sphere intersection, and Phong lighting.
Extend Your Ray Tracer
The book The Ray Tracer Challenge by Jamis Buck covers much more:
- Shadows — cast shadow rays to determine if a point is blocked from the light.
- Planes — add flat infinite surfaces alongside spheres.
- Patterns — striped, gradient, ring, and checker textures on any surface.
- Reflection — mirror-like surfaces with recursive ray casting.
- Refraction — transparent materials bending light via Snell's law.
- Cubes and cylinders — extend the shape vocabulary beyond spheres.
- CSG — constructive solid geometry for union, intersection, and difference of shapes.
Full C++ Implementation
To build the complete ray tracer in real C++:
- Use operator overloading (
+,*,==) on Tuple and Matrix4 for cleaner code. - Add a
Canvasclass that writes PPM image files. - Implement matrix inverse for correct normal transformations on scaled shapes.
- Use a
Worldclass to hold multiple objects and a point light source. - Add a
Camerawithview_transformfor arbitrary scene positioning.
References
- The Ray Tracer Challenge by Jamis Buck (Pragmatic Bookshelf) — the book this course is based on.
- Physically Based Rendering by Pharr, Jakob & Humphreys — the definitive reference for production rendering.
- scratchapixel.com — free in-depth tutorials on ray tracing and rendering.
- Ray Tracing in One Weekend — a fast-paced C++ ray tracer series.