r.AmbientOcclusionMaxQuality
r.AmbientOcclusionMaxQuality
#Overview
name: r.AmbientOcclusionMaxQuality
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Defines the max clamping value from the post process volume\'s quality level for ScreenSpace Ambient Occlusion\n 100: don\'t override quality level from the post process volume (default)\n 0..99: clamp down quality level from the post process volume to the maximum set by this cvar\n -100..0: Enforces a different quality (the absolute value) even if the postprocessvolume asks for a lower quality.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AmbientOcclusionMaxQuality is to control the quality level of Screen Space Ambient Occlusion (SSAO) in Unreal Engine’s rendering system. It allows developers to fine-tune the balance between visual quality and performance for ambient occlusion effects.
This setting variable is primarily used by the rendering subsystem, specifically within the post-processing and composition lighting modules of Unreal Engine.
The value of this variable is set through a console variable (CVar) named CVarAmbientOcclusionMaxQuality. It’s initialized with a default value of 100.0f, which means it doesn’t override the quality level set by post-process volumes by default.
The associated variable CVarAmbientOcclusionMaxQuality interacts directly with r.AmbientOcclusionMaxQuality, as they share the same value and purpose.
Developers must be aware of the following when using this variable:
-
The value range and its effects:
- 100: Default value, doesn’t override post-process volume settings
- 0 to 99: Clamps the quality level from post-process volumes to this maximum
- -100 to 0: Enforces a specific quality level (absolute value) even if post-process volumes request lower quality
-
It affects performance and visual quality, so careful tuning is necessary.
-
The variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating it’s used for scalability purposes and is safe to modify on the render thread.
Best practices when using this variable include:
- Use it to optimize performance on lower-end hardware by setting a lower maximum quality.
- Experiment with different values to find the optimal balance between visual quality and performance for your specific game or application.
- Consider exposing this setting to end-users as a graphics option for performance tuning.
- Be cautious when using negative values, as they can override artist-defined settings in post-process volumes.
Regarding the associated variable CVarAmbientOcclusionMaxQuality:
- It’s a TAutoConsoleVariable
that directly controls the r.AmbientOcclusionMaxQuality setting. - It’s used in the FSSAOHelper::GetAmbientOcclusionQualityRT function to determine the actual quality level for ambient occlusion.
- When using this variable in code, developers should use the GetValueOnRenderThread() method to ensure thread-safe access to its value.
- The same considerations and best practices apply to this variable as they do to r.AmbientOcclusionMaxQuality.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:392, section: [PostProcessQuality@0]
- INI Section:
PostProcessQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:412, section: [PostProcessQuality@1]
- INI Section:
PostProcessQuality@1
- Raw value:
60
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:445, section: [PostProcessQuality@2]
- INI Section:
PostProcessQuality@2
- Raw value:
100
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:480, section: [PostProcessQuality@3]
- INI Section:
PostProcessQuality@3
- Raw value:
100
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:517, section: [PostProcessQuality@Cine]
- INI Section:
PostProcessQuality@Cine
- Raw value:
100
- Is Array:
False
#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:40
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarAmbientOcclusionMaxQuality(
TEXT("r.AmbientOcclusionMaxQuality"),
100.0f,
TEXT("Defines the max clamping value from the post process volume's quality level for ScreenSpace Ambient Occlusion\n")
TEXT(" 100: don't override quality level from the post process volume (default)\n")
TEXT(" 0..99: clamp down quality level from the post process volume to the maximum set by this cvar\n")
TEXT(" -100..0: Enforces a different quality (the absolute value) even if the postprocessvolume asks for a lower quality."),
ECVF_Scalability | ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarAmbientOcclusionMaxQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessAmbientOcclusion.cpp:39
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarAmbientOcclusionMaxQuality(
TEXT("r.AmbientOcclusionMaxQuality"),
100.0f,
TEXT("Defines the max clamping value from the post process volume's quality level for ScreenSpace Ambient Occlusion\n")
TEXT(" 100: don't override quality level from the post process volume (default)\n")
TEXT(" 0..99: clamp down quality level from the post process volume to the maximum set by this cvar\n")
TEXT(" -100..0: Enforces a different quality (the absolute value) even if the postprocessvolume asks for a lower quality."),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessAmbientOcclusion.cpp:157
Scope (from outer to inner):
file
function float FSSAOHelper::GetAmbientOcclusionQualityRT
Source code excerpt:
float FSSAOHelper::GetAmbientOcclusionQualityRT(const FSceneView& View)
{
float CVarValue = CVarAmbientOcclusionMaxQuality.GetValueOnRenderThread();
if (CVarValue < 0)
{
return FMath::Clamp(-CVarValue, 0.0f, 100.0f);
}
else