ShowFlag.HLODColoration

ShowFlag.HLODColoration

#Overview

name: ShowFlag.HLODColoration

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

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.HLODColoration is to visualize Hierarchical Level of Detail (HLOD) coloration in Unreal Engine 5. This setting is primarily used for debugging and optimization purposes in the rendering system.

ShowFlag.HLODColoration is primarily used in the rendering subsystem of Unreal Engine 5. It is referenced in various modules, including the Engine, Renderer, and Editor modules.

The value of this variable is set through the engine show flags system, which is typically controlled via the editor interface or through code.

ShowFlag.HLODColoration interacts closely with other visualization flags, particularly ShowFlag.LODColoration. They are often used in similar contexts for visualizing different aspects of level of detail systems.

Developers should be aware that:

  1. This flag is only available in non-shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING macro.
  2. It’s primarily a debugging tool and should not be relied upon for gameplay or final visuals.
  3. Using this flag may impact performance, as it requires additional rendering passes.

Best practices when using this variable include:

  1. Use it in conjunction with other debugging tools to optimize HLOD systems.
  2. Remember to disable it before final builds or performance testing.
  3. Be cautious when using it in large scenes, as it may significantly impact rendering performance.

Regarding the associated variable HLODColoration:

The purpose of HLODColoration is to store the actual coloration data for HLOD visualization. It is used in conjunction with ShowFlag.HLODColoration to determine how HLOD levels should be visually represented.

HLODColoration is primarily used in the rendering subsystem, particularly in debug view mode rendering.

The value of HLODColoration is typically set in the engine’s initialization process and can be accessed through GEngine->HLODColorationColors.

This variable interacts closely with ShowFlag.HLODColoration and is often used in comparison with LODColoration for different level of detail visualizations.

Developers should be aware that:

  1. The colors stored in HLODColoration are used to represent different HLOD levels visually.
  2. The number of colors available may be limited, as seen in the code that caps it to NumLODColorationColors.

Best practices when using HLODColoration include:

  1. Ensure that the colors chosen for HLOD visualization are distinct and easily distinguishable.
  2. Consider the needs of colorblind users when selecting colors for visualization.
  3. Use this in conjunction with other HLOD optimization tools for the best results in level of detail management.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, LODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLODColoration", "Visualize LOD Coloration"))
/** Visualize HLOD Coloration */
SHOWFLAG_FIXED_IN_SHIPPING(0, HLODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeHLODColoration", "Visualize HLOD Coloration"))
/** Visualize screen quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, QuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "QuadOverdrawSF", "Quad Overdraw"))
/** Visualize the overhead of material quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexityWithQuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexityWithQuadOverdraw", "Shader Complexity With Quad Overdraw"))
/** Visualize the accuracy of the primitive distance computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrimitiveDistanceAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "PrimitiveDistanceAccuracy", "Primitive Distance Accuracy"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp:1543

Scope (from outer to inner):

file
function     bool IsRichView

Source code excerpt:

		ViewFamily.EngineShowFlags.ActorColoration ||
		ViewFamily.EngineShowFlags.LODColoration ||
		ViewFamily.EngineShowFlags.HLODColoration ||
		ViewFamily.EngineShowFlags.MassProperties )
	{
		return true;
	}

	return false;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:3095

Scope (from outer to inner):

file
function     EDebugViewShaderMode FSceneViewFamily::ChooseDebugViewShaderMode

Source code excerpt:

		return DVSM_VirtualTexturePendingMips;
	}
	else if (EngineShowFlags.LODColoration || EngineShowFlags.HLODColoration)
	{
		return DVSM_LODColoration;
	}
	else if (EngineShowFlags.VisualizeGPUSkinCache)
	{
		return DVSM_VisualizeGPUSkinCache;

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

Scope: file

Source code excerpt:

		return VMI_LODColoration;
	}
	else if (EngineShowFlags.HLODColoration)
	{
		return VMI_HLODColoration;
	}
	else if (EngineShowFlags.PathTracing)
	{
		return VMI_PathTracing;

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, LODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLODColoration", "Visualize LOD Coloration"))
/** Visualize HLOD Coloration */
SHOWFLAG_FIXED_IN_SHIPPING(0, HLODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeHLODColoration", "Visualize HLOD Coloration"))
/** Visualize screen quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, QuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "QuadOverdrawSF", "Quad Overdraw"))
/** Visualize the overhead of material quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexityWithQuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexityWithQuadOverdraw", "Shader Complexity With Quad Overdraw"))
/** Visualize the accuracy of the primitive distance computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrimitiveDistanceAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "PrimitiveDistanceAccuracy", "Primitive Distance Accuracy"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:1047

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderBasePass

Source code excerpt:

			ViewFamily.EngineShowFlags.ShaderComplexity ||
			ViewFamily.EngineShowFlags.LODColoration ||
			ViewFamily.EngineShowFlags.HLODColoration);

	const bool bForwardShadingEnabled = IsForwardShadingEnabled(SceneTextures.Config.ShaderPlatform);

	const FExclusiveDepthStencil ExclusiveDepthStencil(BasePassDepthStencilAccess);

	TStaticArray<FTextureRenderTargetBinding, MaxSimultaneousRenderTargets> BasePassTextures;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DebugViewModeRendering.cpp:127

Scope (from outer to inner):

file
function     void SetupDebugViewModePassUniformBufferConstants

Source code excerpt:

			Colors = &(GEngine->LODColorationColors);
		}
		else if (ViewInfo.Family->EngineShowFlags.HLODColoration)
		{
			Colors = &GEngine->HLODColorationColors;
		}

		const int32 NumColors = Colors ? FMath::Min<int32>(NumLODColorationColors, Colors->Num()) : 0;
		int32 ColorIndex = 0;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DebugViewModeRendering.cpp:407

Scope (from outer to inner):

file
function     void FDebugViewModeMeshProcessor::AddMeshBatch

Source code excerpt:

		DebugViewMode, 
		ViewIfDynamicMeshCommand ? ViewIfDynamicMeshCommand->ViewMatrices.GetViewOrigin() : FVector::ZeroVector, 
		(ViewIfDynamicMeshCommand && ViewIfDynamicMeshCommand->Family->EngineShowFlags.HLODColoration) ? MeshBatch.VisualizeHLODIndex : MeshBatch.VisualizeLODIndex,
		(ViewIfDynamicMeshCommand && ViewIfDynamicMeshCommand->Family->EngineShowFlags.VisualizeGPUSkinCache) ? MeshBatch.Elements[0].SkinCacheDebugColor : FColor::White,
		ViewModeParam, 
		ViewModeParamName);

	// Shadermap can be null while shaders are compiling.
	UpdateInstructionCount(ShaderElementData, BatchMaterial, VertexFactoryType);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:1202

Scope (from outer to inner):

file
function     void FViewInfo::UpdatePreExposure

Source code excerpt:

		&& !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;

	// Compute the PreExposure to use.
	bool bUpdateLastExposure = false;