Code written while reading the book "The Ray Tracer Challenge: A Test-Driven Guide to Your First 3D Renderer" by Jamis Buck.
This is example code that is not production-ready. It is intended for studying and learning purposes.
(c) Sebastian Bergmann. All rights reserved.
In this fork, I simply added the ability to preview the rendering progress in real time. This requires the php-glfw extension to be installed.
All credit for this project goes to Sebastian Bergmann; this really just takes the pixel data and outputs it into a window.
To run the real-time preview just execute:
php tools/preview.php
The preview renders one fixed scene and does not support selecting different ones without changing the code in preview.php
.
- Chapter 1: Tuples, Points, and Vectors
- Chapter 2: Drawing on a Canvas
- Chapter 3: Matrices
- Chapter 4: Matrix Transformations
- Chapter 5: Ray-Sphere Intersections
- Chapter 6: Light and Shading
- Chapter 7: Making a Scene
- Chapter 8: Shadows
- Chapter 9: Planes
- Chapter 10: Patterns
- Chapter 11: Reflection and Refraction
- Chapter 12: Cubes
- Chapter 13: Cylinders
- Chapter 14: Groups
- Chapter 15: Triangles
- Chapter 15: Constructive Solid Geometry (CSG)