r.TSR.Resurrection
r.TSR.Resurrection
#Overview
name: r.TSR.Resurrection
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:
Allows TSR to resurrect previously discarded details from many frames ago.\n\nWhen enabled, the entire frames of the TSR are stored in a same unique Texture2DArray including a configurable number of persistent frame (defined by r.TSR.Resurrection.PersistentFrameCount) that are occasionally recorded (defined by r.TSR.Resurrection.PersistentFrameInterval).\nThen every frame, TSR will attempt to reproject either previous frame, or the oldest persistent frame available based which matches best the current frames. The later option will happen when something previously seen by TSR shows up again (no matter through parallax disocclusion, shading changes, translucent VFX moving) which will have the advantage bypass the need to newly accumulate a second time by simply resurrected the previously accumulated details.\n\nCommand \
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TSR.Resurrection is to enable the Temporal Super Resolution (TSR) system to resurrect previously discarded details from many frames ago. This setting is part of Unreal Engine’s rendering system, specifically the post-processing and upscaling subsystem.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly within the Temporal Super Resolution functionality. It’s referenced in the TemporalSuperResolution.cpp file, which is part of the post-processing pipeline.
The value of this variable is set through a console variable (CVarTSRResurrectionEnable), which is initialized with a default value of 0 (disabled). Developers can change this value at runtime or through configuration files.
Several other variables interact with r.TSR.Resurrection:
- r.TSR.Resurrection.PersistentFrameCount: Defines the number of persistent frames to store.
- r.TSR.Resurrection.PersistentFrameInterval: Defines how often persistent frames are recorded.
Developers must be aware that enabling this feature may have performance implications, as it requires storing entire frames in a Texture2DArray. This could increase memory usage and potentially impact rendering performance.
Best practices when using this variable include:
- Carefully consider the performance trade-offs before enabling this feature.
- Adjust the PersistentFrameCount and PersistentFrameInterval settings to find the optimal balance between quality improvement and performance cost.
- Test thoroughly in various scenarios to ensure it doesn’t negatively impact the overall rendering performance.
Regarding the associated variable CVarTSRResurrectionEnable:
The purpose of CVarTSRResurrectionEnable is to provide a programmatic way to control the r.TSR.Resurrection setting. It’s an internal representation of the console variable that allows the engine to query and modify the setting’s value at runtime.
This variable is used within the Renderer module, specifically in the AddTemporalSuperResolutionPasses function, to determine whether to enable the TSR resurrection feature and configure the history slice sequence accordingly.
The value of CVarTSRResurrectionEnable is set when the r.TSR.Resurrection console variable is modified, either through console commands or configuration files.
Developers should be aware that changes to CVarTSRResurrectionEnable will directly affect the behavior of the TSR system. When enabled, it influences how the HistorySliceSequence is configured, potentially affecting memory usage and rendering performance.
Best practices for using CVarTSRResurrectionEnable include:
- Use it to dynamically enable or disable the TSR resurrection feature based on runtime conditions or user preferences.
- Consider exposing this setting in the game’s graphics options menu to allow users to toggle it based on their hardware capabilities.
- Profile the performance impact of enabling this feature in various scenarios to make informed decisions about its usage.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:60, section: [AntiAliasingQuality@0]
- INI Section:
AntiAliasingQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:70, section: [AntiAliasingQuality@1]
- INI Section:
AntiAliasingQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:80, section: [AntiAliasingQuality@2]
- INI Section:
AntiAliasingQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:90, section: [AntiAliasingQuality@3]
- INI Section:
AntiAliasingQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:100, section: [AntiAliasingQuality@Cine]
- INI Section:
AntiAliasingQuality@Cine
- Raw value:
1
- 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:219
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarTSRResurrectionEnable(
TEXT("r.TSR.Resurrection"), 0,
TEXT("Allows TSR to resurrect previously discarded details from many frames ago.\n")
TEXT("\n")
TEXT("When enabled, the entire frames of the TSR are stored in a same unique Texture2DArray including a configurable ")
TEXT("number of persistent frame (defined by r.TSR.Resurrection.PersistentFrameCount) that are occasionally recorded ")
TEXT("(defined by r.TSR.Resurrection.PersistentFrameInterval).")
TEXT("\n")
#Associated Variable and Callsites
This variable is associated with another variable named CVarTSRResurrectionEnable
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:218
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarTSRResurrectionEnable(
TEXT("r.TSR.Resurrection"), 0,
TEXT("Allows TSR to resurrect previously discarded details from many frames ago.\n")
TEXT("\n")
TEXT("When enabled, the entire frames of the TSR are stored in a same unique Texture2DArray including a configurable ")
TEXT("number of persistent frame (defined by r.TSR.Resurrection.PersistentFrameCount) that are occasionally recorded ")
TEXT("(defined by r.TSR.Resurrection.PersistentFrameInterval).")
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1258
Scope (from outer to inner):
file
function FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
Source code excerpt:
// Number of frames stored in the history.
FTSRHistorySliceSequence HistorySliceSequence;
if (CVarTSRResurrectionEnable.GetValueOnRenderThread())
{
HistorySliceSequence.FrameStorageCount = FMath::Clamp(
FTSRHistorySliceSequence::kTransientSliceCount + FMath::DivideAndRoundUp(CVarTSRResurrectionPersistentFrameCount.GetValueOnRenderThread(), 2) * 2,
4,
GMaxTextureArrayLayers);
HistorySliceSequence.FrameStoragePeriod = FMath::Clamp(CVarTSRResurrectionPersistentFrameInterval.GetValueOnRenderThread() | 0x1, 1, 1024);