r.AOJitterConeDirections
r.AOJitterConeDirections
#Overview
name: r.AOJitterConeDirections
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.AOJitterConeDirections is to control the jittering of cone directions in the Ambient Occlusion (AO) system of Unreal Engine 5’s rendering pipeline. This setting is part of the Distance Field Ambient Occlusion (DFAO) feature.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the Distance Field Ambient Occlusion subsystem. Based on the callsites, it’s implemented in the DistanceFieldAmbientOcclusion.cpp file.
The value of this variable is set through the Unreal Engine console variable system. It’s declared as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.
The r.AOJitterConeDirections variable interacts directly with its associated C++ variable GAOJitterConeDirections. They share the same value, and GAOJitterConeDirections is used in the actual rendering code.
Developers should be aware that this variable is a boolean (int32 used as a boolean), where 0 means off and any non-zero value means on. When enabled, it introduces randomization to the cone sampling directions used in the ambient occlusion calculations, which can help reduce artifacts in the final rendering.
Best practices when using this variable include:
- Use it to improve the visual quality of ambient occlusion, especially if you notice banding or other artifacts.
- Be aware that enabling this feature may have a small performance cost.
- Test the visual impact and performance with this feature both on and off to determine the best setting for your specific project.
Regarding the associated variable GAOJitterConeDirections:
The purpose of GAOJitterConeDirections is to provide a C++ accessible version of the r.AOJitterConeDirections console variable. It’s used directly in the rendering code to determine whether to apply jittering to the cone directions.
This variable is used in the same Renderer module and DFAO subsystem as r.AOJitterConeDirections. It’s checked in the GetSpacedVectors function, which is likely part of the core DFAO algorithm.
The value of GAOJitterConeDirections is set automatically by the console variable system when r.AOJitterConeDirections is modified.
GAOJitterConeDirections interacts directly with r.AOJitterConeDirections, and it’s used in conditional statements to enable or disable the jittering behavior.
Developers should be aware that modifying GAOJitterConeDirections directly in C++ code is not recommended, as it may be overwritten by the console variable system. Instead, they should modify r.AOJitterConeDirections through the appropriate console or configuration interfaces.
Best practices for GAOJitterConeDirections include:
- Treat it as a read-only variable in C++ code.
- Use it for conditional logic in rendering code related to AO cone direction jittering.
- Remember that its value reflects the current state of the r.AOJitterConeDirections setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:107
Scope: file
Source code excerpt:
int32 GAOJitterConeDirections = 0;
FAutoConsoleVariableRef CVarAOJitterConeDirections(
TEXT("r.AOJitterConeDirections"),
GAOJitterConeDirections,
TEXT(""),
ECVF_RenderThreadSafe
);
int32 GAOObjectDistanceField = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GAOJitterConeDirections
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:105
Scope: file
Source code excerpt:
);
int32 GAOJitterConeDirections = 0;
FAutoConsoleVariableRef CVarAOJitterConeDirections(
TEXT("r.AOJitterConeDirections"),
GAOJitterConeDirections,
TEXT(""),
ECVF_RenderThreadSafe
);
int32 GAOObjectDistanceField = 1;
FAutoConsoleVariableRef CVarAOObjectDistanceField(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:237
Scope (from outer to inner):
file
function void GetSpacedVectors
Source code excerpt:
}
if (GAOJitterConeDirections)
{
float RandomAngle = TemporalHalton2(FrameNumber & 1023, 2) * 2 * PI;
float CosRandomAngle = FMath::Cos(RandomAngle);
float SinRandomAngle = FMath::Sin(RandomAngle);
for (int32 i = 0; i < OutVectors.Num(); i++)