StaticShadowDepthMapTransitionSampleDistanceY
StaticShadowDepthMapTransitionSampleDistanceY
#Overview
name: StaticShadowDepthMapTransitionSampleDistanceY
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 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of StaticShadowDepthMapTransitionSampleDistanceY is to control the spacing between shadow map samples in the Y-axis for static shadows in Unreal Engine’s lighting system. It is used in conjunction with StaticShadowDepthMapTransitionSampleDistanceX to determine the resolution and quality of static shadow depth maps.
This setting variable is primarily used in the GPULightmass plugin and the Lightmass system, which are responsible for generating high-quality static lighting and shadows in Unreal Engine. The main subsystems that rely on this variable are:
- GPULightmass: Used in the rendering of static shadow depth maps for various light types (directional, spot, point, and rect lights).
- Lightmass: Used in the UnrealLightmass program for static lighting calculations.
The value of this variable is typically set in the Lightmass configuration file (Lightmass.ini) under the [DevOptions.StaticShadows] section. It can be read and modified through the GConfig system in Unreal Engine.
This variable interacts closely with StaticShadowDepthMapTransitionSampleDistanceX, as they are often used together to calculate the dimensions of shadow maps. It also interacts with other shadow-related settings like StaticShadowDepthMapMaxSamples and StaticShadowDepthMapSuperSampleFactor.
Developers should be aware that:
- This variable directly affects the resolution and quality of static shadow maps.
- Smaller values will result in higher resolution shadow maps but may increase memory usage and build times.
- The value is scaled by the StaticLightingLevelScale, so it’s affected by the overall scale of the level.
Best practices when using this variable include:
- Balancing between shadow quality and performance by adjusting this value alongside StaticShadowDepthMapTransitionSampleDistanceX.
- Considering the scale of your level when setting this value.
- Monitoring memory usage and build times when adjusting this setting, especially for large scenes.
- Using the same value for both X and Y distances unless there’s a specific reason to have different resolutions in each axis.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseLightmass.ini:148, section: [DevOptions.StaticShadows]
- INI Section:
DevOptions.StaticShadows
- Raw value:
100
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/Scene/Lights.cpp:410
Scope (from outer to inner):
file
namespace GPULightmass
function void FDirectionalLightRenderState::RenderStaticShadowDepthMap
Source code excerpt:
const float ClampedResolutionScale = 1.0f;
const float StaticShadowDepthMapTransitionSampleDistanceX = 10;
const float StaticShadowDepthMapTransitionSampleDistanceY = 10;
int32 ShadowMapSizeX = FMath::TruncToInt(FMath::Max(LightSpaceImportanceBounds.GetExtent().X * 2.0f * ClampedResolutionScale / StaticShadowDepthMapTransitionSampleDistanceX, 4.0f));
int32 ShadowMapSizeY = FMath::TruncToInt(FMath::Max(LightSpaceImportanceBounds.GetExtent().Y * 2.0f * ClampedResolutionScale / StaticShadowDepthMapTransitionSampleDistanceY, 4.0f));
const uint64 StaticShadowDepthMapMaxSamples = 16777216;
// Clamp the number of dominant shadow samples generated if necessary while maintaining aspect ratio
if ((uint64)ShadowMapSizeX * (uint64)ShadowMapSizeY > StaticShadowDepthMapMaxSamples)
{
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/Scene/Lights.cpp:518
Scope (from outer to inner):
file
namespace GPULightmass
function void FSpotLightRenderState::RenderStaticShadowDepthMap
Source code excerpt:
const float ClampedResolutionScale = 1.0f;
const float StaticShadowDepthMapTransitionSampleDistanceX = 10;
const float StaticShadowDepthMapTransitionSampleDistanceY = 10;
int32 ShadowMapSizeX = FMath::TruncToInt(FMath::Max(HalfCrossSectionLength * ClampedResolutionScale / StaticShadowDepthMapTransitionSampleDistanceX, 4.0f));
int32 ShadowMapSizeY = ShadowMapSizeX;
const uint64 StaticShadowDepthMapMaxSamples = 16777216;
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/Scene/Lights.cpp:624
Scope (from outer to inner):
file
namespace GPULightmass
function void FPointLightRenderState::RenderStaticShadowDepthMap
Source code excerpt:
const float ClampedResolutionScale = 1.0f;
const float StaticShadowDepthMapTransitionSampleDistanceX = 10;
const float StaticShadowDepthMapTransitionSampleDistanceY = 10;
int32 ShadowMapSizeX = FMath::TruncToInt(FMath::Max(AttenuationRadius * 4 * ClampedResolutionScale / StaticShadowDepthMapTransitionSampleDistanceX, 4.0f));
int32 ShadowMapSizeY = ShadowMapSizeX;
const uint64 StaticShadowDepthMapMaxSamples = 16777216;
#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/Scene/Lights.cpp:718
Scope (from outer to inner):
file
namespace GPULightmass
function void FRectLightRenderState::RenderStaticShadowDepthMap
Source code excerpt:
const float ClampedResolutionScale = 1.0f;
const float StaticShadowDepthMapTransitionSampleDistanceX = 10;
const float StaticShadowDepthMapTransitionSampleDistanceY = 10;
int32 ShadowMapSizeX = FMath::TruncToInt(FMath::Max(AttenuationRadius * 4 * ClampedResolutionScale / StaticShadowDepthMapTransitionSampleDistanceX, 4.0f));
int32 ShadowMapSizeY = ShadowMapSizeX;
const uint64 StaticShadowDepthMapMaxSamples = 16777216;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2319
Scope (from outer to inner):
file
function void FLightmassExporter::WriteSceneSettings
Source code excerpt:
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));
VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.StaticShadows"), TEXT("StaticShadowDepthMapMaxSamples"), Scene.ShadowSettings.StaticShadowDepthMapMaxSamples, GLightmassIni));
VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.StaticShadows"), TEXT("MinUnoccludedFraction"), Scene.ShadowSettings.MinUnoccludedFraction, GLightmassIni));
}
{
VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.ImportanceTracing"), TEXT("bUseStratifiedSampling"), bConfigBool, GLightmassIni));
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/ImportExport/LightmassScene.cpp:525
Scope (from outer to inner):
file
namespace Lightmass
function void FScene::ApplyStaticLightingScale
Source code excerpt:
ShadowSettings.MaxTransitionDistanceWorldSpace *= SceneConstants.StaticLightingLevelScale;
ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceX *= SceneConstants.StaticLightingLevelScale;
ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceY *= SceneConstants.StaticLightingLevelScale;
IrradianceCachingSettings.RecordRadiusScale *= SceneConstants.StaticLightingLevelScale;
IrradianceCachingSettings.MaxRecordRadius *= SceneConstants.StaticLightingLevelScale;
// Photon mapping does not scale down properly, so this is disabled
/*
PhotonMappingSettings.IndirectPhotonEmitDiskRadius *= SceneConstants.StaticLightingLevelScale;
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingSystem.cpp:949
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ValidateSettings
Source code excerpt:
ShadowSettings.MinDistanceFieldUpsampleFactor = FMath::Clamp(ShadowSettings.MinDistanceFieldUpsampleFactor - ShadowSettings.MinDistanceFieldUpsampleFactor % 2 + 1, 1, 17);
ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceX = FMath::Max(ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceX, DELTA);
ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceY = FMath::Max(ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceY, DELTA);
InScene.IrradianceCachingSettings.InterpolationMaxAngle = FMath::Clamp(InScene.IrradianceCachingSettings.InterpolationMaxAngle, 0.0f, 90.0f);
InScene.IrradianceCachingSettings.PointBehindRecordMaxAngle = FMath::Clamp(InScene.IrradianceCachingSettings.PointBehindRecordMaxAngle, 0.0f, 90.0f);
InScene.IrradianceCachingSettings.DistanceSmoothFactor = FMath::Max(InScene.IrradianceCachingSettings.DistanceSmoothFactor, 1.0f);
InScene.IrradianceCachingSettings.AngleSmoothFactor = FMath::Max(InScene.IrradianceCachingSettings.AngleSmoothFactor, 1.0f);
InScene.IrradianceCachingSettings.SkyOcclusionSmoothnessReduction = FMath::Clamp(InScene.IrradianceCachingSettings.SkyOcclusionSmoothnessReduction, 0.1f, 1.0f);
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingSystem.cpp:2108
Scope (from outer to inner):
file
namespace Lightmass
function void FStaticLightingSystem::ValidateSettings
function void FStaticLightingSystem::CalculateStaticShadowDepthMap
Source code excerpt:
ShadowDepthMap->ShadowMapSizeX = FMath::TruncToInt(FMath::Max(LightSpaceImportanceBounds.GetExtent().X * 2.0f * ClampedResolutionScale / ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceX, 4.0f));
ShadowDepthMap->ShadowMapSizeX = ShadowDepthMap->ShadowMapSizeX == appTruncErrorCode ? INT_MAX : ShadowDepthMap->ShadowMapSizeX;
ShadowDepthMap->ShadowMapSizeY = FMath::TruncToInt(FMath::Max(LightSpaceImportanceBounds.GetExtent().Y * 2.0f * ClampedResolutionScale / ShadowSettings.StaticShadowDepthMapTransitionSampleDistanceY, 4.0f));
ShadowDepthMap->ShadowMapSizeY = ShadowDepthMap->ShadowMapSizeY == appTruncErrorCode ? INT_MAX : ShadowDepthMap->ShadowMapSizeY;
// Clamp the number of dominant shadow samples generated if necessary while maintaining aspect ratio
if ((uint64)ShadowDepthMap->ShadowMapSizeX * (uint64)ShadowDepthMap->ShadowMapSizeY > (uint64)ShadowSettings.StaticShadowDepthMapMaxSamples)
{
const float AspectRatio = ShadowDepthMap->ShadowMapSizeX / (float)ShadowDepthMap->ShadowMapSizeY;
#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:488
Scope (from outer to inner):
file
namespace Lightmass
class class FStaticShadowSettings
Source code excerpt:
/** Distance in world space units between dominant light shadow map cells. */
float StaticShadowDepthMapTransitionSampleDistanceX;
float StaticShadowDepthMapTransitionSampleDistanceY;
/** Amount to super sample dominant shadow map generation, in each dimension. Larger factors increase build time but produce a more conservative shadow map. */
int32 StaticShadowDepthMapSuperSampleFactor;
/** Maximum number of dominant shadow samples to generate for one dominant light, used to limit memory used. */
int32 StaticShadowDepthMapMaxSamples;