r.Mobile.PropagateAlpha
r.Mobile.PropagateAlpha
#Overview
name: r.Mobile.PropagateAlpha
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: Disabled1: Propagate Full Alpha Propagate
It is referenced in 4
C++ source files. Also referenced in 1
C# build file meaning it may affect the build system logic.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.PropagateAlpha is to control alpha propagation in mobile rendering pipelines within Unreal Engine 5. This setting variable is specifically designed for mobile platforms and affects how alpha values are handled and propagated through the rendering process.
This setting variable is primarily used by the mobile rendering system in Unreal Engine 5. Based on the callsites, it’s clear that the Renderer module and the ShaderCompiler subsystem rely on this variable.
The value of this variable is set in two ways:
- It can be set via the console using the CVarMobilePropagateAlpha console variable.
- It can be configured in the engine’s configuration file (GEngineIni) under the [/Script/Engine.RendererSettings] section.
This variable interacts with other rendering-related variables, particularly those dealing with alpha handling and shader compilation for mobile platforms.
Developers must be aware of the following when using this variable:
- It’s specific to mobile platforms and won’t affect desktop or console rendering.
- The variable is read-only and render thread safe, meaning it should not be changed during runtime.
- It affects shader compilation, so changing this value may require recompilation of shaders.
Best practices when using this variable include:
- Set it early in the development process, preferably in project settings, to ensure consistent behavior across builds.
- Consider the performance implications of enabling alpha propagation on mobile devices, as it may impact rendering performance.
- Test thoroughly on target mobile devices when changing this setting to ensure it doesn’t negatively impact visual quality or performance.
- Coordinate with the art team to ensure that assets are created with the correct alpha settings to work well with the chosen propagation method.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileBasePassRendering.cpp:50
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobilePropagateAlpha(
TEXT("r.Mobile.PropagateAlpha"),
0,
TEXT("0: Disabled")
TEXT("1: Propagate Full Alpha Propagate"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMisc.cpp:2041
Scope (from outer to inner):
file
function int FGenericPlatformMisc::GetMobilePropagateAlphaSetting
Source code excerpt:
if (PropagateAlpha < 0)
{
GConfig->GetInt(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.PropagateAlpha"), PropagateAlpha, GEngineIni);
}
return PropagateAlpha;
}
void FGenericPlatformMisc::ShowConsoleWindow()
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8588
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
if (bIsMobilePlatform)
{
static FShaderPlatformCachedIniValue<int32> MobilePropagateAlphaIniValue(TEXT("r.Mobile.PropagateAlpha"));
int MobilePropagateAlphaIniValueInt = MobilePropagateAlphaIniValue.Get((EShaderPlatform)ShaderPlatform);
PropagateAlpha = MobilePropagateAlphaIniValueInt > 0 ? 2 : 0;
}
if (PropagateAlpha < 0 || PropagateAlpha > 2)
{
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1904
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
if (IsMobilePlatform(Platform))
{
static FShaderPlatformCachedIniValue<int32> MobilePropagateAlphaIniValue(TEXT("r.Mobile.PropagateAlpha"));
int MobilePropagateAlphaIniValueInt = MobilePropagateAlphaIniValue.Get((EShaderPlatform)Platform);
PropagateAlphaType = MobilePropagateAlphaIniValueInt > 0 ? 2 : 0;
}
else
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PostProcessing.PropagateAlpha"));
#References in C# build files
This variable is referenced in the following C# build files:
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:2660
int PropagateAlpha = 0;
Ini.GetInt32("/Script/Engine.RendererSettings", "r.Mobile.PropagateAlpha", out PropagateAlpha);
bool bAllowIMU = true;
Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bAllowIMU", out bAllowIMU);
bool bExtractNativeLibs = true;
Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bExtractNativeLibs", out bExtractNativeLibs);