diff --git a/src/pbrt/wavefront/integrator.cpp b/src/pbrt/wavefront/integrator.cpp index a03db9daefd86f876a138c954c45265c2b33a2c0..2787de618ec2ae4fc7f88c5989af65f4e2f51daa 100644 --- a/src/pbrt/wavefront/integrator.cpp +++ b/src/pbrt/wavefront/integrator.cpp @@ -83,6 +83,7 @@ WavefrontPathIntegrator::WavefrontPathIntegrator(Allocator alloc, ParsedScene &s sampler = Sampler::Create(scene.sampler.name, scene.sampler.parameters, film.FullResolution(), &scene.sampler.loc, alloc); + samplesPerPixel = sampler.SamplesPerPixel(); Medium cameraMedium = findMedium(scene.camera.medium, &scene.camera.loc); camera = Camera::Create(scene.camera.name, scene.camera.parameters, cameraMedium, @@ -347,7 +348,6 @@ Float WavefrontPathIntegrator::Render() { Timer timer; Vector2i resolution = film.PixelBounds().Diagonal(); Bounds2i pixelBounds = film.PixelBounds(); - int spp = sampler.SamplesPerPixel(); // Launch thread to copy image for display server, if enabled RGB *displayRGB = nullptr, *displayRGBHost = nullptr; std::atomic exitCopyThread{false}; @@ -429,7 +429,7 @@ Float WavefrontPathIntegrator::Render() { }); } - int firstSampleIndex = 0, lastSampleIndex = spp; + int firstSampleIndex = 0, lastSampleIndex = samplesPerPixel; // Update sample index range based on debug start, if provided if (!Options->debugStart.empty()) { std::vector values = SplitStringToInts(Options->debugStart, ','); diff --git a/src/pbrt/wavefront/integrator.h b/src/pbrt/wavefront/integrator.h index 403be0cdeaa0aa1e30e00513d3b5c8c15a214118..b71e960f5b9b8eeffbc1c3e33e137de92aad583c 100644 --- a/src/pbrt/wavefront/integrator.h +++ b/src/pbrt/wavefront/integrator.h @@ -148,7 +148,7 @@ class WavefrontPathIntegrator { pstd::vector *envLights; LightSampler lightSampler; - int maxDepth; + int maxDepth, samplesPerPixel; bool regularize; int scanlinesPerPass, maxQueueSize; diff --git a/src/pbrt/wavefront/surfscatter.cpp b/src/pbrt/wavefront/surfscatter.cpp index ce6caf918172beb1509699a614f246aee8424f12..1446d83d53fc5fe6d36f03e698525163854c9034 100644 --- a/src/pbrt/wavefront/surfscatter.cpp +++ b/src/pbrt/wavefront/surfscatter.cpp @@ -117,6 +117,8 @@ void WavefrontPathIntegrator::EvaluateMaterialAndBSDF(TextureEvaluator texEval, intr.wo = w.wo; intr.time = w.time; + camera.ApproximatedPdxy(intr, samplesPerPixel); + // Estimate BSDF's albedo constexpr int nRhoSamples = 16; SampledSpectrum rho(0.f);