O'Reilly logo

Physically Based Rendering, 3rd Edition by Greg Humphreys, Wenzel Jakob, Matt Pharr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16.2.6 Accumulating photon contributions

Given the grid of visible points, the SPPMIntegrator can now follow photon paths through the scene. The total of photonsPerIteration photons to be traced for the current iteration are traced using multiple threads. A separate MemoryArena is available for each worker thread; this arena is reset after each photon path, so a new pool of per-thread arenas is allocated rather than reusing the one used for BSDFs and grid linked list nodes.

Trace photons and accumulate contributions〉 ≡  975

  std::vector < MemoryArena > photonShootArenas(MaxThreadIndex());

  ParallelFor(

    [&](int photonIndex) {

      MemoryArena &arena = photonShootArenas[ThreadIndex];

      〈Follow photon path for photonIndex 984

       ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required