r.GTAO.FalloffEnd
r.GTAO.FalloffEnd
#Overview
name: r.GTAO.FalloffEnd
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Distance at when the occlusion completes the fall off. \n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.GTAO.FalloffEnd is to control the distance at which the occlusion effect in Ground Truth Ambient Occlusion (GTAO) completes its fall off. This setting variable is part of the rendering system, specifically for ambient occlusion calculations.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly in the ambient occlusion post-processing components. It’s referenced in both the standard and mobile versions of the GTAO implementation.
The value of this variable is set as a console variable with a default value of 200.0f. It can be modified at runtime through the console or programmatically.
The r.GTAO.FalloffEnd variable interacts with another variable called r.GTAO.FalloffStartRatio. Together, these variables define the start and end distances of the occlusion fall off effect.
Developers should be aware that this variable directly affects the visual quality and performance of the GTAO effect. A larger value will extend the distance at which occlusion is calculated, potentially improving visual quality at the cost of performance.
Best practices when using this variable include:
- Adjusting it in conjunction with r.GTAO.FalloffStartRatio for balanced results.
- Testing different values to find the optimal balance between visual quality and performance for your specific scene.
- Consider scaling this value based on the overall scale of your environments.
Regarding the associated variable CVarGTAOFalloffEnd:
The purpose of CVarGTAOFalloffEnd is to serve as the internal console variable representation of r.GTAO.FalloffEnd. It’s used within the engine’s C++ code to access and modify the fall off end distance.
This variable is part of the rendering system, specifically the GTAO implementation in the Renderer module.
The value of CVarGTAOFalloffEnd is set when the r.GTAO.FalloffEnd console variable is initialized or modified.
CVarGTAOFalloffEnd interacts directly with other GTAO-related variables in the implementation, such as CVarGTAOFalloffStartRatio.
Developers should be aware that modifying CVarGTAOFalloffEnd directly in C++ code will affect the GTAO calculations. It’s generally preferable to modify the r.GTAO.FalloffEnd console variable instead, unless you’re working directly on the GTAO implementation.
Best practices for using CVarGTAOFalloffEnd include:
- Accessing its value using GetValueOnRenderThread() to ensure thread-safe operations.
- Using it in conjunction with other GTAO variables for consistent results.
- Considering performance implications when modifying its value, especially in performance-critical sections of code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessAmbientOcclusion.cpp:121
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarGTAOFalloffEnd(
TEXT("r.GTAO.FalloffEnd"),
200.0f,
TEXT("Distance at when the occlusion completes the fall off. \n "),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarGTAOFalloffStartRatio(
TEXT("r.GTAO.FalloffStartRatio"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:463
Scope (from outer to inner):
file
function static void RenderGTAO
Source code excerpt:
static const auto GTAOThicknessBlendCVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.GTAO.ThicknessBlend"));
static const auto GTAOFalloffStartRatioCVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.GTAO.FalloffStartRatio"));
static const auto GTAOFalloffEndCVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.GTAO.FalloffEnd"));
static const auto GTAONumAnglesCVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.GTAO.NumAngles"));
const uint32 DownsampleFactor = 2;
const int32 MobileGTAOPreIntegratedTextureType = FMath::Min(CVarMobileGTAOPreIntegratedTextureType.GetValueOnRenderThread(), 2);
const int32 MobileAmbientOcclusionQuality = FMath::Min(CVarMobileAmbientOcclusionQuality.GetValueOnRenderThread(), 3);
#Associated Variable and Callsites
This variable is associated with another variable named CVarGTAOFalloffEnd
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessAmbientOcclusion.cpp:120
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarGTAOFalloffEnd(
TEXT("r.GTAO.FalloffEnd"),
200.0f,
TEXT("Distance at when the occlusion completes the fall off. \n "),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarGTAOFalloffStartRatio(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessAmbientOcclusion.cpp:445
Scope: file
Source code excerpt:
// Fall Off Params
float FallOffEnd = CVarGTAOFalloffEnd.GetValueOnRenderThread();
float FallOffStartRatio = FMath::Clamp(CVarGTAOFalloffStartRatio.GetValueOnRenderThread(), 0.0f, 0.999f);
float FallOffStart = FallOffEnd * FallOffStartRatio;
float FallOffStartSq = FallOffStart * FallOffStart;
float FallOffEndSq = FallOffEnd * FallOffEnd;
float FallOffScale = 1.0f / (FallOffEndSq - FallOffStartSq);