r.AOHistoryStabilityPass
r.AOHistoryStabilityPass
#Overview
name: r.AOHistoryStabilityPass
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to gather stable results to fill in holes in the temporal reprojection. Adds some GPU cost but improves temporal stability with foliage.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AOHistoryStabilityPass is to control whether a stability pass is performed for Ambient Occlusion (AO) history in the rendering pipeline. This setting is part of the rendering system, specifically related to Distance Field Ambient Occlusion (DFAO) post-processing.
This setting variable is primarily used in the Renderer module of Unreal Engine, as evident from its location in the DistanceFieldLightingPost.cpp file.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands.
The r.AOHistoryStabilityPass variable interacts with another variable, GDistanceFieldAOQuality, in the UseAOHistoryStabilityPass() function. This function returns true only if both GAOHistoryStabilityPass is set and GDistanceFieldAOQuality is 2 or higher.
Developers should be aware that enabling this pass adds some GPU cost but improves temporal stability, especially with foliage. It’s a trade-off between performance and visual quality.
Best practices when using this variable include:
- Consider the performance impact on your target hardware.
- Test the visual difference with and without this pass enabled, especially in scenes with a lot of foliage.
- Ensure GDistanceFieldAOQuality is set to 2 or higher if you want this pass to take effect.
Regarding the associated variable GAOHistoryStabilityPass:
The purpose of GAOHistoryStabilityPass is to serve as the internal representation of the r.AOHistoryStabilityPass console variable. It’s an integer variable that directly controls whether the AO history stability pass is performed.
This variable is used in the Renderer module, specifically in the Distance Field Lighting post-processing code.
The value of GAOHistoryStabilityPass is set by the console variable system when r.AOHistoryStabilityPass is modified.
GAOHistoryStabilityPass interacts with GDistanceFieldAOQuality in the UseAOHistoryStabilityPass() function to determine if the stability pass should be performed.
Developers should be aware that this is an internal variable and should generally be modified through the r.AOHistoryStabilityPass console variable rather than directly.
Best practices for GAOHistoryStabilityPass include:
- Avoid modifying this variable directly in code; use the console variable system instead.
- When reading this variable’s value, consider using the UseAOHistoryStabilityPass() function, which takes into account both this variable and the AO quality setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldLightingPost.cpp:32
Scope: file
Source code excerpt:
int32 GAOHistoryStabilityPass = 1;
FAutoConsoleVariableRef CVarAOHistoryStabilityPass(
TEXT("r.AOHistoryStabilityPass"),
GAOHistoryStabilityPass,
TEXT("Whether to gather stable results to fill in holes in the temporal reprojection. Adds some GPU cost but improves temporal stability with foliage."),
ECVF_RenderThreadSafe
);
float GAOHistoryWeight = .85f;
#Associated Variable and Callsites
This variable is associated with another variable named GAOHistoryStabilityPass
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldLightingPost.cpp:30
Scope: file
Source code excerpt:
);
int32 GAOHistoryStabilityPass = 1;
FAutoConsoleVariableRef CVarAOHistoryStabilityPass(
TEXT("r.AOHistoryStabilityPass"),
GAOHistoryStabilityPass,
TEXT("Whether to gather stable results to fill in holes in the temporal reprojection. Adds some GPU cost but improves temporal stability with foliage."),
ECVF_RenderThreadSafe
);
float GAOHistoryWeight = .85f;
FAutoConsoleVariableRef CVarAOHistoryWeight(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldLightingPost.cpp:65
Scope (from outer to inner):
file
function bool UseAOHistoryStabilityPass
Source code excerpt:
{
extern int32 GDistanceFieldAOQuality;
return GAOHistoryStabilityPass && GDistanceFieldAOQuality >= 2;
}
bool ShouldCompileDFLightingPostShaders(EShaderPlatform ShaderPlatform)
{
return ShouldCompileDistanceFieldShaders(ShaderPlatform) && !IsMobilePlatform(ShaderPlatform);
}