Fix camera cut flag in rendering to not trigger on origin change for smother visuals

This commit is contained in:
Wojtek Figat
2025-10-03 22:20:58 +02:00
parent 4f45b3c1d0
commit 6ae370f8fc
3 changed files with 10 additions and 4 deletions

View File

@@ -265,6 +265,14 @@ public:
return Projection.M44 >= 1.0f;
}
/// <summary>
/// Determines whether view Origin has been moved in this frame. Old history buffers/data might be invalid.
/// </summary>
FORCE_INLINE bool IsOriginTeleport() const
{
return Origin != PrevOrigin;
}
public:
// Ignore deprecation warnings in defaults
PRAGMA_DISABLE_DEPRECATION_WARNINGS

View File

@@ -353,8 +353,6 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
const bool isGBufferDebug = GBufferPass::IsDebugView(renderContext.View.Mode);
{
PROFILE_CPU_NAMED("Setup");
if (renderContext.View.Origin != renderContext.View.PrevOrigin)
renderContext.Task->CameraCut(); // Cut any temporal effects on rendering origin change
const int32 screenWidth = renderContext.Buffers->GetWidth();
const int32 screenHeight = renderContext.Buffers->GetHeight();
setup.UpscaleLocation = renderContext.Task->UpscaleLocation;

View File

@@ -179,7 +179,7 @@ bool VolumetricFogPass::Init(RenderContext& renderContext, GPUContext* context,
(float)_cache.GridSizeZ);
auto& fogData = renderContext.Buffers->VolumetricFogData;
fogData.MaxDistance = options.Distance;
if (renderContext.Task->IsCameraCut)
if (renderContext.Task->IsCameraCut || renderContext.View.IsOriginTeleport())
_cache.HistoryWeight = 0.0f;
// Init data (partial, without directional light or sky light data);
@@ -313,7 +313,7 @@ void VolumetricFogPass::Render(RenderContext& renderContext)
PROFILE_GPU_CPU("Volumetric Fog");
// TODO: test exponential depth distribution (should give better quality near the camera)
// TODO: use tiled light culling and render unshadowed lights in single pass
// TODO: use tiled light culling and render shadowed/unshadowed lights in single pass
// Try to get shadows atlas
GPUTexture* shadowMap;