r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay
r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay
#Overview
name: r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay is to control the decay rate of the camera position velocity offset in the Ambient Occlusion (AO) Global Distance Field system. This setting is part of Unreal Engine’s rendering system, specifically related to global illumination and ambient occlusion calculations.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, as evidenced by its location in the GlobalDistanceField.cpp file within the Runtime/Renderer/Private directory.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. The initial value is set to 0.7f.
The associated variable GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay directly interacts with this console variable. They share the same value, with the console variable acting as an interface for adjusting the value of the C++ variable.
Developers should be aware that this variable affects the calculation of camera velocity offset in the global distance field system. It’s used in a framerate-independent decay calculation, which means changes to this value will affect how quickly the camera velocity offset decays over time.
Best practices when using this variable include:
- Adjusting it carefully, as it can impact the visual quality and performance of ambient occlusion and global illumination.
- Testing different values to find the right balance between visual quality and performance for your specific use case.
- Considering the impact on different hardware configurations, as this setting is marked with ECVF_Scalability.
Regarding the associated variable GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay:
This C++ variable is the actual storage for the decay value. It’s used directly in the rendering code, specifically in the UpdateGlobalDistanceFieldViewOrigin function. The purpose of this variable is to provide a quick access point for the decay value in the C++ code, while allowing it to be modified through the console variable system.
Developers should note that modifying this variable directly in C++ code is not recommended, as it would bypass the console variable system. Instead, they should use the console variable r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay to adjust the value, which will automatically update GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:168
Scope: file
Source code excerpt:
float GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay = .7f;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay(
TEXT("r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay"),
GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GAOGlobalDistanceFieldFastCameraMode = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:166
Scope: file
Source code excerpt:
);
float GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay = .7f;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay(
TEXT("r.AOGlobalDistanceField.CameraPositionVelocityOffsetDecay"),
GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay,
TEXT(""),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GAOGlobalDistanceFieldFastCameraMode = 0;
FAutoConsoleVariableRef CVarAOGlobalDistanceFieldFastCameraMode(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:725
Scope (from outer to inner):
file
function static void UpdateGlobalDistanceFieldViewOrigin
Source code excerpt:
const FVector CameraVelocity = View.ViewMatrices.GetViewOrigin() - View.PrevViewInfo.ViewMatrices.GetViewOrigin();
// Framerate independent decay
CameraVelocityOffset = CameraVelocityOffset * FMath::Pow(GAOGlobalDistanceFieldCameraPositionVelocityOffsetDecay, View.Family->Time.GetDeltaWorldTimeSeconds()) + CameraVelocity;
const FScene* Scene = (const FScene*)View.Family->Scene;
const int32 NumClipmaps = GlobalDistanceField::GetNumGlobalDistanceFieldClipmaps(bLumenEnabled, View.FinalPostProcessSettings.LumenSceneViewDistance);
if (Scene && NumClipmaps > 0)
{