MaxLightMapDensity
MaxLightMapDensity
#Overview
name: MaxLightMapDensity
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaxLightMapDensity is to set the maximum lightmap density value for coloring in Unreal Engine’s lighting system. This variable is part of the engine’s rendering and lighting subsystem, specifically dealing with lightmap density visualization and control.
The Unreal Engine subsystems that rely on this setting variable are primarily the rendering system and the level editor. It’s used in the LevelEditor module and the Renderer module.
The value of this variable is set in the UEngine class as a UPROPERTY with the globalconfig specifier, meaning it can be configured globally in the engine’s configuration files. It can also be modified at runtime through the SetLightingDensityMaximum function in the LevelEditorActions.
MaxLightMapDensity interacts closely with other lighting-related variables, particularly IdealLightMapDensity and MinLightMapDensity. The engine ensures that MaxLightMapDensity is always slightly larger than IdealLightMapDensity to maintain a proper range for lightmap density values.
Developers must be aware that changing MaxLightMapDensity affects the upper limit of lightmap density visualization and calculations. It’s crucial for maintaining the balance between lighting quality and performance, as higher density values can lead to increased memory usage and longer build times.
Best practices when using this variable include:
- Keeping it properly balanced with IdealLightMapDensity and MinLightMapDensity.
- Adjusting it carefully to find the sweet spot between lighting quality and performance for your specific project.
- Being mindful of its impact on memory usage and build times when increasing its value.
- Using it in conjunction with lightmap density visualization tools in the editor to optimize lighting in your scenes.
- Considering platform-specific limitations when setting this value, especially for mobile or lower-end devices.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:290, section: [/Script/Engine.Engine]
- INI Section:
/Script/Engine.Engine
- Raw value:
0.8
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:971
Scope (from outer to inner):
file
function void FLevelEditorActionCallbacks::SetLightingDensityIdeal
Source code excerpt:
// We need to make sure that Maximum is always slightly larger than ideal...
if (GEngine->IdealLightMapDensity >= GEngine->MaxLightMapDensity - 0.01f)
{
SetLightingDensityMaximum( GEngine->IdealLightMapDensity + 0.01f );
}
FEditorSupportDelegates::RedrawAllViewports.Broadcast();
}
#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:981
Scope (from outer to inner):
file
function float FLevelEditorActionCallbacks::GetLightingDensityMaximum
Source code excerpt:
float FLevelEditorActionCallbacks::GetLightingDensityMaximum()
{
return ( GEngine->MaxLightMapDensity );
}
void FLevelEditorActionCallbacks::SetLightingDensityMaximum( float Value )
{
GEngine->MaxLightMapDensity = Value;
// We need to make sure that Maximum is always slightly larger than ideal...
if (GEngine->MaxLightMapDensity <= GEngine->IdealLightMapDensity + 0.01f)
{
GEngine->MaxLightMapDensity = GEngine->IdealLightMapDensity + 0.01f;
}
FEditorSupportDelegates::RedrawAllViewports.Broadcast();
}
float FLevelEditorActionCallbacks::GetLightingDensityColorScale()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:1268
Scope (from outer to inner):
file
class class UEngine : public UObject , public FExec
Source code excerpt:
/** Maximum lightmap density value for coloring. */
UPROPERTY(globalconfig)
float MaxLightMapDensity;
/** If true, then render gray scale density. */
UPROPERTY(globalconfig)
uint32 bRenderLightMapDensityGrayscale:1;
/** The scale factor when rendering gray scale density. */
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightMapDensityRendering.cpp:57
Scope (from outer to inner):
file
function void SetupLightmapDensityPassUniformBuffer
Source code excerpt:
GEngine->MinLightMapDensity * GEngine->MinLightMapDensity,
GEngine->IdealLightMapDensity * GEngine->IdealLightMapDensity,
GEngine->MaxLightMapDensity * GEngine->MaxLightMapDensity);
LightmapDensityPassParameters.DensitySelectedColor = GEngine->LightMapDensitySelectedColor;
LightmapDensityPassParameters.VertexMappedColor = GEngine->LightMapDensityVertexMappedColor;
}