r.AOGlobalDistanceFieldClipmapUpdatesPerFrame

r.AOGlobalDistanceFieldClipmapUpdatesPerFrame

#Overview

name: r.AOGlobalDistanceFieldClipmapUpdatesPerFrame

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.AOGlobalDistanceFieldClipmapUpdatesPerFrame is to control the number of clipmaps updated each frame in the Global Distance Field system, which is part of Unreal Engine’s rendering subsystem, specifically related to Ambient Occlusion (AO) calculations.

This setting variable is primarily used by the Renderer module in Unreal Engine 5. It’s specifically utilized within the Global Distance Field functionality, which is a key component of the engine’s advanced rendering features.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 2 and can be modified at runtime using console commands or through project settings.

The associated variable GAOGlobalDistanceFieldClipmapUpdatesPerFrame directly interacts with r.AOGlobalDistanceFieldClipmapUpdatesPerFrame. They share the same value, with GAOGlobalDistanceFieldClipmapUpdatesPerFrame being the actual int32 variable used in the C++ code.

Developers must be aware that setting this value to less than 2 can cause incorrect self-occlusion during movement. This is because with values less than 2, the first clipmap is only updated every other frame, which can lead to visual artifacts.

Best practices when using this variable include:

  1. Keeping the value at 2 or higher for optimal visual quality, especially in scenes with dynamic objects.
  2. Adjusting the value based on performance requirements, understanding that lower values may impact visual fidelity but could improve performance.
  3. Testing thoroughly when modifying this value to ensure a good balance between performance and visual quality.

Regarding the associated variable GAOGlobalDistanceFieldClipmapUpdatesPerFrame:

The purpose of GAOGlobalDistanceFieldClipmapUpdatesPerFrame is to store and provide access to the number of clipmap updates per frame within the C++ code of the engine.

This variable is used directly in the Renderer module, specifically in the Global Distance Field calculations. It’s accessed in the GetNumClipmapUpdatesPerFrame() function, which determines how many clipmaps to update each frame.

The value of GAOGlobalDistanceFieldClipmapUpdatesPerFrame is set through the console variable system, mirroring the value of r.AOGlobalDistanceFieldClipmapUpdatesPerFrame.

It interacts with another variable GAOGlobalDistanceFieldFastCameraMode in the GetNumClipmapUpdatesPerFrame() function, which can override its value under certain conditions.

Developers should be aware that this variable directly affects the update frequency of the Global Distance Field, which can impact both performance and visual quality.

Best practices include carefully balancing this value with other performance-critical settings and thoroughly testing any changes to ensure they don’t negatively impact the game’s visuals or performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:87

Scope: file

Source code excerpt:

int32 GAOGlobalDistanceFieldClipmapUpdatesPerFrame = 2;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldClipmapUpdatesPerFrame(
	TEXT("r.AOGlobalDistanceFieldClipmapUpdatesPerFrame"),
	GAOGlobalDistanceFieldClipmapUpdatesPerFrame,
	TEXT("How many clipmaps to update each frame.  With values less than 2, the first clipmap is only updated every other frame, which can cause incorrect self occlusion during movement."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GAOGlobalDistanceFieldForceFullUpdate = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:85

Scope: file

Source code excerpt:

	);

int32 GAOGlobalDistanceFieldClipmapUpdatesPerFrame = 2;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldClipmapUpdatesPerFrame(
	TEXT("r.AOGlobalDistanceFieldClipmapUpdatesPerFrame"),
	GAOGlobalDistanceFieldClipmapUpdatesPerFrame,
	TEXT("How many clipmaps to update each frame.  With values less than 2, the first clipmap is only updated every other frame, which can cause incorrect self occlusion during movement."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GAOGlobalDistanceFieldForceFullUpdate = 0;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldForceFullUpdate(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:372

Scope (from outer to inner):

file
function     int32 GetNumClipmapUpdatesPerFrame

Source code excerpt:

int32 GetNumClipmapUpdatesPerFrame()
{
	return GAOGlobalDistanceFieldFastCameraMode ? 1 : GAOGlobalDistanceFieldClipmapUpdatesPerFrame;
}

int32 GlobalDistanceField::GetNumGlobalDistanceFieldClipmaps(bool bLumenEnabled, float LumenSceneViewDistance)
{
	int32 WantedClipmaps = GAOGlobalDistanceFieldNumClipmaps;