r.Mobile.EnableMovableLightCSMShaderCulling
r.Mobile.EnableMovableLightCSMShaderCulling
#Overview
name: r.Mobile.EnableMovableLightCSMShaderCulling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: All primitives lit by movable directional light render with CSM.\n1: Primitives lit by movable directional light render with the CSM shader when determined to be within CSM range. (default)
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.EnableMovableLightCSMShaderCulling is to control the rendering of primitives lit by movable directional lights in mobile platforms, specifically for Cascaded Shadow Maps (CSM) shader culling.
This setting variable is primarily used in the rendering system of Unreal Engine 5, particularly for mobile platforms. It is part of the mobile rendering optimization features.
The value of this variable is set in the ConsoleManager.cpp file, with a default value of 1. It can be modified through console commands or project settings.
The variable interacts with other mobile rendering settings, such as r.Mobile.AllowMovableDirectionalLights and r.Mobile.EnableStaticAndCSMShadowReceivers. It is part of a larger system of mobile rendering optimizations.
Developers must be aware that this setting affects the performance and visual quality of movable directional lights on mobile platforms. When enabled (set to 1), it allows for more efficient rendering by culling primitives that are determined to be outside the CSM range.
Best practices when using this variable include:
- Testing the performance impact on your specific mobile project.
- Considering the visual impact of enabling or disabling this feature.
- Balancing this setting with other mobile rendering optimizations.
Regarding the associated variable CVarMobileEnableMovableLightCSMShaderCulling:
This is the internal representation of the r.Mobile.EnableMovableLightCSMShaderCulling console variable. It is used within the engine’s C++ code to access and modify the setting.
The purpose of CVarMobileEnableMovableLightCSMShaderCulling is the same as r.Mobile.EnableMovableLightCSMShaderCulling, controlling the CSM shader culling for movable directional lights on mobile platforms.
This variable is used in the RenderCore module, specifically in the ReadOnlyCVARCache class. It’s part of the system that caches console variable values for efficient access during rendering.
The value of this variable is set by reading the console variable value, typically during engine initialization or when the console variable changes.
Developers should be aware that this is an internal representation and should generally interact with the r.Mobile.EnableMovableLightCSMShaderCulling console variable rather than this C++ variable directly.
Best practices for using this variable include ensuring that any code that needs to read this setting does so through the appropriate caching mechanisms to avoid performance issues from frequent console variable queries.
#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:3494
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileEnableMovableLightCSMShaderCulling(
TEXT("r.Mobile.EnableMovableLightCSMShaderCulling"),
1,
TEXT("0: All primitives lit by movable directional light render with CSM.\n"
"1: Primitives lit by movable directional light render with the CSM shader when determined to be within CSM range. (default)"),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarMobileEnableNoPrecomputedLightingCSMShader(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:73
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
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"));
const bool bForceAllPermutations = CVarSupportAllShaderPermutations && CVarSupportAllShaderPermutations->GetValueOnAnyThread() != 0;
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileEnableMovableLightCSMShaderCulling
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3493
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarMobileEnableMovableLightCSMShaderCulling(
TEXT("r.Mobile.EnableMovableLightCSMShaderCulling"),
1,
TEXT("0: All primitives lit by movable directional light render with CSM.\n"
"1: Primitives lit by movable directional light render with the CSM shader when determined to be within CSM range. (default)"),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:73
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
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"));
const bool bForceAllPermutations = CVarSupportAllShaderPermutations && CVarSupportAllShaderPermutations->GetValueOnAnyThread() != 0;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:92
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
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);
bMobileEnableMovableSpotlightsShadowValue = MobileEnableMovableSpotlightsShadowIniValue(GMaxRHIShaderPlatform);