r.AllowStaticLighting
r.AllowStaticLighting
#Overview
name: r.AllowStaticLighting
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:
Whether to allow any static lighting to be generated and used, like lightmaps and shadowmaps.\nGames that only use dynamic lighting should set this to 0 to save some static lighting overhead.
It is referenced in 56
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AllowStaticLighting is to control whether static lighting can be generated and used in the rendering system. Here’s a breakdown of its usage and implications:
-
Purpose:
- It determines if static lighting features like lightmaps and shadowmaps are allowed in the rendering pipeline.
-
Subsystems and modules:
- This variable affects multiple Unreal Engine subsystems, including the rendering system, lighting system, and GPU scene management.
- It’s used in various modules such as the Core, Engine, Renderer, and some plugins like GPULightmass.
-
Value setting:
- The value is set through a console variable (CVar) named “r.AllowStaticLighting”.
- It’s also exposed in the Renderer Settings as a configurable option.
-
Interacting variables:
- It interacts with other lighting-related variables and settings, such as those controlling dynamic shadows, lightmap quality, and specific light types (e.g., point lights, directional lights).
-
Developer awareness:
- Developers should be aware that changing this setting can have significant impacts on the rendering pipeline and lighting quality.
- Disabling static lighting can reduce some overhead but may affect visual quality and performance in scenes that rely heavily on precomputed lighting.
-
Best practices:
- Use this setting judiciously based on your project’s specific needs.
- If your game only uses dynamic lighting, setting this to 0 can save some static lighting overhead.
- Be aware that changing this setting may require restarting the editor and recompiling shaders.
Regarding the associated variable CVarAllowStaticLighting:
-
Purpose:
- This is the actual console variable that controls the r.AllowStaticLighting setting.
-
Usage:
- It’s used internally by the engine to quickly access the current state of the static lighting allowance.
-
Value:
- It’s an integer value, typically 0 (disabled) or 1 (enabled).
-
Access:
- It’s accessed through the console variable system, often using IConsoleManager::Get().FindTConsoleVariableDataInt().
-
Implications:
- Changes to this variable can trigger shader recompilations and affect various rendering systems.
-
Best practices:
- Generally, it’s better to modify this through the provided engine settings rather than directly manipulating the console variable, to ensure all related systems are properly updated.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:110, 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:3750
Scope: file
Source code excerpt:
// Changing this causes a full shader recompile
static TAutoConsoleVariable<int32> CVarAllowStaticLighting(
TEXT("r.AllowStaticLighting"),
1,
TEXT("Whether to allow any static lighting to be generated and used, like lightmaps and shadowmaps.\n"
"Games that only use dynamic lighting should set this to 0 to save some static lighting overhead."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNormalMaps(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:580
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category=MiscLighting, meta=(
ConsoleVariable="r.AllowStaticLighting",
ToolTip="Whether to allow any static lighting to be generated and used, like lightmaps and shadowmaps. Games that only use dynamic lighting should set this to 0 to save some static lighting overhead. Disabling allows Material AO and Material BentNormal to work with Lumen Global Illumination. Changing this setting requires restarting the editor.",
ConfigRestartRequired=true))
uint32 bAllowStaticLighting:1;
UPROPERTY(config, EditAnywhere, Category=MiscLighting, meta=(
ConsoleVariable="r.NormalMapsForStaticLighting",
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:67
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
const auto CVarSupportAllShaderPermutations = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportAllShaderPermutations"));
const auto CVarVertexFoggingForOpaque = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VertexFoggingForOpaque"));
const auto CVarAllowStaticLighting = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AllowStaticLighting"));
const auto CVarSupportSkyAtmosphere = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportSkyAtmosphere"));
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"));
#Associated Variable and Callsites
This variable is associated with another variable named CVarAllowStaticLighting
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3749
Scope: file
Source code excerpt:
// Changing this causes a full shader recompile
static TAutoConsoleVariable<int32> CVarAllowStaticLighting(
TEXT("r.AllowStaticLighting"),
1,
TEXT("Whether to allow any static lighting to be generated and used, like lightmaps and shadowmaps.\n"
"Games that only use dynamic lighting should set this to 0 to save some static lighting overhead."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:67
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
const auto CVarSupportAllShaderPermutations = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportAllShaderPermutations"));
const auto CVarVertexFoggingForOpaque = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VertexFoggingForOpaque"));
const auto CVarAllowStaticLighting = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AllowStaticLighting"));
const auto CVarSupportSkyAtmosphere = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportSkyAtmosphere"));
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"));
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:84
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
bEnablePointLightShadows = !CVarSupportPointLightWholeSceneShadows || CVarSupportPointLightWholeSceneShadows->GetValueOnAnyThread() != 0 || bForceAllPermutations;
bEnableLowQualityLightmaps = !CVarSupportLowQualityLightmaps || CVarSupportLowQualityLightmaps->GetValueOnAnyThread() != 0 || bForceAllPermutations;
bAllowStaticLighting = CVarAllowStaticLighting->GetValueOnAnyThread() != 0;
bSupportSkyAtmosphere = !CVarSupportSkyAtmosphere || CVarSupportSkyAtmosphere->GetValueOnAnyThread() != 0 || bForceAllPermutations;
// mobile
bMobileHDR = CVarMobileHDR->GetValueOnAnyThread() == 1;
bMobileAllowMovableDirectionalLights = CVarMobileAllowMovableDirectionalLights->GetValueOnAnyThread() != 0;
bMobileAllowDistanceFieldShadows = CVarMobileAllowDistanceFieldShadows->GetValueOnAnyThread() != 0;
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/LightmapGBuffer.h:62
Scope (from outer to inner):
file
class class FLightmapGBufferVS : public FMeshMaterialShader
function static bool ShouldCompilePermutation
Source code excerpt:
static bool ShouldCompilePermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (EnumHasAllFlags(Parameters.Flags, EShaderPermutationFlags::HasEditorOnlyData)
&& IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM5)
&& bAllowStaticLighting
&& Parameters.VertexFactoryType->SupportsStaticLighting()
&& Parameters.MaterialParameters.bIsSpecialEngineMaterial)
{
return true;
}
else
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/LightmapGBuffer.h:116
Scope (from outer to inner):
file
class class FLightmapGBufferPS : public FMeshMaterialShader
function static bool ShouldCompilePermutation
Source code excerpt:
static bool ShouldCompilePermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (EnumHasAllFlags(Parameters.Flags, EShaderPermutationFlags::HasEditorOnlyData)
&& IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM5)
&& bAllowStaticLighting
&& Parameters.VertexFactoryType->SupportsStaticLighting()
&& Parameters.MaterialParameters.bIsSpecialEngineMaterial)
{
return true;
}
else
#Loc: <Workspace>/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Private/CableComponent.cpp:416
Scope (from outer to inner):
file
function class FCableSceneProxy final : public FPrimitiveSceneProxy { public: SIZE_T GetTypeHash
class class FCableSceneProxy final : public FPrimitiveSceneProxy
function virtual FPrimitiveViewRelevance GetViewRelevance
Source code excerpt:
Result.bUsesLightingChannels = GetLightingChannelMask() != GetDefaultLightingChannelMask();
Result.bTranslucentSelfShadow = bCastVolumetricTranslucentShadow;
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (
#if !(UE_BUILD_SHIPPING) || WITH_EDITOR
IsRichView(*View->Family) ||
View->Family->EngineShowFlags.Collision ||
View->Family->EngineShowFlags.Bounds ||
View->Family->EngineShowFlags.VisualizeInstanceUpdates ||
#Loc: <Workspace>/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Private/CableComponent.cpp:429
Scope (from outer to inner):
file
function class FCableSceneProxy final : public FPrimitiveSceneProxy { public: SIZE_T GetTypeHash
class class FCableSceneProxy final : public FPrimitiveSceneProxy
function virtual FPrimitiveViewRelevance GetViewRelevance
Source code excerpt:
#endif
// Force down dynamic rendering path if invalid lightmap settings, so we can apply an error material in DrawRichMesh
(bAllowStaticLighting && HasStaticLighting() && !HasValidSettingsForStaticLighting()) ||
HasViewDependentDPG()
)
{
Result.bDynamicRelevance = true;
}
else
#Loc: <Workspace>/Engine/Source/Editor/DetailCustomizations/Private/MobilityCustomization.cpp:73
Scope (from outer to inner):
file
function void FMobilityCustomization::GenerateHeaderRowContent
Source code excerpt:
bool bShowStationary = !( RestrictedMobilityBits & StationaryMobilityBitMask );
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (bForLight && CVarHideLightStaticMobilityWhenStaticLightingDisabled.GetValueOnGameThread())
{
bShowStatic &= bAllowStaticLighting;
}
int32 ColumnIndex = 0;
if ( bShowStatic )
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/StaticLightingSystem/StaticLightingSystem.cpp:375
Scope (from outer to inner):
file
function void FStaticLightingManager::UpdateBuildLighting
Source code excerpt:
{
// BeginLightmassProcess returns false if there are errors or no precomputed lighting is allowed. Handle both cases.
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bForceNoPrecomputedLighting = GWorld->GetWorldSettings()->bForceNoPrecomputedLighting || !bAllowStaticLighting;
if (bForceNoPrecomputedLighting)
{
DestroyStaticLightingSystems();
}
else
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/StaticLightingSystem/StaticLightingSystem.cpp:399
Scope (from outer to inner):
file
function void FStaticLightingManager::FailLightingBuild
Source code excerpt:
void FStaticLightingManager::FailLightingBuild( FText ErrorText)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bForceNoPrecomputedLighting = GWorld->GetWorldSettings()->bForceNoPrecomputedLighting || !bAllowStaticLighting;
FStaticLightingManager::Get()->ClearCurrentNotification();
if (!bForceNoPrecomputedLighting)
{
if (GEditor->GetMapBuildCancelled())
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/StaticLightingSystem/StaticLightingSystem.cpp:646
Scope (from outer to inner):
file
function bool FStaticLightingSystem::BeginLightmassProcess
Source code excerpt:
}
const bool bAllowStaticLighting = IsStaticLightingAllowed();
bForceNoPrecomputedLighting = World->GetWorldSettings()->bForceNoPrecomputedLighting || !bAllowStaticLighting;
GConfig->GetFloat( TEXT("TextureStreaming"), TEXT("MaxLightmapRadius"), GMaxLightmapRadius, GEngineIni );
GConfig->GetBool( TEXT("TextureStreaming"), TEXT("AllowStreamingLightmaps"), GAllowStreamingLightmaps, GEngineIni );
if (!bForceNoPrecomputedLighting)
{
// Begin the static lighting progress bar.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:583
Scope (from outer to inner):
file
class class URendererSettings : public UDeveloperSettings
Source code excerpt:
ToolTip="Whether to allow any static lighting to be generated and used, like lightmaps and shadowmaps. Games that only use dynamic lighting should set this to 0 to save some static lighting overhead. Disabling allows Material AO and Material BentNormal to work with Lumen Global Illumination. Changing this setting requires restarting the editor.",
ConfigRestartRequired=true))
uint32 bAllowStaticLighting:1;
UPROPERTY(config, EditAnywhere, Category=MiscLighting, meta=(
ConsoleVariable="r.NormalMapsForStaticLighting",
ToolTip="Whether to allow any static lighting to use normal maps for lighting computations."))
uint32 bUseNormalMapsForStaticLighting:1;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/DirectionalLightComponent.cpp:190
Scope (from outer to inner):
file
function float ComputeWholeSceneDynamicShadowRadius
Source code excerpt:
float ComputeWholeSceneDynamicShadowRadius(EComponentMobility::Type Mobility, float DynamicShadowDistanceMovableLight, float DynamicShadowDistanceStationaryLight)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (Mobility == EComponentMobility::Movable || !bAllowStaticLighting)
{
return DynamicShadowDistanceMovableLight;
}
else
{
return DynamicShadowDistanceStationaryLight;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/DirectionalLightComponent.cpp:1072
Scope (from outer to inner):
file
function bool UDirectionalLightComponent::CanEditChange
Source code excerpt:
if (InProperty)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
FString PropertyName = InProperty->GetName();
const float WholeSceneDynamicShadowRadius = ComputeWholeSceneDynamicShadowRadius(Mobility, DynamicShadowDistanceMovableLight, DynamicShadowDistanceStationaryLight);
const bool bShadowCascades = CastShadows
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/DirectionalLightComponent.cpp:1090
Scope (from outer to inner):
file
function bool UDirectionalLightComponent::CanEditChange
Source code excerpt:
if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(UDirectionalLightComponent, DynamicShadowDistanceMovableLight))
{
const bool bUseMovableLightDistance = (Mobility == EComponentMobility::Movable) || (Mobility == EComponentMobility::Stationary && !bAllowStaticLighting);
return CastShadows && CastDynamicShadows && bUseMovableLightDistance;
}
if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(UDirectionalLightComponent, DynamicShadowDistanceStationaryLight))
{
const bool bUseStationaryLightDistance = (Mobility == EComponentMobility::Stationary) && bAllowStaticLighting;
return CastShadows && CastDynamicShadows && bUseStationaryLightDistance;
}
if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(UDirectionalLightComponent, DynamicShadowCascades)
|| PropertyName == GET_MEMBER_NAME_STRING_CHECKED(UDirectionalLightComponent, CascadeDistributionExponent)
|| PropertyName == GET_MEMBER_NAME_STRING_CHECKED(UDirectionalLightComponent, CascadeTransitionFraction)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Rendering/NaniteResources.cpp:675
Scope (from outer to inner):
file
namespace Nanite
function bool FSceneProxyBase::SupportsAlwaysVisible
Source code excerpt:
}
static bool bAllowStaticLighting = FReadOnlyCVARCache::AllowStaticLighting();
if (bAllowStaticLighting)
{
// Static lighting is not supported
return false;
}
// Always visible
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshRender.cpp:2070
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FStaticMeshSceneProxy::GetViewRelevance
Source code excerpt:
bool bInCollisionView = false;
#endif
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if(
#if !(UE_BUILD_SHIPPING) || WITH_EDITOR
IsRichView(*View->Family) ||
View->Family->EngineShowFlags.Collision ||
bInCollisionView ||
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshRender.cpp:2089
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FStaticMeshSceneProxy::GetViewRelevance
Source code excerpt:
#endif
// Force down dynamic rendering path if invalid lightmap settings, so we can apply an error material in DrawRichMesh
(bAllowStaticLighting && HasStaticLighting() && !HasValidSettingsForStaticLighting()) ||
HasViewDependentDPG()
)
{
Result.bDynamicRelevance = true;
#if STATICMESH_ENABLE_DEBUG_RENDERING
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/StaticMeshSceneProxy.h:142
Scope (from outer to inner):
file
class class FStaticMeshSceneProxy : public FPrimitiveSceneProxy
function virtual bool IsRayTracingStaticRelevant
Source code excerpt:
virtual bool IsRayTracingStaticRelevant() const override
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bIsStaticInstance = !bDynamicRayTracingGeometry;
return bIsStaticInstance && !HasViewDependentDPG() && !(bAllowStaticLighting && HasStaticLighting() && !HasValidSettingsForStaticLighting());
}
ENGINE_API virtual RayTracing::GeometryGroupHandle GetRayTracingGeometryGroupHandle() const override;
#endif // RHI_RAYTRACING
ENGINE_API virtual void GetLCIs(FLCIArray& LCIs) override;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:14
Scope: file
Source code excerpt:
bool FReadOnlyCVARCache::bEnableStationarySkylight = true;
bool FReadOnlyCVARCache::bEnableLowQualityLightmaps = true;
bool FReadOnlyCVARCache::bAllowStaticLighting = true;
bool FReadOnlyCVARCache::bSupportSkyAtmosphere = true;
// Mobile specific
bool FReadOnlyCVARCache::bMobileHDR = true;
bool FReadOnlyCVARCache::bMobileAllowMovableDirectionalLights = true;
bool FReadOnlyCVARCache::bMobileAllowDistanceFieldShadows = true;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:84
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
bEnablePointLightShadows = !CVarSupportPointLightWholeSceneShadows || CVarSupportPointLightWholeSceneShadows->GetValueOnAnyThread() != 0 || bForceAllPermutations;
bEnableLowQualityLightmaps = !CVarSupportLowQualityLightmaps || CVarSupportLowQualityLightmaps->GetValueOnAnyThread() != 0 || bForceAllPermutations;
bAllowStaticLighting = CVarAllowStaticLighting->GetValueOnAnyThread() != 0;
bSupportSkyAtmosphere = !CVarSupportSkyAtmosphere || CVarSupportSkyAtmosphere->GetValueOnAnyThread() != 0 || bForceAllPermutations;
// mobile
bMobileHDR = CVarMobileHDR->GetValueOnAnyThread() == 1;
bMobileAllowMovableDirectionalLights = CVarMobileAllowMovableDirectionalLights->GetValueOnAnyThread() != 0;
bMobileAllowDistanceFieldShadows = CVarMobileAllowDistanceFieldShadows->GetValueOnAnyThread() != 0;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:102
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
#ifdef PROJECT_CVAR_ALLOW_STATIC_LIGHTING
check(!!PROJECT_CVAR_ALLOW_STATIC_LIGHTING == bAllowStaticLighting);
#endif
#ifdef PROJECT_CVAR_MOBILE_HDR
check(!!PROJECT_CVAR_MOBILE_HDR == bMobileHDR);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Public/ReadOnlyCVARCache.h:17
Scope (from outer to inner):
file
function static inline bool AllowStaticLighting
Source code excerpt:
return PROJECT_CVAR_ALLOW_STATIC_LIGHTING;
#else
return bAllowStaticLighting;
#endif
}
static inline bool EnablePointLightShadows()
{
return bEnablePointLightShadows;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Public/ReadOnlyCVARCache.h:135
Scope: file
Source code excerpt:
RENDERCORE_API static bool bInitialized;
RENDERCORE_API static bool bAllowStaticLighting;
RENDERCORE_API static bool bEnablePointLightShadows;
RENDERCORE_API static bool bEnableStationarySkylight;
RENDERCORE_API static bool bEnableLowQualityLightmaps;
RENDERCORE_API static bool bSupportSkyAtmosphere;
// Mobile specific
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2054
Scope (from outer to inner):
file
function bool FBasePassMeshProcessor::TryAddMeshBatch
Source code excerpt:
// Check for a cached light-map.
const bool bIsLitMaterial = ShadingModels.IsLit();
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const FLightMapInteraction LightMapInteraction = (bAllowStaticLighting && MeshBatch.LCI && bIsLitMaterial)
? MeshBatch.LCI->GetLightMapInteraction(FeatureLevel)
: FLightMapInteraction();
const bool bAllowIndirectLightingCache = Scene && Scene->PrecomputedLightVolumes.Num() > 0;
const bool bUseVolumetricLightmap = Scene && Scene->VolumetricLightmapSceneData.HasData();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2084
Scope (from outer to inner):
file
function bool FBasePassMeshProcessor::TryAddMeshBatch
Source code excerpt:
if (bIsLitMaterial
&& bAllowStaticLighting
&& bUseVolumetricLightmap
&& PrimitiveSceneProxy)
{
bResult = Process< FSelfShadowedVolumetricLightmapPolicy >(
MeshBatch,
BatchElementMask,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2170
Scope (from outer to inner):
file
function ELightMapPolicyType FBasePassMeshProcessor::GetUniformLightMapPolicyType
Source code excerpt:
const FMaterialShadingModelField ShadingModels = Material.GetShadingModels();
const bool bIsLitMaterial = ShadingModels.IsLit();
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const FLightMapInteraction LightMapInteraction = (bAllowStaticLighting && LCI && bIsLitMaterial)
? LCI->GetLightMapInteraction(FeatureLevel)
: FLightMapInteraction();
// force LQ lightmaps based on system settings
const bool bPlatformAllowsHighQualityLightMaps = AllowHighQualityLightmaps(FeatureLevel);
const bool bAllowHighQualityLightMaps = bPlatformAllowsHighQualityLightMaps && LightMapInteraction.AllowsHighQualityLightmaps();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2192
Scope (from outer to inner):
file
function ELightMapPolicyType FBasePassMeshProcessor::GetUniformLightMapPolicyType
Source code excerpt:
if (bAllowHighQualityLightMaps)
{
const FShadowMapInteraction ShadowMapInteraction = (bAllowStaticLighting && LCI && bIsLitMaterial)
? LCI->GetShadowMapInteraction(FeatureLevel)
: FShadowMapInteraction();
if (ShadowMapInteraction.GetType() == SMIT_Texture)
{
LightMapPolicyType = LMP_DISTANCE_FIELD_SHADOWS_AND_HQ_LIGHTMAP;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2216
Scope (from outer to inner):
file
function ELightMapPolicyType FBasePassMeshProcessor::GetUniformLightMapPolicyType
Source code excerpt:
default:
if (bIsLitMaterial
&& bAllowStaticLighting
&& bUseVolumetricLightmap
&& PrimitiveSceneProxy
&& (PrimitiveSceneProxy->IsMovable()
|| PrimitiveSceneProxy->NeedsUnbuiltPreviewLighting()
|| PrimitiveSceneProxy->GetLightmapType() == ELightmapType::ForceVolumetric))
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2281
Scope (from outer to inner):
file
function TArray<ELightMapPolicyType, TInlineAllocator<2>> FBasePassMeshProcessor::GetUniformLightMapPolicyTypeForPSOCollection
Source code excerpt:
const bool bIsTranslucent = IsTranslucentBlendMode(Material);
const bool bIsLitMaterial = ShadingModels.IsLit();
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bPlatformAllowsHighQualityLightMaps = AllowHighQualityLightmaps(FeatureLevel);
static const auto CVarSupportLowQualityLightmap = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportLowQualityLightmaps"));
const bool bAllowLowQualityLightMaps = (!CVarSupportLowQualityLightmap) || (CVarSupportLowQualityLightmap->GetValueOnAnyThread() != 0);
// Retrieve those values or have as global precache params (if not known then we have to assume they can be used for now)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2308
Scope (from outer to inner):
file
function TArray<ELightMapPolicyType, TInlineAllocator<2>> FBasePassMeshProcessor::GetUniformLightMapPolicyTypeForPSOCollection
Source code excerpt:
{
// EShadowMapInteractionType::SMIT_Texture
if (bAllowStaticLighting && bIsLitMaterial)
{
UniformLightMapPolicyTypes.Add(LMP_DISTANCE_FIELD_SHADOWS_AND_HQ_LIGHTMAP);
}
// else
{
UniformLightMapPolicyTypes.Add(LMP_HQ_LIGHTMAP);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2324
Scope (from outer to inner):
file
function TArray<ELightMapPolicyType, TInlineAllocator<2>> FBasePassMeshProcessor::GetUniformLightMapPolicyTypeForPSOCollection
Source code excerpt:
// else LightMapInterationType
{
if (bIsLitMaterial && bAllowStaticLighting && bUseVolumetricLightmap)
{
UniformLightMapPolicyTypes.Add(LMP_PRECOMPUTED_IRRADIANCE_VOLUME_INDIRECT_LIGHTING);
}
if (IsIndirectLightingCacheAllowed(FeatureLevel) && bAllowIndirectLightingCache)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:2404
Scope (from outer to inner):
file
function void FBasePassMeshProcessor::CollectPSOInitializersForSkyLight
Source code excerpt:
if (!bNoLightMapOnlyMode && bIsLitMaterial && bIsTranslucent)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
// Retrieve those values or have as global precache params (if not known then we have to assume they can be used for now)
const bool bAllowIndirectLightingCache = true;// Scene&& Scene->PrecomputedLightVolumes.Num() > 0;
const bool bUseVolumetricLightmap = true;// Scene&& Scene->VolumetricLightmapSceneData.HasData();
if (bAllowStaticLighting && bUseVolumetricLightmap)
{
CollectPSOInitializersForLMPolicy< FSelfShadowedVolumetricLightmapPolicy >(
SceneTexturesConfig, VertexFactoryData, PreCacheParams, Material, ShadingModels, bRenderSkyLight, bDitheredLODTransition,
FSelfShadowedVolumetricLightmapPolicy(), MeshFillMode, MeshCullMode, PrimitiveType, PSOInitializers);
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:1674
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::Render
Source code excerpt:
const FRDGSystemTextures& SystemTextures = FRDGSystemTextures::Create(GraphBuilder);
const bool bAllowStaticLighting = !bHasRayTracedOverlay && IsStaticLightingAllowed();
// if DDM_AllOpaqueNoVelocity was used, then velocity should have already been rendered as well
const bool bIsEarlyDepthComplete = (DepthPass.EarlyZPassMode == DDM_AllOpaque || DepthPass.EarlyZPassMode == DDM_AllOpaqueNoVelocity);
// Use read-only depth in the base pass if we have a full depth prepass.
const bool bAllowReadOnlyDepthBasePass = bIsEarlyDepthComplete
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:689
Scope (from outer to inner):
file
function void FGPUScene::UpdateGPULights
lambda-function
Source code excerpt:
{
SCOPED_NAMED_EVENT(UpdateGPUScene_Lights, FColor::Green);
const bool bAllowStaticLighting = IsStaticLightingAllowed();
for (int32 Index = 0; Index < Scene.Lights.GetMaxIndex(); ++Index)
{
if (Scene.Lights.IsAllocated(Index))
{
InitLightData(Scene.Lights[Index], bAllowStaticLighting, LightData[Index]);
}
else
{
LightData[Index].WorldPosition = FDFVector3{};
LightData[Index].Color = FVector3f::ZeroVector;
LightData[Index].InvRadius = 0.0f;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:738
Scope (from outer to inner):
file
function void FGPUScene::InitLightData
Source code excerpt:
}
void FGPUScene::InitLightData(const FLightSceneInfoCompact& LightInfoCompact, bool bAllowStaticLighting, FLightSceneData& DataOut)
{
const FLightSceneInfo& LightInfo = *LightInfoCompact.LightSceneInfo;
const FLightSceneProxy& LightProxy = *LightInfo.Proxy;
FLightRenderParameters LightParams;
LightProxy.GetLightShaderParameters(LightParams);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:770
Scope (from outer to inner):
file
function void FGPUScene::InitLightData
Source code excerpt:
DataOut.InverseExposureBlend = LightParams.InverseExposureBlend;
DataOut.IESAtlasIndex = LightParams.IESAtlasIndex;
DataOut.LightTypeAndShadowMapChannelMaskPacked = LightInfo.PackLightTypeAndShadowMapChannelMask(bAllowStaticLighting);
}
void FGPUScene::UpdateInternal(FRDGBuilder& GraphBuilder, FSceneUniformBuffer& SceneUB, FRDGExternalAccessQueue& ExternalAccessQueue, const UE::Tasks::FTask& UpdateTaskPrerequisites)
{
LLM_SCOPE_BYTAG(GPUScene);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:2284
Scope (from outer to inner):
file
function void FBatchedPrimitiveShaderData::Setup
Source code excerpt:
int32 i = 0;
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (bAllowStaticLighting)
{
FVector4f LightMapUVScaleBias = FVector4f(1, 1, 0, 0);
FVector4f ShadowMapUVScaleBias = FVector4f(1, 1, 0, 0);
uint32 LightMapDataIdx = 0;
// FIXME: valid lightmap data
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.h:426
Scope (from outer to inner):
file
class class FGPUScene
Source code excerpt:
void UpdateGPULights(FRDGBuilder& GraphBuilder, const UE::Tasks::FTask& PrerequisiteTask);
static void InitLightData(const FLightSceneInfoCompact& LightInfoCompact, bool bAllowStaticLighting, FLightSceneData& DataOut);
void UploadDynamicPrimitiveShaderDataForViewInternal(FRDGBuilder& GraphBuilder, FViewInfo& View, UE::Renderer::Private::IShadowInvalidatingInstances *ShadowInvalidatingInstances);
void UpdateInternal(FRDGBuilder& GraphBuilder, FSceneUniformBuffer& SceneUB, FRDGExternalAccessQueue& ExternalAccessQueue, const UE::Tasks::FTask& UpdateTaskPrerequisites);
void AddUpdatePrimitiveIdsPass(FRDGBuilder& GraphBuilder, FInstanceGPULoadBalancer& IdOnlyUpdateItems);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightGridInjection.cpp:433
Scope: file
Source code excerpt:
RDG_EVENT_SCOPE(GraphBuilder, "ComputeLightGrid");
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bLightGridUses16BitBuffers = LightGridUses16BitBuffers(ShaderPlatform);
const FRDGSystemTextures& SystemTextures = FRDGSystemTextures::Get(GraphBuilder);
TArray<FForwardLightData*, TInlineAllocator<4>> ForwardLightDataPerView;
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightGridInjection.cpp:550
Scope: file
Source code excerpt:
}
uint32 LightTypeAndShadowMapChannelMaskPacked = LightSceneInfo->PackLightTypeAndShadowMapChannelMask(bAllowStaticLighting, SortedLightInfo.SortKey.Fields.bLightFunction);
const bool bDynamicShadows = ViewFamily.EngineShowFlags.DynamicShadows && VisibleLightInfos.IsValidIndex(LightSceneInfo->Id);
const int32 VirtualShadowMapId = bDynamicShadows ? VisibleLightInfos[LightSceneInfo->Id].GetVirtualShadowMapId( &View ) : INDEX_NONE;
if ((SortedLightInfo.SortKey.Fields.LightType == LightType_Point && ViewFamily.EngineShowFlags.PointLights) ||
(SortedLightInfo.SortKey.Fields.LightType == LightType_Spot && ViewFamily.EngineShowFlags.SpotLights) ||
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:578
Scope (from outer to inner):
file
function FDeferredLightUniformStruct GetDeferredLightParameters
Source code excerpt:
int32 ShadowMapChannel = LightSceneInfo.Proxy->GetShadowMapChannel();
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (!bAllowStaticLighting)
{
ShadowMapChannel = INDEX_NONE;
Out.ShadowMapChannelMask = FVector4f(0);
}
else
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightSceneInfo.cpp:351
Scope (from outer to inner):
file
function uint32 FLightSceneInfo::PackLightTypeAndShadowMapChannelMask
Source code excerpt:
}
uint32 FLightSceneInfo::PackLightTypeAndShadowMapChannelMask(bool bAllowStaticLighting, bool bLightFunction) const
{
uint32 Result = 0;
// Light type and shadow map
int32 ShadowMapChannel = Proxy->GetShadowMapChannel();
int32 CurrentDynamicShadowMapChannel = GetDynamicShadowMapChannel();
if (!bAllowStaticLighting)
{
ShadowMapChannel = INDEX_NONE;
}
// Static shadowing uses ShadowMapChannel, dynamic shadows are packed into light attenuation using DynamicShadowMapChannel
Result =
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightSceneInfo.h:314
Scope (from outer to inner):
file
class class FLightSceneInfo
Source code excerpt:
bool ShouldRecordShadowSubjectsForMobile() const;
uint32 PackLightTypeAndShadowMapChannelMask(bool bAllowStaticLighting, bool bLightFunction = false) const;
};
/** Defines how the light is stored in the scene's light octree. */
struct FLightOctreeSemantics
{
enum { MaxElementsPerLeaf = 16 };
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileBasePass.cpp:79
Scope (from outer to inner):
file
function bool MobileUsesNoLightMapPermutation
Source code excerpt:
bool MobileUsesNoLightMapPermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bIsLitMaterial = Parameters.MaterialParameters.ShadingModels.IsLit();
const bool bDeferredShading = IsMobileDeferredShadingEnabled(Parameters.Platform);
if (!bDeferredShading && !bAllowStaticLighting && bIsLitMaterial &&
!IsTranslucentBlendMode(Parameters.MaterialParameters) &&
!Parameters.MaterialParameters.ShadingModels.HasShadingModel(MSM_SingleLayerWater))
{
// We don't need NoLightMap permutation if CSM shader can handle no-CSM case with a branch inside shader
return !MobileUseCSMShaderBranch();
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteShading.cpp:525
Scope: file
Source code excerpt:
)
{
static const bool bAllowStaticLighting = IsStaticLightingAllowed();
const ERHIFeatureLevel::Type FeatureLevel = Scene.GetFeatureLevel();
FNaniteVertexFactory* NaniteVertexFactory = Nanite::GVertexFactoryResource.GetVertexFactory2();
FVertexFactoryType* NaniteVertexFactoryType = NaniteVertexFactory->GetType();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteShading.cpp:548
Scope: file
Source code excerpt:
FLightCacheInterface* LightCacheInterface = nullptr;
if (bAllowStaticLighting && SceneProxy->HasStaticLighting())
{
FPrimitiveSceneProxy::FLCIArray LCIs;
SceneProxy->GetLCIs(LCIs);
// We expect a Nanite scene proxy can only ever have a single LCI
check(LCIs.Num() == 1u);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PrimitiveSceneInfo.cpp:1584
Scope (from outer to inner):
file
function void FPrimitiveSceneInfo::AddToScene
Source code excerpt:
for (FPrimitiveSceneInfo* SceneInfo : SceneInfos)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
if (bAllowStaticLighting)
{
SceneInfo->NumLightmapDataEntries = SceneInfo->UpdateStaticLightingBuffer();
if (SceneInfo->NumLightmapDataEntries > 0 && UseGPUScene(GMaxRHIShaderPlatform, Scene->GetFeatureLevel()))
{
SceneInfo->LightmapDataOffset = Scene->GPUScene.LightmapDataAllocator.Allocate(SceneInfo->NumLightmapDataEntries);
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingMaterialHitShaders.cpp:476
Scope (from outer to inner):
file
function bool FRayTracingMeshProcessor::TryAddMeshBatch
Source code excerpt:
// Check for a cached light-map.
const bool bIsLitMaterial = Material.GetShadingModels().IsLit();
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const FLightMapInteraction LightMapInteraction = (bAllowStaticLighting && MeshBatch.LCI && bIsLitMaterial)
? MeshBatch.LCI->GetLightMapInteraction(FeatureLevel)
: FLightMapInteraction();
// force LQ lightmaps based on system settings
const bool bPlatformAllowsHighQualityLightMaps = AllowHighQualityLightmaps(FeatureLevel);
const bool bAllowHighQualityLightMaps = bPlatformAllowsHighQualityLightMaps && LightMapInteraction.AllowsHighQualityLightmaps();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingMaterialHitShaders.cpp:498
Scope (from outer to inner):
file
function bool FRayTracingMeshProcessor::TryAddMeshBatch
Source code excerpt:
if (bAllowHighQualityLightMaps)
{
const FShadowMapInteraction ShadowMapInteraction = (bAllowStaticLighting && MeshBatch.LCI && bIsLitMaterial)
? MeshBatch.LCI->GetShadowMapInteraction(FeatureLevel)
: FShadowMapInteraction();
if (ShadowMapInteraction.GetType() == SMIT_Texture)
{
return Process(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingMaterialHitShaders.cpp:546
Scope (from outer to inner):
file
function bool FRayTracingMeshProcessor::TryAddMeshBatch
Source code excerpt:
default:
if (bIsLitMaterial
&& bAllowStaticLighting
&& Scene
&& Scene->VolumetricLightmapSceneData.HasData()
&& PrimitiveSceneProxy
&& (PrimitiveSceneProxy->IsMovable()
|| PrimitiveSceneProxy->NeedsUnbuiltPreviewLighting()
|| PrimitiveSceneProxy->GetLightmapType() == ELightmapType::ForceVolumetric))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentCapture.cpp:1472
Scope (from outer to inner):
file
function void FScene::CaptureOrUploadReflectionCapture
Source code excerpt:
if (CaptureComponent->ReflectionSourceType == EReflectionSourceType::CapturedScene)
{
const bool bAllowStaticLighting = IsStaticLightingAllowed();
// Reflection Captures are a form of static lighting, so only capture scene elements that are static
// However if the project has static lighting disabled, Reflection Captures can still be made to work by capturing Movable lights
bool const bCaptureStaticSceneOnly = CVarReflectionCaptureStaticSceneOnly.GetValueOnGameThread() != 0 && bAllowStaticLighting;
CaptureSceneIntoScratchCubemap(this, *ReflectionCubemapTexture, CaptureComponent->GetComponentLocation() + CaptureComponent->CaptureOffset, ReflectionCaptureSize, false, bCaptureStaticSceneOnly, 0, false, false, FLinearColor(), bCapturingForMobile, bInsideTick);
}
else if (CaptureComponent->ReflectionSourceType == EReflectionSourceType::SpecifiedCubemap)
{
UTextureCube* SourceCubemap = CaptureComponent->Cubemap;
float SourceCubemapRotation = CaptureComponent->SourceCubemapAngle * (PI / 180.f);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp:6110
Scope (from outer to inner):
file
function void FSceneRenderer::CreateDynamicShadows
Source code excerpt:
FScopeCycleCounter Context(LightSceneInfo->Proxy->GetStatId());
const bool bAllowStaticLighting = IsStaticLightingAllowed();
const bool bPointLightShadow = LightSceneInfoCompact.LightType == LightType_Point || LightSceneInfoCompact.LightType == LightType_Rect;
const bool bDirectionalLightShadow = LightSceneInfoCompact.LightType == LightType_Directional;
const bool bSpotLightShadow = LightSceneInfoCompact.LightType == LightType_Spot;
// Only create whole scene shadows for lights that don't precompute shadowing (movable lights)
const bool bShouldCreateShadowForMovableLight =
LightSceneInfoCompact.bCastDynamicShadow
&& (!LightSceneInfo->Proxy->HasStaticShadowing() || !bAllowStaticLighting);
const bool bCreateShadowForMovableLight =
bShouldCreateShadowForMovableLight
&& (!bPointLightShadow || bProjectEnablePointLightShadows)
&& (!bDirectionalLightShadow || bProjectEnableMovableDirectionLightShadows)
&& (!bSpotLightShadow || bProjectEnableMovableSpotLightShadows);