ShowFlag.VisualizeLightFunctionAtlas

ShowFlag.VisualizeLightFunctionAtlas

#Overview

name: ShowFlag.VisualizeLightFunctionAtlas

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.VisualizeLightFunctionAtlas is to enable the debug visualization of the light function atlas to be drawn on screen. This setting is part of the rendering system in Unreal Engine 5.

This setting variable is primarily used in the Renderer module of Unreal Engine 5. It is referenced in the post-processing passes of the rendering pipeline.

The value of this variable is set through the engine’s show flags system, which is typically controlled via the editor UI or through code. It’s defined as a fixed show flag that is not available in shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLightFunctionAtlas, SFG_Visualize, ...) macro.

The main variable that interacts with ShowFlag.VisualizeLightFunctionAtlas is the Scene’s LightFunctionAtlasSceneData. The visualization is only enabled if the light function atlas is enabled for the scene.

Developers should be aware that this visualization is a debug feature and is not available in shipping builds. It’s primarily used for development and debugging purposes.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging light function issues.
  2. Be aware that it may impact performance when enabled.
  3. Remember to disable it before creating a shipping build.

The associated variable VisualizeLightFunctionAtlas is actually the same variable, just referenced in different contexts. It’s used in the post-processing pass sequence to determine whether to add the light function atlas visualization pass. The same considerations and best practices apply to this variable as well.

In the post-processing pipeline, this flag is checked to determine whether to add the debug visualization pass for the light function atlas. If enabled and the light function atlas exists for the scene, it will add the debug visualization to the scene color render target.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:401

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSkyAtmosphere, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSkyAtmosphereSF", "Sky Atmosphere"))
/** Enable the light function atlas debug visualization to be drawn on screen */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLightFunctionAtlas, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeLightFunctionAtlasSF", "Visualize Light Function Atlas"))
/** Shows a full-screen calibration color post process material defined in renderer config  */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeCalibrationColor, SFG_Developer, NSLOCTEXT("UnrealEd", "VisualizeCalibrationColorSF", "Visualize Calibration Color"))
/** Shows a full-screen calibration grayscale post process material defined in renderer config  */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeCalibrationGrayscale, SFG_Developer, NSLOCTEXT("UnrealEd", "VisualizeCalibrationGrayscaleSF", "Visualize Calibration Grayscale"))
/** Shows a full-screen calibration custom post process material defined in renderer config  */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeCalibrationCustom, SFG_Developer, NSLOCTEXT("UnrealEd", "VisualizeCalibrationCustomSF", "Visualize Calibration Custom"))

#Associated Variable and Callsites

This variable is associated with another variable named VisualizeLightFunctionAtlas. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:401

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSkyAtmosphere, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSkyAtmosphereSF", "Sky Atmosphere"))
/** Enable the light function atlas debug visualization to be drawn on screen */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLightFunctionAtlas, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeLightFunctionAtlasSF", "Visualize Light Function Atlas"))
/** Shows a full-screen calibration color post process material defined in renderer config  */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeCalibrationColor, SFG_Developer, NSLOCTEXT("UnrealEd", "VisualizeCalibrationColorSF", "Visualize Calibration Color"))
/** Shows a full-screen calibration grayscale post process material defined in renderer config  */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeCalibrationGrayscale, SFG_Developer, NSLOCTEXT("UnrealEd", "VisualizeCalibrationGrayscaleSF", "Visualize Calibration Grayscale"))
/** Shows a full-screen calibration custom post process material defined in renderer config  */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeCalibrationCustom, SFG_Developer, NSLOCTEXT("UnrealEd", "VisualizeCalibrationCustomSF", "Visualize Calibration Custom"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:375

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

		VisualizeSkyAtmosphere,
		VisualizeSkyLightIlluminanceMeter,
		VisualizeLightFunctionAtlas,
		VisualizeLevelInstance,
		SelectionOutline,
		EditorPrimitive,
		VisualizeShadingModels,
		VisualizeGBufferHints,
		VisualizeSubsurface,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:471

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

	PassSequence.SetEnabled(EPass::VisualizeSkyAtmosphere, Scene&& View.Family && View.Family->EngineShowFlags.VisualizeSkyAtmosphere && ShouldRenderSkyAtmosphereDebugPasses(Scene, View.Family->EngineShowFlags));
	PassSequence.SetEnabled(EPass::VisualizeSkyLightIlluminanceMeter, Scene&& Scene->SkyLight && View.Family && View.Family->EngineShowFlags.VisualizeSkyLightIlluminance);
	PassSequence.SetEnabled(EPass::VisualizeLightFunctionAtlas, Scene && Scene->LightFunctionAtlasSceneData.GetLightFunctionAtlasEnabled() && View.Family && View.Family->EngineShowFlags.VisualizeLightFunctionAtlas);
	PassSequence.SetEnabled(EPass::VisualizeLevelInstance, GIsEditor && EngineShowFlags.EditingLevelInstance && EngineShowFlags.VisualizeLevelInstanceEditing && !bVisualizeHDR);
	PassSequence.SetEnabled(EPass::SelectionOutline, GIsEditor && EngineShowFlags.Selection && EngineShowFlags.SelectionOutline && !EngineShowFlags.Wireframe && !bVisualizeHDR);
	PassSequence.SetEnabled(EPass::EditorPrimitive, FSceneRenderer::ShouldCompositeEditorPrimitives(View));
#else
	PassSequence.SetEnabled(EPass::VisualizeSkyAtmosphere, false);
	PassSequence.SetEnabled(EPass::VisualizeSkyLightIlluminanceMeter, false);
	PassSequence.SetEnabled(EPass::VisualizeLightFunctionAtlas, false);
	PassSequence.SetEnabled(EPass::VisualizeLevelInstance, false);
	PassSequence.SetEnabled(EPass::SelectionOutline, false);
	PassSequence.SetEnabled(EPass::EditorPrimitive, false);
#endif
	PassSequence.SetEnabled(EPass::VisualizeShadingModels, EngineShowFlags.VisualizeShadingModels);
	PassSequence.SetEnabled(EPass::VisualizeGBufferHints, EngineShowFlags.GBufferHints);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1465

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

	}

	if (PassSequence.IsEnabled(EPass::VisualizeLightFunctionAtlas))
	{
		FScreenPassRenderTarget OverrideOutput;
		PassSequence.AcceptOverrideIfLastPass(EPass::VisualizeLightFunctionAtlas, OverrideOutput);
		if (Scene->LightFunctionAtlasSceneData.GetLightFunctionAtlas())
		{
			SceneColor = Scene->LightFunctionAtlasSceneData.GetLightFunctionAtlas()->AddDebugVisualizationPasses(GraphBuilder, View, SceneColor);
		}
	}