1. Raytracing in One Weekend
All 13 chapters of Week 1 are covered in order. The original book is written in C++11, and understanding the differences between C++ and Rust is one of the key learning axes of this document. Topics include: representing return values with Option<T> instead of output parameters; using Arc<dyn Trait> instead of shared_ptr; defining pure virtual functions as traits; operator overloading; expression-oriented control flow; and Rust's ownership and borrowing rules, all explained alongside comparisons with their C++ equivalents.
1. Overview
Ray Tracing in One Weekend is an introductory book on ray tracing written by Peter Shirley, Trevor David Black, and Steve Hollasch. This booklet builds up a phy…
2. Output an Image
This chapter explains the PPM image format and presents the first rendering: a simple color gradient. The C++ code outputs in PPM format to standard output. How…
3. The vec3 Class
The original book defines a vec3 class in C++ that is used for colors, positions, and directions alike. This document implements it as a Rust struct. Because Ve…
4. Rays, a Simple Camera, and Background
This chapter implements the heart of a ray tracer: casting a ray and computing its color based on the direction it travels. A ray is mathematically described by…
5. Adding a Sphere
This chapter places the first object in the scene: the simplest 3D shape, a sphere. It derives the ray–sphere intersection test mathematically and colors the hi…
6. Surface Normals and Multiple Objects
The previous chapter painted the sphere silhouette a flat red. This chapter uses surface normal vectors to visualize the sphere's surface in color. It also intr…
7. Antialiasing
The scene from the previous chapter is complete, but looking closely at the sphere's outline you can see jagged "staircasing" artifacts. This is because each pi…
8. Diffuse Materials
This chapter implements diffuse materials (matte materials). A diffuse material absorbs light while scattering it in random directions. Three implementations ar…
9. Metal
This chapter implements metal materials (specular reflection). It first introduces an abstract interface for materials and encapsulates the scattering logic in…
10. Dielectrics
This chapter implements dielectric materials (transparent objects such as water, glass, and diamonds). When light hits a dielectric, some of it reflects and the…
11. Positionable Camera
This chapter extends the camera to allow free positioning and orientation. Until now the camera was fixed at the origin pointing in the negative Z direction. Th…
12. Defocus Blur
This chapter implements defocus blur—the photographic effect in which objects in front of or behind the focal plane appear blurred, commonly known as depth of f…
13. Where Next?
This chapter implements the final scene of Ray Tracing in One Weekend—the cover image of the book, bringing together every technique developed in Week 1. No new…
13. Where Next? — High-Quality Version
← Back to standard version (13 Where Next?) The high-quality version uses the full 22×22 grid from the original book, placing more small spheres deep into the s…
Supplement: Native Parallel Renderer
All implementations so far have been designed to run as WebAssembly (WASM). Because WASM runs single-threaded and synchronously, rendering the final scene at 12…