ShowFlag.VisualizeSubstrate

ShowFlag.VisualizeSubstrate

#Overview

name: ShowFlag.VisualizeSubstrate

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

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.VisualizeSubstrate is to enable the Substrate visualization mode in Unreal Engine 5. This setting is primarily used for debugging and visualizing the Substrate rendering system, which is a part of the engine’s rendering pipeline.

This setting variable is mainly relied upon by the Rendering subsystem of Unreal Engine 5. Specifically, it’s used in the post-processing and visualization modules of the renderer.

The value of this variable is set through the engine’s show flags system, which allows developers to toggle various visualization and debug modes. It can be accessed and modified through the engine’s user interface or programmatically.

ShowFlag.VisualizeSubstrate interacts closely with the associated variable VisualizeSubstrate. They share the same value and are used interchangeably in different parts of the code.

Developers should be aware that this variable is primarily intended for debugging and visualization purposes. It’s not meant to be used in shipping builds, as indicated by its presence in the SFG_Hidden (Show Flag Group Hidden) category.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Be aware that enabling this visualization mode may impact performance.
  3. Understand that it’s part of a broader set of visualization tools in Unreal Engine, and may be used in conjunction with other debug views.

Regarding the associated variable VisualizeSubstrate:

The purpose of VisualizeSubstrate is the same as ShowFlag.VisualizeSubstrate - to enable the Substrate visualization mode. It’s used in various parts of the rendering pipeline to determine if Substrate visualization should be active.

This variable is used in the Renderer module, particularly in post-processing passes and view mode selection.

The value of VisualizeSubstrate is set based on the engine show flags, specifically the VisualizeSubstrate flag.

It interacts closely with ShowFlag.VisualizeSubstrate, sharing the same value. It’s also used in conjunction with other visualization modes like VisualizeLumen and VisualizeGroom.

Developers should be aware that this variable is used to control the addition of Substrate debug passes in the rendering pipeline. It’s important to note that these debug passes may have performance implications.

Best practices for using VisualizeSubstrate include:

  1. Use it in conjunction with other debug tools to get a comprehensive view of the rendering process.
  2. Be mindful of its performance impact when enabled.
  3. Remember to disable it in production builds to ensure optimal performance.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeLumen, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLumenSF", "Lumen Visualization"))
/** Needed for VMI_VisualizeSubstrate, Whether to enable the Substrate visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeSubstrate, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeSubstrateSF", "Substrate Visualization"))
/** Needed for VMI_VisualizeGroom, Whether to enable the Groom visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeGroom, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeGroomSF", "Groom Visualization"))
/** Needed for VMI_VisualizeVirtualShadowMap, Whether to enable the virtual shadow map visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeVirtualShadowMap, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeVirtualShadowMapSF", "Virtual Shadow Map Visualization"))
/** Allows to disable all direct lighting (does not affect indirect light) */
SHOWFLAG_FIXED_IN_SHIPPING(1, DirectLighting, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "DirectLightingSF", "Direct Lighting"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:711

Scope (from outer to inner):

file
function     EViewModeIndex FindViewMode

Source code excerpt:

		return VMI_VisualizeLumen;
	}
	else if (EngineShowFlags.VisualizeSubstrate)
	{
		return VMI_VisualizeSubstrate;
	}
	else if (EngineShowFlags.VisualizeGroom)
	{
		return VMI_VisualizeGroom;

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeLumen, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLumenSF", "Lumen Visualization"))
/** Needed for VMI_VisualizeSubstrate, Whether to enable the Substrate visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeSubstrate, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeSubstrateSF", "Substrate Visualization"))
/** Needed for VMI_VisualizeGroom, Whether to enable the Groom visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeGroom, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeGroomSF", "Groom Visualization"))
/** Needed for VMI_VisualizeVirtualShadowMap, Whether to enable the virtual shadow map visualization mode. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VisualizeVirtualShadowMap, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeVirtualShadowMapSF", "Virtual Shadow Map Visualization"))
/** Allows to disable all direct lighting (does not affect indirect light) */
SHOWFLAG_FIXED_IN_SHIPPING(1, DirectLighting, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "DirectLightingSF", "Direct Lighting"))

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

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

		VisualizeLightCulling,
		VisualizePostProcessStack,
		VisualizeSubstrate,
		VisualizeLightGrid,
		VisualizeSkyAtmosphere,
		VisualizeSkyLightIlluminanceMeter,
		VisualizeLightFunctionAtlas,
		VisualizeLevelInstance,
		SelectionOutline,

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

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

#endif
	PassSequence.SetEnabled(EPass::VisualizeLumenScene, LumenVisualizeMode >= 0 && LumenVisualizeMode != VISUALIZE_MODE_OVERVIEW && LumenVisualizeMode != VISUALIZE_MODE_PERFORMANCE_OVERVIEW && bPostProcessingEnabled);
	PassSequence.SetEnabled(EPass::VisualizeSubstrate, Substrate::ShouldRenderSubstrateDebugPasses(View));
	PassSequence.SetEnabled(EPass::VisualizeLightGrid, ShouldVisualizeLightGrid());

#if WITH_EDITOR
	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);

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

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

#endif

	if (PassSequence.IsEnabled(EPass::VisualizeSubstrate))
	{
		FScreenPassRenderTarget OverrideOutput;
		PassSequence.AcceptOverrideIfLastPass(EPass::VisualizeSubstrate, OverrideOutput);

		FScreenPassTexture DebugColorOutput = Substrate::AddSubstrateDebugPasses(GraphBuilder, View, SceneColor);
		if (OverrideOutput.IsValid())
		{
			AddDrawTexturePass(GraphBuilder, View, DebugColorOutput, OverrideOutput);
			SceneColor = OverrideOutput;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/SubstrateVisualize.cpp:439

Scope (from outer to inner):

file
namespace    Substrate
function     static FSubstrateViewMode GetSubstrateVisualizeMode

Source code excerpt:


		const FSubstrateVisualizationData& VisualizationData = GetSubstrateVisualizationData();
		if (View.Family && View.Family->EngineShowFlags.VisualizeSubstrate)
		{
			Out = VisualizationData.GetViewMode(View.CurrentSubstrateVisualizationMode);
		}
	}
	return Out;
}