r.TSR.RejectionAntiAliasingQuality
r.TSR.RejectionAntiAliasingQuality
#Overview
name: r.TSR.RejectionAntiAliasingQuality
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls the quality of TSR\'s built-in spatial anti-aliasing technology when the history needs to be rejected. While this may not be critical when the rendering resolution is not much lowered than display resolution, this technic however becomes essential to hide lower rendering resolution rendering because of two reasons:\n - the screen space size of aliasing is inverse proportional to rendering resolution;\n - rendering at lower resolution means need more frame to reach at least 1 rendered pixel per display pixel.\n\nUse \
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TSR.RejectionAntiAliasingQuality is to control the quality of Temporal Super Resolution’s (TSR) built-in spatial anti-aliasing technology when the history needs to be rejected. This setting is particularly important for the rendering system, specifically for the post-processing and anti-aliasing components.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly within the Temporal Super Resolution (TSR) system. Based on the callsites, it’s clear that this variable is utilized in the post-processing pipeline, specifically in the TemporalSuperResolution.cpp file.
The value of this variable is set through a console variable (CVarTSRRejectionAntiAliasingQuality) with a default value of 3. It can be modified at runtime through console commands or through engine configuration files.
The variable interacts closely with other TSR-related variables, such as CVarTSRR11G11B10History, which affects the history color format. It’s also used in conjunction with the UpdateHistoryQuality enumeration to determine the final rejection anti-aliasing quality.
Developers must be aware that this variable becomes particularly crucial when rendering at lower resolutions. The comment in the code explains that it’s essential for hiding lower rendering resolution artifacts due to two reasons:
- The screen space size of aliasing is inversely proportional to rendering resolution.
- Lower resolution rendering requires more frames to reach at least 1 rendered pixel per display pixel.
Best practices when using this variable include:
- Adjusting it based on the target rendering resolution and display resolution.
- Considering the performance impact of higher quality settings, especially on lower-end hardware.
- Testing different values to find the optimal balance between image quality and performance for your specific use case.
Regarding the associated variable CVarTSRRejectionAntiAliasingQuality:
This is the actual console variable that controls the r.TSR.RejectionAntiAliasingQuality setting. It’s defined as an integer with a default value of 3. The variable is used directly in the FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses function to determine the RejectionAntiAliasingQuality.
When using this variable, developers should note that:
- The value is clamped between 1 and 2 in the actual implementation, despite the default being set to 3.
- If UpdateHistoryQuality is set to Low, the RejectionAntiAliasingQuality is forced to 0, overriding the console variable setting.
- Changes to this variable will be reflected in real-time, as it’s accessed using GetValueOnRenderThread().
Best practices for using CVarTSRRejectionAntiAliasingQuality include:
- Using it in conjunction with other TSR settings for optimal results.
- Monitoring performance impacts when adjusting this value, especially in performance-critical scenarios.
- Consider exposing this setting to end-users for fine-tuning, but with clear explanations of its impact on both quality and performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:59, section: [AntiAliasingQuality@0]
- INI Section:
AntiAliasingQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:69, section: [AntiAliasingQuality@1]
- INI Section:
AntiAliasingQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:79, section: [AntiAliasingQuality@2]
- INI Section:
AntiAliasingQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:89, section: [AntiAliasingQuality@3]
- INI Section:
AntiAliasingQuality@3
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:99, section: [AntiAliasingQuality@Cine]
- INI Section:
AntiAliasingQuality@Cine
- Raw value:
2
- Is Array:
False
#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:206
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarTSRRejectionAntiAliasingQuality(
TEXT("r.TSR.RejectionAntiAliasingQuality"), 3,
TEXT("Controls the quality of TSR's built-in spatial anti-aliasing technology when the history needs to be rejected. ")
TEXT("While this may not be critical when the rendering resolution is not much lowered than display resolution, ")
TEXT("this technic however becomes essential to hide lower rendering resolution rendering because of two reasons:\n")
TEXT(" - the screen space size of aliasing is inverse proportional to rendering resolution;\n")
TEXT(" - rendering at lower resolution means need more frame to reach at least 1 rendered pixel per display pixel.\n")
TEXT("\n")
#Associated Variable and Callsites
This variable is associated with another variable named CVarTSRRejectionAntiAliasingQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:205
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarTSRRejectionAntiAliasingQuality(
TEXT("r.TSR.RejectionAntiAliasingQuality"), 3,
TEXT("Controls the quality of TSR's built-in spatial anti-aliasing technology when the history needs to be rejected. ")
TEXT("While this may not be critical when the rendering resolution is not much lowered than display resolution, ")
TEXT("this technic however becomes essential to hide lower rendering resolution rendering because of two reasons:\n")
TEXT(" - the screen space size of aliasing is inverse proportional to rendering resolution;\n")
TEXT(" - rendering at lower resolution means need more frame to reach at least 1 rendered pixel per display pixel.\n")
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1335
Scope (from outer to inner):
file
function FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
Source code excerpt:
EPixelFormat HistoryColorFormat = (CVarTSRR11G11B10History.GetValueOnRenderThread() != 0 && !bSupportsAlpha) ? PF_FloatR11G11B10 : PF_FloatRGBA;
int32 RejectionAntiAliasingQuality = FMath::Clamp(CVarTSRRejectionAntiAliasingQuality.GetValueOnRenderThread(), 1, 2);
if (UpdateHistoryQuality == FTSRUpdateHistoryCS::EQuality::Low)
{
RejectionAntiAliasingQuality = 0;
}
FIntPoint InputExtent = PassInputs.SceneColor.Texture->Desc.Extent;