wahn / rs_pbrt

Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code. See also https://www.rs-pbrt.org/about ...
https://www.rs-pbrt.org
Other
809 stars 59 forks source link

Implement WhittedIntegrator #115

Closed wahn closed 4 years ago

wahn commented 4 years ago

Currently there is one integrator missing on the Rust side: The WhittedIntegrator. On the C++ side we have:

// WhittedIntegrator Declarations
class WhittedIntegrator : public SamplerIntegrator {
  public:
    // WhittedIntegrator Public Methods
    WhittedIntegrator(int maxDepth, std::shared_ptr<const Camera> camera,
                      std::shared_ptr<Sampler> sampler,
                      const Bounds2i &pixelBounds)
        : SamplerIntegrator(camera, sampler, pixelBounds), maxDepth(maxDepth) {}
    Spectrum Li(const RayDifferential &ray, const Scene &scene,
                Sampler &sampler, MemoryArena &arena, int depth) const;

  private:
    // WhittedIntegrator Private Data
    const int maxDepth;
};
wahn commented 4 years ago

Here an image rendered by the following test scene (using the C++ code):

> ~/builds/pbrt/release/pbrt pbrt_feature_demo_integrator_whitted.pbrt

pbrt_feature_demo_integrator_whitted

wahn commented 4 years ago

Since commit cf5235a6e5a2ff2fca0df0ed9ead3e45368f07ee the Rust code implements the WhittedIntegrator. One pixel difference to the C++ code:

> imf_diff pbrt.png pbrt_feature_demo_integrator_whitted.png
differing pixels:     0.000% (1 of 518400)
average difference:   1.480%
maximum difference:   1.480%
Summary: 1 pixel differs slightly.