Crate rs_pbrt

source ·
Expand description


Rust crate to implement at least parts of the PBRT book’s C++ code. You can find a copy of the current code here.

The main render loop for integrators implementing the SamplerIntegrator can be found here.

There are three more render loops:

  1. render loop for bidirectional path tracing
  2. render loop for Metropolis Light Transport
  3. render loop for Stochastic Progressive Photon Mapping


  • Acceleration structures are one of the components at the heart of any ray tracer. Without algorithms to reduce the number of unnecessary ray intersection tests, tracing a single ray through a scene would take time linear in the number of primitives in the scene, since the ray would need to be tested against each primitive in turn to find the closest intersection.
  • Provides a queue of block indices that the sampler positions can be initialized from for the worker threads. The queue itself is not changed after creation we simply work through it with an atomic counter to track the index of the next block to work on.
  • The abstract Camera base class holds generic camera options and defines the interface that all camera implementations must provide.
  • All the code for the PBRT core.
  • All filter implementations are derived from an abstract Filter class, which provides the interface for the functions used in filtering.
  • Integrator is an abstract base class that defines the render() method that must be provided by all integrators.
  • In order for objects in a scene to be visible, there must be a source of illumination so that some light is reflected from them to the camera sensor.
  • The abstract Material class defines the interface that material implementations must provide.
  • Implementations of the Medium base class provide various representations of volumetric scattering properties in a region of space.
  • The Sampler base class not only defines the interface to samplers but also provides some common functionality for use by Sampler implementations.
  • Careful abstraction of geometric shapes in a ray tracer is a key component of a clean system design, and shapes are the ideal candidate for an object-oriented approach. All geometric primitives implement a common interface, and the rest of the renderer can use this interface without needing any details about the underlying shape. This makes it possible to separate the geometric and the shading subsystem of pbrt.
  • Texture is a template class parameterized by return type of its evaluation function. This design makes it possible to reuse almost all of the code among textures that return different types. PBRT currently uses only Float and Spectrum textures.