r.TSR.AplhaChannel
r.TSR.AplhaChannel
#Overview
name: r.TSR.AplhaChannel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls whether TSR should process the scene color\'s alpha channel.\n -1: based of r.PostProcessing.PropagateAlpha (default);\n 0: disabled;\n 1: enabled.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TSR.AplhaChannel is to control whether Temporal Super Resolution (TSR) should process the scene color’s alpha channel in Unreal Engine’s rendering system.
This setting variable is primarily used in the Renderer module, specifically within the Temporal Super Resolution subsystem. It’s referenced in the PostProcess/TemporalSuperResolution.cpp file, indicating its importance in the post-processing pipeline.
The value of this variable is set through a console variable (CVarTSRAlphaChannel) with three possible states: -1: The default setting, which bases the behavior on another variable (r.PostProcessing.PropagateAlpha) 0: Disabled, meaning TSR will not process the alpha channel 1: Enabled, allowing TSR to process the alpha channel
This variable interacts closely with the r.PostProcessing.PropagateAlpha setting when set to -1, as it determines whether to process the alpha channel based on that variable’s value.
Developers must be aware that this setting can significantly impact the rendering of transparent or semi-transparent objects in the scene. Enabling alpha channel processing in TSR can potentially improve the quality of these objects during temporal upscaling, but it may also have performance implications.
Best practices when using this variable include:
- Testing thoroughly with both enabled and disabled states to determine the best setting for your specific use case.
- Considering the performance impact, especially on lower-end hardware.
- Ensuring that the alpha channel data in your scene is accurate and meaningful if you choose to enable this feature.
Regarding the associated variable CVarTSRAlphaChannel:
This is the actual console variable that controls the r.TSR.AplhaChannel setting. It’s defined as a TAutoConsoleVariable
The purpose of CVarTSRAlphaChannel is to provide a programmatic way to access and modify the r.TSR.AplhaChannel setting within the engine’s C++ code.
This variable is used in the FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses function to determine whether alpha channel support should be enabled for TSR.
Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.
Best practices for using CVarTSRAlphaChannel include:
- Using GetValueOnRenderThread() when accessing the value, to ensure thread-safe operations.
- Combining its value with other relevant settings (like IsPostProcessingWithAlphaChannelSupported()) to make decisions about alpha channel processing in TSR.
- Considering exposing this setting in user-facing graphics options if alpha channel processing has a noticeable impact on visual quality or performance in your game.
#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:21
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarTSRAlphaChannel(
TEXT("r.TSR.AplhaChannel"), -1,
TEXT("Controls whether TSR should process the scene color's alpha channel.\n")
TEXT(" -1: based of r.PostProcessing.PropagateAlpha (default);\n")
TEXT(" 0: disabled;\n")
TEXT(" 1: enabled.\n"),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarTSRAlphaChannel
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:20
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
{
TAutoConsoleVariable<int32> CVarTSRAlphaChannel(
TEXT("r.TSR.AplhaChannel"), -1,
TEXT("Controls whether TSR should process the scene color's alpha channel.\n")
TEXT(" -1: based of r.PostProcessing.PropagateAlpha (default);\n")
TEXT(" 0: disabled;\n")
TEXT(" 1: enabled.\n"),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1297
Scope (from outer to inner):
file
function FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
Source code excerpt:
// Whether alpha channel is supported.
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);