r.TSR.ShadingRejection.Flickering.AdjustToFrameRate
r.TSR.ShadingRejection.Flickering.AdjustToFrameRate
#Overview
name: r.TSR.ShadingRejection.Flickering.AdjustToFrameRate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether r.TSR.ShadingRejection.Flickering.Period settings should adjust to frame rate when below r.TSR.ShadingRejection.Flickering.FrameRateCap. Please read r.TSR.ShadingRejection.Flickering\'s help for further details. (Enabled by default).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TSR.ShadingRejection.Flickering.AdjustToFrameRate is to control whether the Temporal Super Resolution (TSR) shading rejection flickering period should adjust based on the current frame rate. This setting is part of the rendering system, specifically the TSR feature which is used for image upscaling and antialiasing.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the Temporal Super Resolution subsystem. It’s referenced in the TemporalSuperResolution.cpp file, which handles the implementation of TSR.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime.
This variable interacts closely with other TSR-related variables, particularly r.TSR.ShadingRejection.Flickering.Period and r.TSR.ShadingRejection.Flickering.FrameRateCap. When enabled, it allows the flickering period to adjust based on the current frame rate, but only when the frame rate is below the specified cap.
Developers must be aware that this setting can affect the visual quality and performance of the TSR system. When enabled, it helps to maintain consistent visual quality across varying frame rates, which can be particularly important for games targeting a wide range of hardware capabilities.
Best practices when using this variable include:
- Testing the visual impact with it both enabled and disabled, especially on lower-end hardware.
- Considering the target frame rates for your game and adjusting the FrameRateCap accordingly.
- Monitoring its impact on overall rendering performance, as it may introduce additional calculations.
The associated variable CVarTSRFlickeringAdjustToFrameRate is the actual console variable that controls this setting. It’s an int32 type, where 1 means enabled and 0 means disabled. This variable is used directly in the rendering code to determine whether to adjust the flickering period based on the frame rate.
When using CVarTSRFlickeringAdjustToFrameRate, developers should be aware that it’s marked with ECVF_Scalability and ECVF_RenderThreadSafe flags. This means it can be adjusted for different scalability settings and is safe to modify from the render thread.
Best practices for CVarTSRFlickeringAdjustToFrameRate include:
- Using it in conjunction with other TSR settings for optimal results.
- Providing user options to enable/disable this feature if visual preferences may vary among players.
- Considering its impact on different hardware configurations during performance optimization passes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:160
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarTSRFlickeringAdjustToFrameRate(
TEXT("r.TSR.ShadingRejection.Flickering.AdjustToFrameRate"), 1,
TEXT("Whether r.TSR.ShadingRejection.Flickering.Period settings should adjust to frame rate when below r.TSR.ShadingRejection.Flickering.FrameRateCap. ")
TEXT("Please read r.TSR.ShadingRejection.Flickering's help for further details. (Enabled by default)."),
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<float> CVarTSRFlickeringPeriod(
TEXT("r.TSR.ShadingRejection.Flickering.Period"), 2.0f,
#Associated Variable and Callsites
This variable is associated with another variable named CVarTSRFlickeringAdjustToFrameRate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:159
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarTSRFlickeringAdjustToFrameRate(
TEXT("r.TSR.ShadingRejection.Flickering.AdjustToFrameRate"), 1,
TEXT("Whether r.TSR.ShadingRejection.Flickering.Period settings should adjust to frame rate when below r.TSR.ShadingRejection.Flickering.FrameRateCap. ")
TEXT("Please read r.TSR.ShadingRejection.Flickering's help for further details. (Enabled by default)."),
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<float> CVarTSRFlickeringPeriod(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1299
Scope (from outer to inner):
file
function FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
Source code excerpt:
const bool bSupportsAlpha = CVarTSRAlphaChannel.GetValueOnRenderThread() >= 0 ? (CVarTSRAlphaChannel.GetValueOnRenderThread() > 0) : IsPostProcessingWithAlphaChannelSupported();
const float RefreshRateToFrameRateCap = (View.Family->Time.GetDeltaRealTimeSeconds() > 0.0f && CVarTSRFlickeringAdjustToFrameRate.GetValueOnRenderThread())
? View.Family->Time.GetDeltaRealTimeSeconds() * CVarTSRFlickeringFrameRateCap.GetValueOnRenderThread() : 1.0f;
// Maximum number sample for each output pixel in the history
const float MaxHistorySampleCount = FMath::Clamp(CVarTSRHistorySampleCount.GetValueOnRenderThread(), 8.0f, 32.0f);
// Whether the view is orthographic view