Skip to content
Copied!

3. Ray Tracing: The Rest of Your Life ​

This book covers Ray Tracing: The Rest of Your Life, the third book in the series. I incrementally extend the common/ crate built in Books 1 and 2, beginning with Monte Carlo integration and proceeding to a Cornell box with specular reflection and refraction. All changes to common/ are additive so that the completed code from Books 1 and 2, including the r1XX and r2XX crates, continues to build unchanged.

Complete14 chaptersStarted:
  1. 1. Overview

    Ray Tracing: The Rest of Your Life is an introductory ray-tracing book written by Peter Shirley, Trevor David Black, and Steve Hollasch. The latest edition at t…

  2. 2. A Simple Monte Carlo Program

    The defining feature of the Monte Carlo method (MC method) is that a simple program can statistically approximate a true value, with accuracy improving as it ru…

  3. 3. One-Dimensional Monte Carlo Integration

    Section 3.2 derived an estimate of $\pi$ from an area ratio. I now generalize the same idea into a framework for estimating arbitrary integrals with the Monte C…

  4. 4. Monte Carlo Integration on the Sphere of Directions

    Section 3.3 estimated an integral over a one-dimensional interval. I now integrate over the space of directions—the unit sphere $S^2$—which connects directly to…

  5. 5. Light Scattering

    Sections 3.3 and 3.4 developed the framework for Monte Carlo estimation and integration over a sphere. I now introduce a probabilistic model for light scatterin…

  6. 6. Importance-Sampled Materials

    Section 3.5 introduced the scattering PDF $s(\omega) = \cos\theta/\pi$ for a Lambertian surface. I now clarify the relationship between the sampling PDF $p$ and…

  7. 7. Generating Random Directions

    The Monte Carlo estimates in Sections 3.2 through 3.6 were one-dimensional discussions that considered only the scattering angle $\theta$ around the $z$ axis. I…

  8. 8. Orthonormal Bases

    The previous chapter generated random directions around the $z$ axis. Actual rendering requires scattering directions to be generated around an arbitrary normal…

  9. 9. Sampling Lights Directly

    Until now, scattering directions have been sampled from a cosine-weighted distribution. This gives no special weight to the direction of a light source, however…

  10. 10. Mixture Densities

    The previous chapter introduced a PDF $p_\text{light}$ that samples the light directly. Relying on the light PDF alone, however, can increase variance where ind…

  11. 11. Some Architectural Decisions

    The previous chapter completed the Cornell-box renderer, but closer inspection reveals two remaining structural problems. Both arise from the same fundamental m…

  12. 12. Cleaning Up PDF Management

    This chapter resolves the two problems identified previously: the hard-coded CosinePdf and the incompatible handling of specular and diffuse scattering. I add t…

  13. 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. N…

  14. Supplement: Native Parallel Renderer for Book 3

    Following the native parallel renderer for Book 1 and the native parallel renderer for Book 2, I render the final scene from Book 3, introduced in 3.12 Cleaning…