r.TemporalAA.Debug.OverrideTemporalIndex

r.TemporalAA.Debug.OverrideTemporalIndex

#Overview

name: r.TemporalAA.Debug.OverrideTemporalIndex

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.Debug.OverrideTemporalIndex is to provide a debugging tool for the Temporal Anti-Aliasing (TAA) system in Unreal Engine 5. It allows developers to manually override the temporal index used in the TAA algorithm for testing and debugging purposes.

This setting variable is primarily used by the rendering system, specifically within the Temporal Anti-Aliasing subsystem. Based on the callsites, it appears to be implemented in the SceneVisibility module of the Renderer.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of -1, which means no override is applied by default.

The associated variable CVarTAADebugOverrideTemporalIndex directly interacts with r.TemporalAA.Debug.OverrideTemporalIndex. They share the same value and purpose.

Developers must be aware that:

  1. This variable is only active in non-shipping builds (#if !UE_BUILD_SHIPPING).
  2. It’s intended for debugging purposes only and should not be used in production builds.
  3. Setting a value >= 0 will override the normal temporal index calculation.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Reset it to -1 (or remove usage entirely) before creating shipping builds.
  3. Be cautious when overriding the temporal index, as it may affect the visual quality and performance of the TAA system.

Regarding the associated variable CVarTAADebugOverrideTemporalIndex:

The purpose of CVarTAADebugOverrideTemporalIndex is identical to r.TemporalAA.Debug.OverrideTemporalIndex. It’s the C++ implementation of the console variable.

This variable is used in the SceneVisibility module of the Renderer subsystem. It’s checked in the PrepareViewStateForVisibility function to potentially override the TemporalSampleIndex.

The value is set when the console variable is initialized, and it can be modified at runtime through console commands.

CVarTAADebugOverrideTemporalIndex directly interacts with the TemporalSampleIndex variable within the rendering pipeline.

Developers should be aware that this variable is only checked in non-shipping builds and its value is retrieved on the render thread (GetValueOnRenderThread()).

Best practices include using this variable judiciously for debugging purposes and ensuring it’s not relied upon in shipping builds.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:346

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarTAADebugOverrideTemporalIndex(
	TEXT("r.TemporalAA.Debug.OverrideTemporalIndex"), -1,
	TEXT("Override the temporal index for debugging purposes."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarFreezeTemporalSequences(
	TEXT("r.Test.FreezeTemporalSequences"), 0,
	TEXT("Freezes all temporal sequences."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:345

Scope: file

Source code excerpt:

#if !UE_BUILD_SHIPPING

static TAutoConsoleVariable<int32> CVarTAADebugOverrideTemporalIndex(
	TEXT("r.TemporalAA.Debug.OverrideTemporalIndex"), -1,
	TEXT("Override the temporal index for debugging purposes."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarFreezeTemporalSequences(
	TEXT("r.Test.FreezeTemporalSequences"), 0,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp:4887

Scope (from outer to inner):

file
function     void FSceneRenderer::PrepareViewStateForVisibility

Source code excerpt:


			#if !UE_BUILD_SHIPPING
			if (CVarTAADebugOverrideTemporalIndex.GetValueOnRenderThread() >= 0)
			{
				TemporalSampleIndex = CVarTAADebugOverrideTemporalIndex.GetValueOnRenderThread();
			}
			#endif

			// Updates view state.
			if (!View.bStatePrevViewInfoIsReadOnly && !bFreezeTemporalSequences)
			{