r.CustomDepthTemporalAAJitter
r.CustomDepthTemporalAAJitter
#Overview
name: r.CustomDepthTemporalAAJitter
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If disabled the Engine will remove the TemporalAA Jitter from the Custom Depth Pass. Only has effect when TemporalAA is used.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.CustomDepthTemporalAAJitter is to control the application of Temporal Anti-Aliasing (TAA) jitter to the Custom Depth Pass in Unreal Engine’s rendering system. This setting variable is part of the rendering subsystem and specifically affects the Custom Depth rendering process.
The Unreal Engine rendering subsystem relies on this setting variable, particularly in the Custom Depth rendering module. It is used in the CustomDepthRendering.cpp file, which is part of the Renderer module.
The value of this variable is set using a console variable (CVar) system. It is initialized with a default value of 1, meaning the TAA jitter is applied to the Custom Depth Pass by default.
This variable interacts with the Temporal Anti-Aliasing system and the Custom Depth rendering process. It’s associated with the C++ variable CVarCustomDepthTemporalAAJitter, which is used to access its value in the code.
Developers must be aware that this variable only has an effect when Temporal Anti-Aliasing is being used in the project. Disabling this variable (setting it to 0) will remove the TAA jitter from the Custom Depth Pass, which may affect the visual quality of the rendered scene, particularly in motion.
Best practices when using this variable include:
- Understanding the impact of TAA jitter on your specific scene and use case.
- Testing the visual differences with the variable enabled and disabled to determine the best setting for your project.
- Being mindful of performance implications, as applying TAA jitter may have a small performance cost.
Regarding the associated variable CVarCustomDepthTemporalAAJitter:
The purpose of CVarCustomDepthTemporalAAJitter is to provide programmatic access to the r.CustomDepthTemporalAAJitter console variable within the C++ code.
This variable is used in the Renderer module, specifically in the CustomDepthRendering.cpp file. It’s used to retrieve the current value of the setting at runtime.
The value of this variable is set automatically by the console variable system based on the r.CustomDepthTemporalAAJitter setting.
It interacts directly with the r.CustomDepthTemporalAAJitter console variable and is used in the RenderCustomDepthPass function to determine whether to remove TAA jitter from the Custom Depth Pass.
Developers should be aware that this variable is of type TAutoConsoleVariable
Best practices for using this variable include:
- Always accessing its value using the GetValueOnRenderThread() method when in render thread code.
- Being aware that changes to this variable at runtime will affect the rendering immediately.
- Using this variable for conditional logic in render code rather than directly accessing the console variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:22
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarCustomDepthTemporalAAJitter(
TEXT("r.CustomDepthTemporalAAJitter"),
1,
TEXT("If disabled the Engine will remove the TemporalAA Jitter from the Custom Depth Pass. Only has effect when TemporalAA is used."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<bool> CVarCustomDepthEnableFastClear(
TEXT("r.CustomDepthEnableFastClear"), false,
#Associated Variable and Callsites
This variable is associated with another variable named CVarCustomDepthTemporalAAJitter
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:21
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarCustomDepthTemporalAAJitter(
TEXT("r.CustomDepthTemporalAAJitter"),
1,
TEXT("If disabled the Engine will remove the TemporalAA Jitter from the Custom Depth Pass. Only has effect when TemporalAA is used."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<bool> CVarCustomDepthEnableFastClear(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.cpp:202
Scope (from outer to inner):
file
function bool FSceneRenderer::RenderCustomDepthPass
Source code excerpt:
const bool bWriteCustomStencil = IsCustomDepthPassWritingStencil();
const bool bDrawSceneViewsInOneNanitePass = Views.Num() > 1 && Nanite::ShouldDrawSceneViewsInOneNanitePass(Views[0]);
const bool bRemoveTAAJitter = CVarCustomDepthTemporalAAJitter.GetValueOnRenderThread() == 0;
// Determine if any of the views have custom depth and if any of them have Nanite that is rendering custom depth
bool bAnyCustomDepth = false;
uint32 TotalNaniteInstances = 0;
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ++ViewIndex)
{