r.AmbientOcclusion.FadeRadiusScale
r.AmbientOcclusion.FadeRadiusScale
#Overview
name: r.AmbientOcclusion.FadeRadiusScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to scale the ambient occlusion fade radius (SSAO).\n 0.01:smallest .. 1.0:normal (default), <1:smaller, >1:larger
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AmbientOcclusion.FadeRadiusScale is to control the scaling of the ambient occlusion fade radius in the Screen Space Ambient Occlusion (SSAO) effect. This setting variable is part of the rendering system in Unreal Engine 5, specifically affecting the post-processing and ambient occlusion components.
Based on the details in the Callsites section, this setting variable is primarily used in the Engine module, particularly within the SceneView system. It’s referenced in the SceneView.cpp file, which is responsible for handling scene view settings and post-processing effects.
The value of this variable is set as a console variable (CVar) with a default value of 1.0f. It can be modified at runtime through the console or programmatically.
The associated variable CVarSSAOFadeRadiusScale interacts directly with r.AmbientOcclusion.FadeRadiusScale. They share the same value and purpose.
Developers must be aware of the following when using this variable:
- The valid range is from 0.01 (smallest) to any value larger than 1.0 (larger than normal).
- Values less than 1.0 will result in a smaller fade radius, while values greater than 1.0 will produce a larger fade radius.
- This variable is marked with ECVF_Cheat and ECVF_RenderThreadSafe flags, indicating it’s intended for development/debugging and is safe to modify from the render thread.
Best practices when using this variable include:
- Use it for fine-tuning the appearance of ambient occlusion in your scenes.
- Be cautious when setting extreme values, as they may produce unrealistic results.
- Test the visual impact thoroughly across different scenes and lighting conditions.
Regarding the associated variable CVarSSAOFadeRadiusScale:
- Its purpose is identical to r.AmbientOcclusion.FadeRadiusScale, serving as the internal representation of the console variable.
- It’s used within the FSceneView::EndFinalPostprocessSettings function to apply the scaling to the AmbientOcclusionDistance_DEPRECATED setting.
- The value is clamped between 0.01f and 50.0f for safety.
- Developers should be aware that modifying CVarSSAOFadeRadiusScale directly will have the same effect as changing r.AmbientOcclusion.FadeRadiusScale through the console.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:121
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSSAOFadeRadiusScale(
TEXT("r.AmbientOcclusion.FadeRadiusScale"),
1.0f,
TEXT("Allows to scale the ambient occlusion fade radius (SSAO).\n")
TEXT(" 0.01:smallest .. 1.0:normal (default), <1:smaller, >1:larger"),
ECVF_Cheat | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarExposureOffset(
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSAOFadeRadiusScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:120
Scope: file
Source code excerpt:
#endif
static TAutoConsoleVariable<float> CVarSSAOFadeRadiusScale(
TEXT("r.AmbientOcclusion.FadeRadiusScale"),
1.0f,
TEXT("Allows to scale the ambient occlusion fade radius (SSAO).\n")
TEXT(" 0.01:smallest .. 1.0:normal (default), <1:smaller, >1:larger"),
ECVF_Cheat | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:2215
Scope (from outer to inner):
file
function void FSceneView::EndFinalPostprocessSettings
Source code excerpt:
{
float Scale = FMath::Clamp(CVarSSAOFadeRadiusScale.GetValueOnGameThread(), 0.01f, 50.0f);
FinalPostProcessSettings.AmbientOcclusionDistance_DEPRECATED *= Scale;
}
{
float Value = FMath::Clamp(CVarMotionBlurScale.GetValueOnGameThread(), 0.0f, 50.0f);