r.Mobile.GTAOPreIntegratedTextureType
r.Mobile.GTAOPreIntegratedTextureType
#Overview
name: r.Mobile.GTAOPreIntegratedTextureType
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: No Texture.\n1: Texture2D LUT.\n2: Volume LUT(Default).
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.GTAOPreIntegratedTextureType is to control the type of pre-integrated texture used for Ground Truth Ambient Occlusion (GTAO) in mobile rendering. This setting variable is primarily used in the rendering system, specifically for mobile ambient occlusion calculations.
This setting variable is relied upon by the Renderer module of Unreal Engine, particularly in the mobile post-processing and ambient occlusion subsystems. It’s used in the implementation of GTAO for mobile platforms.
The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with a default value of 2, which corresponds to using a Volume LUT (Look-Up Table).
The variable interacts closely with other mobile rendering settings, particularly those related to ambient occlusion. It’s often used in conjunction with r.Mobile.AmbientOcclusion to determine whether mobile ambient occlusion is enabled and what type of texture to use.
Developers should be aware that this variable is marked as ECVF_ReadOnly, meaning its value should not be changed at runtime. It’s intended to be set before the engine initializes.
Best practices when using this variable include:
- Setting it appropriately based on the target mobile hardware capabilities.
- Considering the performance implications of each option (No Texture, Texture2D LUT, or Volume LUT).
- Ensuring it’s used in conjunction with other mobile ambient occlusion settings for optimal results.
The associated variable CVarMobileGTAOPreIntegratedTextureType is the actual console variable that stores the value of r.Mobile.GTAOPreIntegratedTextureType. It’s used in the same way and for the same purpose. This variable is accessed in various parts of the rendering code to determine the type of pre-integrated texture to use for GTAO calculations.
When working with CVarMobileGTAOPreIntegratedTextureType, developers should:
- Use GetValueOnAnyThread() or GetValueOnRenderThread() to safely access its value, depending on the context.
- Be aware that changes to this variable can affect shader compilation and the overall rendering pipeline for mobile GTAO.
- Consider the implications on performance and visual quality when choosing between the available options (0: No Texture, 1: Texture2D LUT, 2: Volume LUT).
#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:38
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileGTAOPreIntegratedTextureType(
TEXT("r.Mobile.GTAOPreIntegratedTextureType"),
2,
TEXT("0: No Texture.\n")
TEXT("1: Texture2D LUT.\n")
TEXT("2: Volume LUT(Default)."),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1734
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
{
static IConsoleVariable* MobileGTAOPreIntegratedTextureTypeCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.GTAOPreIntegratedTextureType"));
static IConsoleVariable* MobileAmbientOcclusionCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.AmbientOcclusion"));
int32 GTAOPreIntegratedTextureType = MobileGTAOPreIntegratedTextureTypeCVar ? MobileGTAOPreIntegratedTextureTypeCVar->GetInt() : 0;
KeyString += ((MobileAmbientOcclusionCVar && MobileAmbientOcclusionCVar->GetInt() != 0) && IsMobileHDR()) ? FString::Printf(TEXT("_MobileAO_%d"), GTAOPreIntegratedTextureType) : TEXT("");
}
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SystemTextures.cpp:826
Scope (from outer to inner):
file
function void FSystemTextures::InitializeFeatureLevelDependentTextures
Source code excerpt:
}
static const auto MobileGTAOPreIntegratedTextureTypeCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.GTAOPreIntegratedTextureType"));
if (CurrentFeatureLevel < ERHIFeatureLevel::ES3_1 && MobileGTAOPreIntegratedTextureTypeCVar && MobileGTAOPreIntegratedTextureTypeCVar->GetValueOnAnyThread() > 0)
{
uint32 Extent = 16; // should be consistent with LUTSize in PostprocessMobile.usf
const uint32 Square = Extent * Extent;
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileGTAOPreIntegratedTextureType
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:37
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarMobileGTAOPreIntegratedTextureType(
TEXT("r.Mobile.GTAOPreIntegratedTextureType"),
2,
TEXT("0: No Texture.\n")
TEXT("1: Texture2D LUT.\n")
TEXT("2: Volume LUT(Default)."),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:129
Scope (from outer to inner):
file
class class FGTAOMobile_HorizonSearchIntegral : public FGlobalShader
function BEGIN_SHADER_PARAMETER_STRUCT
Source code excerpt:
auto LUTTextureType = CommonPermutationVector.Get<FLUTTextureTypeDim>();
int32 MobileGTAOPreIntegratedTextureType = CVarMobileGTAOPreIntegratedTextureType.GetValueOnAnyThread();
return IsMobileAmbientOcclusionEnabled(Parameters.Platform) && (MobileGTAOPreIntegratedTextureType == LUTTextureType);
}
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
FGlobalShader::ModifyCompilationEnvironment(Parameters, OutEnvironment);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:467
Scope (from outer to inner):
file
function static void RenderGTAO
Source code excerpt:
const uint32 DownsampleFactor = 2;
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;