diff --git a/src/pt/deferred_renderer.cpp b/src/pt/deferred_renderer.cpp index 1f94670..07df8a7 100644 --- a/src/pt/deferred_renderer.cpp +++ b/src/pt/deferred_renderer.cpp @@ -555,6 +555,8 @@ void DeferredRenderer::resize(const GpuContext& gpuContext, const Extent2u& newS mDebugPass.resize(gpuContext, mAlbedoTextureView, mNormalTextureView, mDepthTextureView); mLightingPass.resize(gpuContext, mAlbedoTextureView, mNormalTextureView, mDepthTextureView); + + invalidateTemporalAccumulation(); } DeferredRenderer::GbufferPass::GbufferPass( @@ -2041,4 +2043,11 @@ DeferredRenderer::PerfStats DeferredRenderer::getPerfStats() const mResolvePassDurationsNs.begin(), mResolvePassDurationsNs.end(), 0ll)) / mResolvePassDurationsNs.size()}; } + +void DeferredRenderer::invalidateTemporalAccumulation() +{ + // In the first frame of the accumulation sequence, we are forced to write the lighting pass + // sample straight to the accumulation buffer. This effectively resets the accumulation. + mFrameCount = 0; +} } // namespace nlrs diff --git a/src/pt/deferred_renderer.hpp b/src/pt/deferred_renderer.hpp index b656605..8221b56 100644 --- a/src/pt/deferred_renderer.hpp +++ b/src/pt/deferred_renderer.hpp @@ -274,6 +274,8 @@ class DeferredRenderer Gui& gui); }; + void invalidateTemporalAccumulation(); + WGPUTexture mDepthTexture; WGPUTextureView mDepthTextureView; WGPUTexture mAlbedoTexture;