r.Mobile.AmbientOcclusionQuality
r.Mobile.AmbientOcclusionQuality
#Overview
name: r.Mobile.AmbientOcclusionQuality
The value of this variable can be defined or overridden in .ini config files. 19
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The quality of screen space ambient occlusion on mobile platform.\n0: Disabled.\n1: Low.(Default)\n2: Medium.\n3: High.\n
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.AmbientOcclusionQuality is to control the quality of screen space ambient occlusion (SSAO) on mobile platforms in Unreal Engine 5. This setting variable is specifically designed for the rendering system, particularly for the mobile rendering pipeline.
The Unreal Engine subsystem that relies on this setting variable is the mobile rendering module, specifically the post-processing system for ambient occlusion. This can be seen from the file location “PostProcessAmbientOcclusionMobile.cpp”.
The value of this variable is set through the console variable system. It’s initialized with a default value of 1 (Low quality) but can be changed at runtime.
This variable interacts with other parts of the mobile rendering system, particularly the GTAO (Ground Truth Ambient Occlusion) implementation for mobile platforms. It’s used in conjunction with other variables like CVarMobileGTAOPreIntegratedTextureType to determine the final rendering quality and approach.
Developers must be aware that this variable has four possible values: 0: Disabled 1: Low (Default) 2: Medium 3: High Using values outside this range will be clamped to the nearest valid value.
Best practices when using this variable include:
- Consider the performance implications of higher quality settings on mobile devices.
- Use in conjunction with other mobile rendering settings for a balanced approach to visual quality and performance.
- Test thoroughly on target mobile devices to ensure acceptable performance at each quality level.
Regarding the associated variable CVarMobileAmbientOcclusionQuality: This is the actual TAutoConsoleVariable that stores the value of r.Mobile.AmbientOcclusionQuality. It’s used internally by the engine to access and modify the ambient occlusion quality setting. The purpose and usage are the same as r.Mobile.AmbientOcclusionQuality, but this is the actual variable that the engine code interacts with directly.
Developers should be aware that while they can set r.Mobile.AmbientOcclusionQuality through console commands or config files, the engine code will be reading from and writing to CVarMobileAmbientOcclusionQuality. This structure allows for a consistent interface for both external (developer) and internal (engine) usage of the setting.
#Setting Variables
#References In INI files
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:330, section: [iPhone6S DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:341, section: [iPhone6SPlus DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:350, section: [iPhoneSE DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:358, section: [iPhone7 DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:366, section: [iPhone7Plus DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:375, section: [iPhone8 DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:384, section: [iPhone8Plus DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:520, section: [iPodTouch7 DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:530, section: [iPadAir2 DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:538, section: [iPadMini4 DeviceProfile]
<Workspace>/Engine/Config/BaseDeviceProfiles.ini:685, section: [AppleTV DeviceProfile]
<Workspace>/Engine/Config/Android/AndroidScalability.ini:94, section: [PostProcessQuality@0]
<Workspace>/Engine/Config/Android/AndroidScalability.ini:104, section: [PostProcessQuality@1]
<Workspace>/Engine/Config/Android/AndroidScalability.ini:114, section: [PostProcessQuality@2]
<Workspace>/Engine/Config/Android/AndroidScalability.ini:124, section: [PostProcessQuality@3]
<Workspace>/Engine/Config/IOS/IOSScalability.ini:94, section: [PostProcessQuality@0]
<Workspace>/Engine/Config/IOS/IOSScalability.ini:104, section: [PostProcessQuality@1]
<Workspace>/Engine/Config/IOS/IOSScalability.ini:114, section: [PostProcessQuality@2]
<Workspace>/Engine/Config/IOS/IOSScalability.ini:124, section: [PostProcessQuality@3]
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:46
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileAmbientOcclusionQuality(
TEXT("r.Mobile.AmbientOcclusionQuality"),
1,
TEXT("The quality of screen space ambient occlusion on mobile platform.\n")
TEXT("0: Disabled.\n")
TEXT("1: Low.(Default)\n")
TEXT("2: Medium.\n")
TEXT("3: High.\n"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:89
Scope (from outer to inner):
file
function bool IsUsingMobileAmbientOcclusion
Source code excerpt:
bool IsUsingMobileAmbientOcclusion(EShaderPlatform ShaderPlatform)
{
static const auto MobileAmbientOcclusionQualityCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AmbientOcclusionQuality"));
return IsMobileAmbientOcclusionEnabled(ShaderPlatform) && MobileAmbientOcclusionQualityCVar->GetValueOnAnyThread() > 0;
}
// --------------------------------------------------------------------------------------------------------------------
class FGTAOMobile_HorizonSearchIntegral : public FGlobalShader
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileAmbientOcclusionQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:45
Scope: file
Source code excerpt:
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarMobileAmbientOcclusionQuality(
TEXT("r.Mobile.AmbientOcclusionQuality"),
1,
TEXT("The quality of screen space ambient occlusion on mobile platform.\n")
TEXT("0: Disabled.\n")
TEXT("1: Low.(Default)\n")
TEXT("2: Medium.\n")
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:468
Scope (from outer to inner):
file
function static void RenderGTAO
Source code excerpt:
const int32 MobileGTAOPreIntegratedTextureType = FMath::Min(CVarMobileGTAOPreIntegratedTextureType.GetValueOnRenderThread(), 2);
const int32 MobileAmbientOcclusionQuality = FMath::Min(CVarMobileAmbientOcclusionQuality.GetValueOnRenderThread(), 3);
FRDGTextureUAVRef AmbientOcclusionTextureUAV = GraphBuilder.CreateUAV(AmbientOcclusionTexture);
const FIntPoint& DepthBufferSize = SceneDepthTexture->Desc.Extent;
const FIntPoint& BufferSize = AmbientOcclusionTexture->Desc.Extent;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:931
Scope (from outer to inner):
file
function static void AddMobileAmbientOcclusionPass
Source code excerpt:
}
const int32 MobileAmbientOcclusionQuality = FMath::Min(CVarMobileAmbientOcclusionQuality.GetValueOnRenderThread(), 3) - 1;
FMobileAmbientOcclusionPS::FPermutationDomain PermutationVector;
PermutationVector.Set<FMobileAmbientOcclusionPS::FShaderQualityDim>(MobileAmbientOcclusionQuality);
PermutationVector.Set<FMobileAmbientOcclusionPS::FOutputDepth>(bOutputDepth);
TShaderMapRef<FMobileAmbientOcclusionPS> PixelShader(View.ShaderMap, PermutationVector);
TShaderMapRef<FScreenPassVS> VertexShader(View.ShaderMap);