bAllowSignedDistanceFieldShadows
bAllowSignedDistanceFieldShadows
#Overview
name: bAllowSignedDistanceFieldShadows
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bAllowSignedDistanceFieldShadows is to control whether signed distance field shadows are allowed in static lighting calculations within Unreal Engine 5. This setting is specifically related to the rendering and lighting systems, particularly for static shadows.
This setting variable is primarily used in the Lightmass subsystem, which is responsible for global illumination and static lighting calculations in Unreal Engine. It is referenced in both the editor-side code (UnrealEd module) and the Lightmass executable code.
The value of this variable is set from the Lightmass configuration file (GLightmassIni). It is read in the FLightmassExporter::WriteSceneSettings function, which suggests that this setting is exported from the editor to the Lightmass process.
This variable interacts with other shadow-related settings, such as ShadowFactorGradientTolerance, MaxTransitionDistanceWorldSpace, and others within the FStaticShadowSettings struct.
Developers must be aware that this setting affects the quality and performance of static shadow calculations. Enabling signed distance field shadows can potentially provide higher quality shadows but may also increase computation time and memory usage.
Best practices when using this variable include:
- Consider the performance implications of enabling signed distance field shadows, especially for large scenes.
- Use this setting in conjunction with other shadow-related settings to achieve the desired balance between shadow quality and performance.
- Test the impact of this setting on your specific scenes to determine if the quality improvement justifies any potential performance cost.
- Be aware that this setting may not affect all types of lights or shadow calculations, as it’s specifically used in static lighting scenarios.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:142, section: [DevOptions.StaticShadows]
- INI Section:
DevOptions.StaticShadows
- Raw value:
True
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2313
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
Scene.ShadowSettings.bFilterShadowFactor = bConfigBool;
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.StaticShadows"), TEXT("ShadowFactorGradientTolerance"), Scene.ShadowSettings.ShadowFactorGradientTolerance, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.StaticShadows"), TEXT("bAllowSignedDistanceFieldShadows"), bConfigBool, GLightmassIni));
Scene.ShadowSettings.bAllowSignedDistanceFieldShadows = bConfigBool;
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.StaticShadows"), TEXT("MaxTransitionDistanceWorldSpace"), Scene.ShadowSettings.MaxTransitionDistanceWorldSpace, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticShadows"), TEXT("ApproximateHighResTexelsPerMaxTransitionDistance"), Scene.ShadowSettings.ApproximateHighResTexelsPerMaxTransitionDistance, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticShadows"), TEXT("MinDistanceFieldUpsampleFactor"), Scene.ShadowSettings.MinDistanceFieldUpsampleFactor, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.StaticShadows"), TEXT("StaticShadowDepthMapTransitionSampleDistanceX"), Scene.ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceX, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.StaticShadows"), TEXT("StaticShadowDepthMapTransitionSampleDistanceY"), Scene.ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceY, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticShadows"), TEXT("StaticShadowDepthMapSuperSampleFactor"), Scene.ShadowSettings.StaticShadowDepthMapSuperSampleFactor, GLightmassIni));
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/TextureMapping.cpp:806
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ProcessTextureMapping
Source code excerpt:
&& (Light->LightFlags & GI_LIGHT_CASTSTATICSHADOWS)
&& (Light->LightFlags & GI_LIGHT_STORE_SEPARATE_SHADOW_FACTOR)
&& ShadowSettings.bAllowSignedDistanceFieldShadows)
{
if (Light->LightFlags & GI_LIGHT_USE_AREA_SHADOWS_FOR_SEPARATE_SHADOW_FACTOR)
{
FShadowMapData2D* ShadowMapData = new FShadowMapData2D(TextureMapping->CachedSizeX,TextureMapping->CachedSizeY);
CalculateDirectAreaLightingTextureMapping(TextureMapping, MappingContext, LightMapData, ShadowMapData, TexelToVertexMap, bDebugThisMapping, Light);
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:466
Scope (from outer to inner):
file
namespace Lightmass
class class FStaticShadowSettings
Source code excerpt:
/** Whether to allow signed distance field shadows, or fall back on area shadows. */
bool bAllowSignedDistanceFieldShadows;
/**
* Maximum world space distance stored from a texel to the shadow transition.
* Larger distances decrease precision but increase the maximum penumbra size that can be reconstructed from the distance field.
*/
float MaxTransitionDistanceWorldSpace;