ShowFlag.LightComplexity
ShowFlag.LightComplexity
#Overview
name: ShowFlag.LightComplexity
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.LightComplexity is to enable a visualization mode that displays the complexity of lighting in the scene. This setting variable is primarily used in the rendering system of Unreal Engine 5.
This setting variable is mainly relied upon by the Unreal Engine’s rendering module, particularly in the view setup and post-processing stages. It’s also used in the editor’s viewport system.
The value of this variable is set through the engine’s show flags system, which allows toggling various debug visualization modes. It’s defined as a fixed show flag that is not accessible in shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING macro.
ShowFlag.LightComplexity interacts with several other visualization modes and engine show flags. It’s often checked alongside other debug visualization flags like StationaryLightOverlap, LightMapDensity, and ShaderComplexity.
Developers should be aware that this variable is primarily intended for debugging and optimization purposes. When enabled, it alters the rendering output to visualize light complexity, which can impact performance and is not suitable for final, shipped versions of a game.
Best practices for using this variable include:
- Use it during development and optimization phases to identify areas of high lighting complexity.
- Disable it for final builds or performance testing of gameplay scenarios.
- Consider its impact on other rendering features when enabled, as it may override or interfere with certain visual effects.
The associated variable LightComplexity is essentially the same as ShowFlag.LightComplexity. It’s used in the same contexts and for the same purpose. The difference is mainly in how it’s accessed - ShowFlag.LightComplexity is typically used when working with the EngineShowFlags structure, while LightComplexity might be used directly in some code paths.
The LightComplexity variable is used in similar ways:
- It’s checked in view setup to determine if certain color scaling or fading effects should be applied.
- It’s one of the flags that can make a view “rich”, which may impact rendering decisions.
- It’s considered in post-processing stages, such as eye adaptation calculations.
The same best practices and considerations apply to LightComplexity as to ShowFlag.LightComplexity. Developers should treat them as effectively the same setting, used in slightly different contexts within the engine code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:205
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(LOD, SFG_Advanced, NSLOCTEXT("UnrealEd", "LODSF", "LOD Parenting"))
/** needed for VMI_LightComplexity */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightComplexity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightComplexitySF", "Light Complexity"))
/** needed for VMI_ShaderComplexity, render world colored by shader complexity */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexity, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexitySF", "Shader Complexity"))
/** needed for VMI_StationaryLightOverlap, render world colored by stationary light overlap */
SHOWFLAG_FIXED_IN_SHIPPING(0, StationaryLightOverlap, SFG_Hidden, NSLOCTEXT("UnrealEd", "StationaryLightOverlapSF", "Stationary Light Overlap"))
/** needed for VMI_LightmapDensity and VMI_LitLightmapDensity, render checkerboard material with UVs scaled by lightmap resolution w. color tint for world-space lightmap density */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightMapDensity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightMapDensitySF", "Light Map Density"))
#Associated Variable and Callsites
This variable is associated with another variable named LightComplexity
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/LevelEditorViewport.cpp:5224
Scope (from outer to inner):
file
function void FLevelEditorViewportClient::SetupViewForRendering
Source code excerpt:
// Don't use fading or color scaling while we're in light complexity mode, since it may change the colors!
if(!ViewFamily.EngineShowFlags.LightComplexity)
{
if(bEnableFading)
{
View.OverlayColor = FadeColor;
View.OverlayColor.A = FMath::Clamp(FadeAmount, 0.f, 1.f);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp:1534
Scope (from outer to inner):
file
function bool IsRichView
Source code excerpt:
// Flags which make the view rich when present.
if( ViewFamily.UseDebugViewPS() ||
ViewFamily.EngineShowFlags.LightComplexity ||
ViewFamily.EngineShowFlags.StationaryLightOverlap ||
ViewFamily.EngineShowFlags.BSPSplit ||
ViewFamily.EngineShowFlags.LightMapDensity ||
ViewFamily.EngineShowFlags.MeshEdges ||
ViewFamily.EngineShowFlags.LightInfluences ||
ViewFamily.EngineShowFlags.Wireframe ||
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:205
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(LOD, SFG_Advanced, NSLOCTEXT("UnrealEd", "LODSF", "LOD Parenting"))
/** needed for VMI_LightComplexity */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightComplexity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightComplexitySF", "Light Complexity"))
/** needed for VMI_ShaderComplexity, render world colored by shader complexity */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexity, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexitySF", "Shader Complexity"))
/** needed for VMI_StationaryLightOverlap, render world colored by stationary light overlap */
SHOWFLAG_FIXED_IN_SHIPPING(0, StationaryLightOverlap, SFG_Hidden, NSLOCTEXT("UnrealEd", "StationaryLightOverlapSF", "Stationary Light Overlap"))
/** needed for VMI_LightmapDensity and VMI_LitLightmapDensity, render checkerboard material with UVs scaled by lightmap resolution w. color tint for world-space lightmap density */
SHOWFLAG_FIXED_IN_SHIPPING(0, LightMapDensity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightMapDensitySF", "Light Map Density"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:1200
Scope (from outer to inner):
file
function void FViewInfo::UpdatePreExposure
Source code excerpt:
&& !ViewFamily.EngineShowFlags.LightMapDensity
&& !ViewFamily.EngineShowFlags.StationaryLightOverlap
&& !ViewFamily.EngineShowFlags.LightComplexity
&& !ViewFamily.EngineShowFlags.LODColoration
&& !ViewFamily.EngineShowFlags.HLODColoration
&& !ViewFamily.EngineShowFlags.ActorColoration
&& ((!ViewFamily.EngineShowFlags.VisualizeBuffer) || CurrentBufferVisualizationMode != NAME_None) // disable pre-exposure for the buffer visualization modes
&& !ViewFamily.EngineShowFlags.RayTracingDebug;