r.AOGlobalDFResolution

r.AOGlobalDFResolution

#Overview

name: r.AOGlobalDFResolution

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.AOGlobalDFResolution is to control the resolution of the global distance field used in ambient occlusion calculations within Unreal Engine’s rendering system. This setting variable is primarily used for the rendering system, specifically for global distance field-based ambient occlusion.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its location in the GlobalDistanceField.cpp file within the Runtime/Renderer/Private directory.

The value of this variable is set through the console variable system, using an FAutoConsoleVariableRef. It is initialized with a default value of 128 and can be changed at runtime.

The associated variable GAOGlobalDFResolution interacts directly with r.AOGlobalDFResolution. They share the same value, with GAOGlobalDFResolution being the actual integer variable used in the code, while r.AOGlobalDFResolution is the console variable name used for external access and modification.

Developers must be aware that changing this variable affects both the fidelity of the global distance field and the performance of the rendering system. Higher values increase the quality of ambient occlusion but also increase memory usage and composition cost.

Best practices when using this variable include:

  1. Balancing quality and performance by finding an optimal resolution for your specific use case.
  2. Consider scalability options, as the variable is marked with ECVF_Scalability flag.
  3. Be mindful of the performance impact on lower-end hardware when increasing the resolution.
  4. Test thoroughly across different hardware configurations to ensure acceptable performance.

Regarding the associated variable GAOGlobalDFResolution:

The purpose of GAOGlobalDFResolution is to store the actual integer value of the global distance field resolution used in the rendering calculations.

This variable is used directly in the Renderer module, specifically in the GlobalDistanceField class. It’s accessed in functions like GetClipmapResolution to determine the resolution of the global distance field.

The value of GAOGlobalDFResolution is set through the r.AOGlobalDFResolution console variable, allowing for runtime modification.

GAOGlobalDFResolution interacts directly with r.AOGlobalDFResolution, serving as the actual storage for the resolution value.

Developers should be aware that modifying GAOGlobalDFResolution directly in code might lead to inconsistencies with the console variable system. It’s best to use the r.AOGlobalDFResolution console variable for changes.

Best practices for GAOGlobalDFResolution include:

  1. Avoid modifying it directly in code; use the console variable system instead.
  2. When reading its value, consider that it might have been changed at runtime through the console.
  3. Be aware of its usage in performance-critical sections of the rendering pipeline and optimize accordingly.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GAOGlobalDFResolution = 128;
FAutoConsoleVariableRef CVarAOGlobalDFResolution(
	TEXT("r.AOGlobalDFResolution"),
	GAOGlobalDFResolution,
	TEXT("Resolution of the global distance field.  Higher values increase fidelity but also increase memory and composition cost."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GAOGlobalDFStartDistance = 100;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

int32 GAOGlobalDFResolution = 128;
FAutoConsoleVariableRef CVarAOGlobalDFResolution(
	TEXT("r.AOGlobalDFResolution"),
	GAOGlobalDFResolution,
	TEXT("Resolution of the global distance field.  Higher values increase fidelity but also increase memory and composition cost."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

float GAOGlobalDFStartDistance = 100;
FAutoConsoleVariableRef CVarAOGlobalDFStartDistance(

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

Scope (from outer to inner):

file
function     int32 GlobalDistanceField::GetClipmapResolution

Source code excerpt:

int32 GlobalDistanceField::GetClipmapResolution(bool bLumenEnabled)
{
	int32 DFResolution = GAOGlobalDFResolution;

	if (bLumenEnabled)
	{
		DFResolution = Lumen::GetGlobalDFResolution();
	}