r.Mobile.EnableStaticAndCSMShadowReceivers
r.Mobile.EnableStaticAndCSMShadowReceivers
#Overview
name: r.Mobile.EnableStaticAndCSMShadowReceivers
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: Primitives can receive only static shadowing from stationary lights.\n1: Primitives can receive both CSM and static shadowing from stationary lights. (default)
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.EnableStaticAndCSMShadowReceivers is to control the shadow receiving capabilities of primitives in mobile rendering. It is part of the mobile rendering system in Unreal Engine 5.
This setting variable is primarily used in the mobile rendering subsystem of Unreal Engine. It affects how shadows are received and rendered on mobile platforms.
The value of this variable is set in the engine’s console variable system. It is initialized with a default value of 1, which enables both CSM (Cascaded Shadow Maps) and static shadowing from stationary lights for primitives.
The associated variable CVarMobileEnableStaticAndCSMShadowReceivers directly interacts with r.Mobile.EnableStaticAndCSMShadowReceivers. They share the same value and purpose.
Developers must be aware that this variable significantly impacts the shadow rendering quality and performance on mobile devices. When enabled (set to 1), it allows for more complex and realistic shadowing but may have performance implications.
Best practices when using this variable include:
- Consider the target mobile hardware capabilities when deciding whether to enable or disable this feature.
- Test thoroughly on various mobile devices to ensure performance is not negatively impacted when enabled.
- Use in conjunction with other mobile rendering settings for optimal results.
Regarding the associated variable CVarMobileEnableStaticAndCSMShadowReceivers:
- It serves the same purpose as r.Mobile.EnableStaticAndCSMShadowReceivers.
- It is used internally by the engine to access and modify the setting.
- The variable is part of the read-only CVAR cache, which suggests it’s used for optimized access to the setting value during runtime.
- Developers should not directly modify this variable but instead use the console command to change the setting if needed.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:130, section: [/Script/Engine.RendererSettings]
- INI Section:
/Script/Engine.RendererSettings
- Raw value:
False
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3487
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileEnableStaticAndCSMShadowReceivers(
TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"),
1,
TEXT("0: Primitives can receive only static shadowing from stationary lights.\n"
"1: Primitives can receive both CSM and static shadowing from stationary lights. (default)"),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarMobileEnableMovableLightCSMShaderCulling(
#Loc: <Workspace>/Engine/Source/Editor/MaterialEditor/Private/MaterialStatsCommon.cpp:416
Scope (from outer to inner):
file
function void FMaterialStatsUtils::GetRepresentativeShaderTypesAndDescriptions
Source code excerpt:
}
static auto* CVarAllowDistanceFieldShadowsAndCSM = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"));
const bool bAllowDistanceFieldShadowsAndCSM = CVarAllowDistanceFieldShadowsAndCSM->GetValueOnAnyThread() != 0;
if (bAllowDistanceFieldShadowsAndCSM)
{
// distance field shadows & CSM shaders
{
MobileBasePassShaderName(false, TEXT("FMobileDistanceFieldShadowsLightMapAndCSMLightingPolicy"), TEXT("LOCAL_LIGHTS_DISABLED"), bMobileHDR, bOnlySkyPermutation, ShaderNameStr);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:72
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
const auto CVarMobileHDR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MobileHDR"));
const auto CVarMobileAllowMovableDirectionalLights = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowMovableDirectionalLights"));
const auto CVarMobileEnableStaticAndCSMShadowReceivers = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"));
const auto CVarMobileEnableMovableLightCSMShaderCulling = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableMovableLightCSMShaderCulling"));
const auto CVarMobileAllowDistanceFieldShadows = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowDistanceFieldShadows"));
const auto CVarMobileSkyLightPermutation = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.SkyLightPermutation"));
const auto CVarMobileEnableNoPrecomputedLightingCSMShader = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableNoPrecomputedLightingCSMShader"));
const auto CVarMobileSupportGPUScene = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.SupportGPUScene"));
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileEnableStaticAndCSMShadowReceivers
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3486
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarMobileEnableStaticAndCSMShadowReceivers(
TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"),
1,
TEXT("0: Primitives can receive only static shadowing from stationary lights.\n"
"1: Primitives can receive both CSM and static shadowing from stationary lights. (default)"),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:72
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
const auto CVarMobileHDR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MobileHDR"));
const auto CVarMobileAllowMovableDirectionalLights = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowMovableDirectionalLights"));
const auto CVarMobileEnableStaticAndCSMShadowReceivers = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"));
const auto CVarMobileEnableMovableLightCSMShaderCulling = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableMovableLightCSMShaderCulling"));
const auto CVarMobileAllowDistanceFieldShadows = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowDistanceFieldShadows"));
const auto CVarMobileSkyLightPermutation = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.SkyLightPermutation"));
const auto CVarMobileEnableNoPrecomputedLightingCSMShader = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableNoPrecomputedLightingCSMShader"));
const auto CVarMobileSupportGPUScene = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.SupportGPUScene"));
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:91
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
bMobileAllowMovableDirectionalLights = CVarMobileAllowMovableDirectionalLights->GetValueOnAnyThread() != 0;
bMobileAllowDistanceFieldShadows = CVarMobileAllowDistanceFieldShadows->GetValueOnAnyThread() != 0;
bMobileEnableStaticAndCSMShadowReceivers = CVarMobileEnableStaticAndCSMShadowReceivers->GetValueOnAnyThread() != 0;
bMobileEnableMovableLightCSMShaderCulling = CVarMobileEnableMovableLightCSMShaderCulling->GetValueOnAnyThread() != 0;
MobileSkyLightPermutationValue = CVarMobileSkyLightPermutation->GetValueOnAnyThread();
bMobileEnableNoPrecomputedLightingCSMShader = CVarMobileEnableNoPrecomputedLightingCSMShader->GetValueOnAnyThread() != 0;
MobileEarlyZPassValue = MobileEarlyZPassIniValue(GMaxRHIShaderPlatform);
MobileForwardLocalLightsValue = MobileForwardLocalLightsIniValue(GMaxRHIShaderPlatform);
bMobileDeferredShadingValue = MobileDeferredShadingIniValue(GMaxRHIShaderPlatform);