Fix camera cut flag in rendering to not trigger on origin change for smother visuals
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user