r.AOGlobalDFClipmapDistanceExponent
r.AOGlobalDFClipmapDistanceExponent
#Overview
name: r.AOGlobalDFClipmapDistanceExponent
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Exponent used to derive each clipmap\'s size, together with r.AOInnerGlobalDFClipmapDistance.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AOGlobalDFClipmapDistanceExponent is to control the exponent used in calculating the size of each clipmap in the Global Distance Field system, which is part of Unreal Engine’s rendering system, specifically for Ambient Occlusion (AO) calculations.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the Global Distance Field subsystem. It’s referenced in the GlobalDistanceField.cpp file, which suggests it’s crucial for the Global Distance Field calculations.
The value of this variable is set through the Unreal Engine console system, as evidenced by the FAutoConsoleVariableRef declaration. This allows developers to modify the value at runtime or through configuration files.
The associated variable GAOGlobalDFClipmapDistanceExponent directly interacts with r.AOGlobalDFClipmapDistanceExponent, sharing the same value. This C++ variable is used in actual calculations within the engine code.
Developers should be aware that this variable affects the scaling of clipmap sizes in the Global Distance Field. Changing this value will impact the distribution of detail across different distance ranges in the Ambient Occlusion calculations. A higher exponent will result in a more rapid increase in clipmap sizes as you move further from the camera.
Best practices when using this variable include:
- Carefully consider the performance implications of modifying this value, as it affects the memory usage and processing requirements of the Global Distance Field system.
- Test changes thoroughly across different scene scales to ensure desired visual quality is maintained.
- Consider this variable in conjunction with r.AOInnerGlobalDFClipmapDistance for fine-tuning the Global Distance Field behavior.
Regarding the associated variable GAOGlobalDFClipmapDistanceExponent:
The purpose of GAOGlobalDFClipmapDistanceExponent is to store the actual value used in the engine’s calculations for the Global Distance Field clipmap sizing.
This variable is used directly in the Renderer module, specifically in the GlobalDistanceField.cpp file. It’s used in the GetClipmapExtent function to calculate the extent of each clipmap.
The value of GAOGlobalDFClipmapDistanceExponent is set by the console variable system through r.AOGlobalDFClipmapDistanceExponent.
GAOGlobalDFClipmapDistanceExponent interacts directly with the Scene’s GlobalDistanceFieldViewDistance in the clipmap extent calculations.
Developers should be aware that modifying GAOGlobalDFClipmapDistanceExponent directly in code is not recommended, as its value is controlled by the console variable system.
Best practices include using the r.AOGlobalDFClipmapDistanceExponent console variable to modify this value rather than changing the C++ variable directly, ensuring that all systems relying on this value remain in sync.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:111
Scope: file
Source code excerpt:
float GAOGlobalDFClipmapDistanceExponent = 2;
FAutoConsoleVariableRef CVarAOGlobalDFClipmapDistanceExponent(
TEXT("r.AOGlobalDFClipmapDistanceExponent"),
GAOGlobalDFClipmapDistanceExponent,
TEXT("Exponent used to derive each clipmap's size, together with r.AOInnerGlobalDFClipmapDistance."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GAOGlobalDFResolution = 128;
#Associated Variable and Callsites
This variable is associated with another variable named GAOGlobalDFClipmapDistanceExponent
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:109
Scope: file
Source code excerpt:
);
float GAOGlobalDFClipmapDistanceExponent = 2;
FAutoConsoleVariableRef CVarAOGlobalDFClipmapDistanceExponent(
TEXT("r.AOGlobalDFClipmapDistanceExponent"),
GAOGlobalDFClipmapDistanceExponent,
TEXT("Exponent used to derive each clipmap's size, together with r.AOInnerGlobalDFClipmapDistance."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GAOGlobalDFResolution = 128;
FAutoConsoleVariableRef CVarAOGlobalDFResolution(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:446
Scope (from outer to inner):
file
function float GlobalDistanceField::GetClipmapExtent
Source code excerpt:
else
{
const float InnerClipmapDistance = Scene->GlobalDistanceFieldViewDistance / FMath::Pow(GAOGlobalDFClipmapDistanceExponent, 3);
return InnerClipmapDistance * FMath::Pow(GAOGlobalDFClipmapDistanceExponent, ClipmapIndex);
}
}
uint32 GlobalDistanceField::GetPageTableClipmapResolution(bool bLumenEnabled)
{
return FMath::DivideAndRoundUp(GlobalDistanceField::GetClipmapResolution(bLumenEnabled), GGlobalDistanceFieldPageResolution);