r.AOGlobalDistanceFieldRepresentHeightfields
r.AOGlobalDistanceFieldRepresentHeightfields
#Overview
name: r.AOGlobalDistanceFieldRepresentHeightfields
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to put landscape in the global distance field. Changing this won\'t propagate until the global distance field gets recached (fly away and back).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AOGlobalDistanceFieldRepresentHeightfields is to control whether landscapes are included in the global distance field for ambient occlusion calculations in Unreal Engine’s rendering system.
This setting variable is primarily used by the rendering subsystem, specifically the global distance field and ambient occlusion components. It’s part of the Renderer module in Unreal Engine.
The value of this variable is set using a console variable (cvar) system. It’s initialized to 1 (true) by default, but can be changed at runtime through console commands or configuration files.
The associated variable GAOGlobalDistanceFieldRepresentHeightfields directly interacts with it. This is an integer variable that holds the actual value used in the code.
Developers should be aware that changes to this variable won’t take effect immediately. As the description states, “Changing this won’t propagate until the global distance field gets recached (fly away and back).” This means that after changing the value, the global distance field needs to be regenerated for the changes to be visible.
Best practices when using this variable include:
- Consider performance implications when enabling this feature, as including landscapes in the global distance field can increase computational load.
- Be prepared to trigger a global distance field recache when changing this value during development or debugging.
- Use this in conjunction with other global distance field and ambient occlusion settings for optimal results.
Regarding the associated variable GAOGlobalDistanceFieldRepresentHeightfields:
The purpose of GAOGlobalDistanceFieldRepresentHeightfields is to store the actual value used by the engine when determining whether to include landscapes in the global distance field.
This variable is used directly in the Renderer module, specifically in the global distance field generation code.
The value of this variable is set by the console variable system, mirroring the value of r.AOGlobalDistanceFieldRepresentHeightfields.
It interacts directly with the console variable r.AOGlobalDistanceFieldRepresentHeightfields, effectively serving as the internal representation of that setting.
Developers should be aware that this is the actual variable checked in the code when determining whether to include landscapes in the global distance field. Any runtime changes to the console variable will be reflected in this variable.
Best practices for this variable include:
- Don’t modify this variable directly in code; instead, use the console variable system to change its value.
- When reading this value in code, be aware that it can change at runtime if the console variable is modified.
- Consider the performance implications of including landscapes in the global distance field when this variable is set to 1.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:136
Scope: file
Source code excerpt:
int32 GAOGlobalDistanceFieldRepresentHeightfields = 1;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldRepresentHeightfields(
TEXT("r.AOGlobalDistanceFieldRepresentHeightfields"),
GAOGlobalDistanceFieldRepresentHeightfields,
TEXT("Whether to put landscape in the global distance field. Changing this won't propagate until the global distance field gets recached (fly away and back)."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GGlobalDistanceFieldHeightFieldThicknessScale = 4.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GAOGlobalDistanceFieldRepresentHeightfields
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:134
Scope: file
Source code excerpt:
);
int32 GAOGlobalDistanceFieldRepresentHeightfields = 1;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldRepresentHeightfields(
TEXT("r.AOGlobalDistanceFieldRepresentHeightfields"),
GAOGlobalDistanceFieldRepresentHeightfields,
TEXT("Whether to put landscape in the global distance field. Changing this won't propagate until the global distance field gets recached (fly away and back)."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GGlobalDistanceFieldHeightFieldThicknessScale = 4.0f;
FAutoConsoleVariableRef CVarGlobalDistanceFieldHeightFieldThicknessScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:2269
Scope: file
Source code excerpt:
if ((CacheType == GDF_MostlyStatic || !GAOGlobalDistanceFieldCacheMostlyStaticSeparately)
&& NumHeightfieldPrimitives > 0
&& GAOGlobalDistanceFieldRepresentHeightfields
&& !IsVulkanMobileSM5Platform(Scene->GetShaderPlatform()))
{
for (int32 HeightfieldPrimitiveIndex = 0; HeightfieldPrimitiveIndex < NumHeightfieldPrimitives; HeightfieldPrimitiveIndex++)
{
const FPrimitiveSceneInfo* HeightfieldPrimitiveSceneInfo = Scene->DistanceFieldSceneData.HeightfieldPrimitives[HeightfieldPrimitiveIndex];
const FPrimitiveSceneProxy* HeightfieldPrimitiveProxy = HeightfieldPrimitiveSceneInfo->Proxy;