r.TemporalAA.Quality

r.TemporalAA.Quality

#Overview

name: r.TemporalAA.Quality

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.TemporalAA.Quality is to control the quality settings of the Temporal Anti-Aliasing (TAA) pass in Unreal Engine’s rendering system. This variable allows developers to adjust the level of input filtering and anti-ghosting applied during the TAA process.

This setting variable is primarily used by the rendering subsystem of Unreal Engine, specifically within the Temporal Anti-Aliasing module. Based on the callsites, it’s clear that this variable is utilized in the post-processing stage of the rendering pipeline.

The value of this variable is set through a console command, as evident from the TAutoConsoleVariable declaration. It has a default value of 2, which enables more input filtering and mobility-based anti-ghosting.

The associated variable CVarTemporalAAQuality directly interacts with r.TemporalAA.Quality. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the visual quality and performance of the TAA implementation. Higher quality settings may result in better image quality but could impact performance.

Best practices when using this variable include:

  1. Carefully consider the trade-off between image quality and performance when adjusting this setting.
  2. Test different quality levels to find the optimal balance for your specific project.
  3. Be mindful of the performance impact on different hardware configurations.

Regarding the associated variable CVarTemporalAAQuality:

The purpose of CVarTemporalAAQuality is to provide a programmatic interface to control the TAA quality settings within the engine’s C++ code. It directly corresponds to the r.TemporalAA.Quality console variable.

This variable is used in the rendering subsystem, specifically in the Temporal Anti-Aliasing implementation. It’s accessed in the FDefaultTemporalUpscaler::FOutputs AddGen4MainTemporalAAPasses function to set up the TAA parameters.

The value of CVarTemporalAAQuality is set through the console variable system and can be accessed on the render thread using GetValueOnRenderThread().

Developers should be aware that changes to CVarTemporalAAQuality will directly affect the TAA quality settings. It’s important to use this variable consistently with the console variable r.TemporalAA.Quality to avoid confusion.

Best practices for using CVarTemporalAAQuality include:

  1. Access the value on the render thread when used in rendering code.
  2. Use the FMath::Clamp function to ensure the value stays within the valid range (0 to ETAAQuality::MAX - 1).
  3. Consider exposing this setting through user interfaces for easy adjustment during development and testing.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:54, section: [AntiAliasingQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:64, section: [AntiAliasingQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:74, section: [AntiAliasingQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:84, section: [AntiAliasingQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:94, section: [AntiAliasingQuality@Cine]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalAA.cpp:44

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarTemporalAAQuality(
	TEXT("r.TemporalAA.Quality"), 2,
	TEXT("Quality of the main Temporal AA pass.\n")
	TEXT(" 0: Disable input filtering;\n")
	TEXT(" 1: Enable input filtering;\n")
	TEXT(" 2: Enable more input filtering, enable mobility based anti-ghosting (Default)\n")
	TEXT(" 3: Quality 1 input filtering, enable anti-ghosting"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

#Associated Variable and Callsites

This variable is associated with another variable named CVarTemporalAAQuality. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalAA.cpp:43

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarTemporalAAQuality(
	TEXT("r.TemporalAA.Quality"), 2,
	TEXT("Quality of the main Temporal AA pass.\n")
	TEXT(" 0: Disable input filtering;\n")
	TEXT(" 1: Enable input filtering;\n")
	TEXT(" 2: Enable more input filtering, enable mobility based anti-ghosting (Default)\n")
	TEXT(" 3: Quality 1 input filtering, enable anti-ghosting"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalAA.cpp:1001

Scope (from outer to inner):

file
function     FDefaultTemporalUpscaler::FOutputs AddGen4MainTemporalAAPasses

Source code excerpt:

	TAAParameters.SetupViewRect(View);

	TAAParameters.Quality = ETAAQuality(FMath::Clamp(CVarTemporalAAQuality.GetValueOnRenderThread(), 0, int32(ETAAQuality::MAX) - 1));

	const FIntRect SecondaryViewRect = TAAParameters.OutputViewRect;

	const float HistoryUpscaleFactor = GetTemporalAAHistoryUpscaleFactor(View);

	// Configures TAA to upscale the history buffer; this is in addition to the secondary screen percentage upscale.