r.TSR.History.SampleCount
r.TSR.History.SampleCount
#Overview
name: r.TSR.History.SampleCount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum number sample for each output pixel in the history. Higher values means more stability on highlights on static images, but may introduce additional ghosting on firefliers style of VFX. Minimum value supported is 8.0 as TSR was in 5.0 and 5.1. Maximum value possible due to the encoding of the TSR.History.Metadata is 32.0. Defaults to 16.0.\n\nUse \
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TSR.History.SampleCount is to control the maximum number of samples for each output pixel in the history buffer of the Temporal Super Resolution (TSR) system. This setting is part of Unreal Engine 5’s rendering system, specifically the post-processing pipeline.
This setting variable is primarily used by the Temporal Super Resolution subsystem within the Renderer module of Unreal Engine 5. It’s referenced in the TemporalSuperResolution.cpp file, which is responsible for implementing the TSR feature.
The value of this variable is set through a console variable (CVarTSRHistorySampleCount) with a default value of 16.0. It can be adjusted at runtime using console commands or through project settings.
The associated variable CVarTSRHistorySampleCount directly interacts with r.TSR.History.SampleCount. They share the same value and purpose.
Developers must be aware of the following when using this variable:
- The value is clamped between 8.0 and 32.0 due to encoding limitations in the TSR.History.Metadata.
- Higher values provide more stability for highlights in static images but may introduce additional ghosting for certain visual effects (VFX).
- The value affects the trade-off between image stability and potential artifacts in dynamic scenes.
Best practices when using this variable include:
- Start with the default value of 16.0 and adjust based on specific project needs.
- Use the “r.TSR.Visualize 0” command to visualize the number of accumulated samples in different areas of the screen.
- Test thoroughly with different types of content, especially with dynamic VFX, to find the optimal balance between stability and artifact reduction.
- Consider performance implications when increasing the value, as it may affect memory usage and processing time.
Regarding the associated variable CVarTSRHistorySampleCount:
This is the actual console variable that controls the r.TSR.History.SampleCount setting. It’s defined as a TAutoConsoleVariable
#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:29
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<float> CVarTSRHistorySampleCount(
TEXT("r.TSR.History.SampleCount"), 16.0f,
TEXT("Maximum number sample for each output pixel in the history. Higher values means more stability on highlights on static images, ")
TEXT("but may introduce additional ghosting on firefliers style of VFX. Minimum value supported is 8.0 as TSR was in 5.0 and 5.1. ")
TEXT("Maximum value possible due to the encoding of the TSR.History.Metadata is 32.0. Defaults to 16.0.\n")
TEXT("\n")
TEXT("Use \"r.TSR.Visualize 0\" command to see how many samples where accumulated in TSR history on areas of the screen."),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarTSRHistorySampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:28
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<float> CVarTSRHistorySampleCount(
TEXT("r.TSR.History.SampleCount"), 16.0f,
TEXT("Maximum number sample for each output pixel in the history. Higher values means more stability on highlights on static images, ")
TEXT("but may introduce additional ghosting on firefliers style of VFX. Minimum value supported is 8.0 as TSR was in 5.0 and 5.1. ")
TEXT("Maximum value possible due to the encoding of the TSR.History.Metadata is 32.0. Defaults to 16.0.\n")
TEXT("\n")
TEXT("Use \"r.TSR.Visualize 0\" command to see how many samples where accumulated in TSR history on areas of the screen."),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1303
Scope (from outer to inner):
file
function FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
Source code excerpt:
// 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
const bool bIsOrthoProjection = !View.IsPerspectiveProjection();
// whether TSR passes can run on async compute.
int32 AsyncComputePasses = GSupportsEfficientAsyncCompute ? CVarTSRAsyncCompute.GetValueOnRenderThread() : 0;