Skip to content
Copied!
published on 2026-09-17

13. The Rest of Your Life

Ray Tracing: The Rest of Your Life (v3.2.3): 13 The Rest of Your Life / 3.13 The Rest of Your Life

This is the final chapter of the Ray Tracing in One Weekend trilogy. The series has covered the foundations needed to implement a small production ray tracer. Now it is time to spend the rest of your life working on ray tracing.

What I Implemented

Let me review what I built throughout Book 3.

Foundations of Monte Carlo integration (Chapters 2–5):

  • One-dimensional MC integration and MC integration over the sphere of directions
  • Importance sampling, which reduces variance by drawing more samples from high-density directions

PDF hierarchy (Chapters 6–10):

ClassRole
CosinePdfGenerates cosine-weighted directions for Lambertian scattering
HittablePdfSamples geometry toward a light-source shape
MixturePdfCombines two PDFs in a 1:1 mixture

Architectural cleanup (Chapters 11–12):

  • Type-safe distinction between specular and diffuse scattering with the ScatterRecord enum
  • Moving responsibility for constructing PDFs from the renderer to the material
  • Verifying the design with Cornell-box scenes containing an aluminum box and a glass sphere

Remaining Challenges

The original book suggests the following topics for further development.

Performance:

  • The current implementation runs serially on a single thread.
    A future implementation could parallelize by scanline with rayon.

Subpixel sampling:

  • Quasi-random sequences such as the Halton sequence can converge faster than random sampling.

Triangle meshes:

  • The current primitives consist only of spheres, rectangles, and rectangular boxes.
  • A general-purpose renderer loads triangle meshes from formats such as .obj and .gltf.

Microfacet BRDFs:

  • The fuzz parameter of Metal is a simplified model.
  • Microfacet distributions such as GGX and Beckmann can represent metals and glass with greater physical accuracy.

Participating media:

  • The ConstantMedium from Book 2 supports only homogeneous media.
  • Heterogeneous media such as smoke, clouds, and fire require path-length sampling techniques such as delta tracking.

Summary

Throughout this series, I implemented a fully functional ray tracer from scratch in Rust. Because it is distributed as WebAssembly, every demonstration runs in the browser.

The following resources offer starting points for deeper exploration of physically based rendering (PBR), bidirectional scattering distribution functions (BSDFs), photon mapping, and accelerated convergence in path tracing:

  • Physically Based Rendering: From Theory to Implementation by Pharr, Jakob, and Humphreys
  • Advanced Global Illumination by Dutré, Bekaert, and Bala
  • Papers related to Pixar's RenderMan

The path from the simple principles demonstrated by Ray Tracing in One Weekend to a production-quality renderer is long, but the foundations are now in place.