r.TemporalAASamples
r.TemporalAASamples
#Overview
name: r.TemporalAASamples
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of jittered positions for temporal AA (4, 8=default, 16, 32, 64).
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TemporalAASamples is to control the number of jittered positions used in temporal anti-aliasing (TAA) for improved image quality in Unreal Engine’s rendering system.
This setting variable is primarily used by the Unreal Engine’s rendering subsystem, specifically in the temporal anti-aliasing implementation. It’s also referenced in the Movie Render Pipeline plugin for validation purposes.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 8 and can be changed at runtime.
The associated variable CVarTemporalAASamples interacts directly with r.TemporalAASamples. It’s the actual console variable that stores and provides access to the value.
Developers should be aware that:
- The value affects the quality and performance of temporal anti-aliasing.
- Valid values are 4, 8 (default), 16, 32, and 64.
- Higher values may provide better quality but at the cost of performance.
- This setting interacts with other anti-aliasing settings, particularly in the Movie Render Pipeline.
Best practices when using this variable include:
- Balancing quality and performance based on the project’s needs.
- Testing different values to find the optimal setting for your specific use case.
- Being cautious when changing this value in shipping builds, as it can significantly impact performance.
- Considering the interaction with other anti-aliasing settings, especially in high-quality rendering scenarios like the Movie Render Pipeline.
Regarding the associated variable CVarTemporalAASamples:
- Its purpose is to provide a programmable interface to the r.TemporalAASamples setting.
- It’s used directly in the rendering code to retrieve the current value of the setting.
- The value is typically accessed using GetValueOnRenderThread() to ensure thread-safety.
- Developers should use this variable when they need to programmatically access or modify the temporal AA samples setting.
- Best practices include using the appropriate thread-safe getter methods and considering the performance implications of frequent access or changes to this value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:87
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTemporalAASamples(
TEXT("r.TemporalAASamples"),
8,
TEXT("Number of jittered positions for temporal AA (4, 8=default, 16, 32, 64)."),
ECVF_RenderThreadSafe);
static int32 GHZBOcclusion = 0;
static FAutoConsoleVariableRef CVarHZBOcclusion(
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineAntiAliasingSetting.cpp:9
Scope (from outer to inner):
file
function void UMoviePipelineAntiAliasingSetting::ValidateStateImpl
Source code excerpt:
int32 NumTAASamples = 8;
IConsoleVariable* AntiAliasingCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.TemporalAASamples"));
if(AntiAliasingCVar)
{
NumTAASamples = AntiAliasingCVar->GetInt();
}
if (IsTemporalAccumulationBasedMethod(UE::MovieRenderPipeline::GetEffectiveAntiAliasingMethod(this)))
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineAntiAliasingSetting.cpp:19
Scope (from outer to inner):
file
function void UMoviePipelineAntiAliasingSetting::ValidateStateImpl
Source code excerpt:
if ((TemporalSampleCount*SpatialSampleCount) > NumTAASamples)
{
const FText ValidationWarning = NSLOCTEXT("MovieRenderPipeline", "AntiAliasing_BetterOffWithoutTAA", "If the product of Temporal and Spatial counts ({0}x{1}={2}) is greater than the number of TAA samples (controlled by r.TemporalAASamples, currently {3}) then TAA is ineffective and you should consider overriding AA to None for better quality.");
ValidationResults.Add(FText::Format(ValidationWarning, TemporalSampleCount, SpatialSampleCount, TemporalSampleCount * SpatialSampleCount, NumTAASamples));
ValidationState = EMoviePipelineValidationState::Warnings;
}
if (SpatialSampleCount % 2 == 0)
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarTemporalAASamples
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:86
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarTemporalAASamples(
TEXT("r.TemporalAASamples"),
8,
TEXT("Number of jittered positions for temporal AA (4, 8=default, 16, 32, 64)."),
ECVF_RenderThreadSafe);
static int32 GHZBOcclusion = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:4822
Scope (from outer to inner):
file
function void FSceneRenderer::PrepareViewStateForVisibility
Source code excerpt:
// Subpixel jitter for temporal AA
int32 CVarTemporalAASamplesValue = CVarTemporalAASamples.GetValueOnRenderThread();
EMainTAAPassConfig TAAConfig = GetMainTAAPassConfig(View);
bool bTemporalUpsampling = View.PrimaryScreenPercentageMethod == EPrimaryScreenPercentageMethod::TemporalUpscale;
// Apply a sub pixel offset to the view.