Fix Volumetric Fog flicker on camera cuts

#3443
This commit is contained in:
Wojtek Figat
2025-09-19 23:10:03 +02:00
parent afdd264e63
commit 47711ec5be

View File

@@ -179,6 +179,8 @@ bool VolumetricFogPass::Init(RenderContext& renderContext, GPUContext* context,
(float)_cache.GridSizeZ);
auto& fogData = renderContext.Buffers->VolumetricFogData;
fogData.MaxDistance = options.Distance;
if (renderContext.Task->IsCameraCut)
_cache.HistoryWeight = 0.0f;
// Init data (partial, without directional light or sky light data);
GBufferPass::SetInputs(renderContext.View, _cache.Data.GBuffer);
@@ -528,7 +530,7 @@ void VolumetricFogPass::Render(RenderContext& renderContext)
{
PROFILE_GPU("Light Scattering");
const bool temporalHistoryIsValid = renderContext.Buffers->VolumetricFogHistory && !renderContext.Task->IsCameraCut && Float3::NearEqual(renderContext.Buffers->VolumetricFogHistory->Size3(), cache.GridSize);
const bool temporalHistoryIsValid = renderContext.Buffers->VolumetricFogHistory && Float3::NearEqual(renderContext.Buffers->VolumetricFogHistory->Size3(), cache.GridSize);
const auto lightScatteringHistory = temporalHistoryIsValid ? renderContext.Buffers->VolumetricFogHistory : nullptr;
context->BindUA(0, lightScattering->ViewVolume());