ShowFlag.HISMCOcclusionBounds

ShowFlag.HISMCOcclusionBounds

#Overview

name: ShowFlag.HISMCOcclusionBounds

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.HISMCOcclusionBounds is to visualize the occlusion bounds used for Hierarchical Instanced Static Mesh Components (HISMC) and foliage in Unreal Engine 5. This setting is primarily used for debugging and optimization purposes in the rendering system.

This setting variable is relied upon by the Engine module, specifically within the Hierarchical Instanced Static Mesh rendering system. It is used in the FHierarchicalStaticMeshSceneProxy class, which is responsible for rendering instanced static meshes efficiently.

The value of this variable is set through the engine’s show flags system. It is defined in the ShowFlagsValues.inl file with the SHOWFLAG_FIXED_IN_SHIPPING macro, which means it’s only available in non-shipping builds for debugging purposes.

The HISMCOcclusionBounds variable interacts directly with the View->Family->EngineShowFlags structure, which contains various debug visualization options for the engine.

Developers must be aware that this variable is only available in non-shipping builds and is intended for debugging and optimization. It should not be relied upon for gameplay or visual features in a released game.

Best practices when using this variable include:

  1. Use it during development to visualize and debug occlusion issues with instanced static meshes and foliage.
  2. Combine it with other debugging tools to get a comprehensive view of the rendering process.
  3. Remember to disable it before shipping the game, as it’s not available in shipping builds.

Regarding the associated variable HISMCOcclusionBounds:

This is the actual flag used in the engine code to check if the occlusion bounds should be visualized. It’s used in the FHierarchicalStaticMeshSceneProxy::GetDynamicMeshElements function to draw wire boxes representing the occlusion bounds when the flag is enabled.

The purpose of HISMCOcclusionBounds is the same as ShowFlag.HISMCOcclusionBounds - to control the visualization of occlusion bounds for Hierarchical Instanced Static Meshes and foliage.

This variable is set through the engine’s show flags system and is used directly in the rendering code to determine whether to draw the debug visualization.

When using this variable, developers should be aware that enabling it may have a performance impact, especially in scenes with many instanced static meshes or foliage instances.

Best practices for using HISMCOcclusionBounds include:

  1. Use it sparingly and only when needed for debugging occlusion issues.
  2. Disable it when not actively debugging to avoid unnecessary performance overhead.
  3. Use it in conjunction with other debugging tools to get a complete picture of the rendering process for instanced static meshes and foliage.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedFoliage, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedFoliageSF", "Foliage"))
/** Allow to see the foliage bounds used in the occlusion test */
SHOWFLAG_FIXED_IN_SHIPPING(0, HISMCOcclusionBounds, SFG_Advanced, NSLOCTEXT("UnrealEd", "HISMOcclusionBoundsSF", "HISM/Foliage Occlusion Bounds"))
/** Allow to see the cluster tree bounds used used to generate the occlusion bounds and in the culling */
SHOWFLAG_FIXED_IN_SHIPPING(0, HISMCClusterTree, SFG_Advanced, NSLOCTEXT("UnrealEd", "HISMClusterTreeSF", "HISM/Foliage Cluster Tree"))
/** Allow to see where each instance is in each ISM Component */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeInstanceUpdates, SFG_Advanced, NSLOCTEXT("UnrealEd", "VisualizeInstanceUpdatesSF", "Visualize Instance Updates"))
/** Draws instanced grass, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedGrass, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedGrassSF", "Grass"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:1925

Scope (from outer to inner):

file
function     void FHierarchicalStaticMeshSceneProxy::GetDynamicMeshElements

Source code excerpt:

			}

			if (View->Family->EngineShowFlags.HISMCOcclusionBounds)
			{
				for (auto& OcclusionBound : OcclusionBounds)
				{
					DrawWireBox(Collector.GetPDI(ViewIndex), OcclusionBound.GetBox(), FColor(255, 0, 0), View->Family->EngineShowFlags.Game ? SDPG_World : SDPG_Foreground);
				}
			}

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedFoliage, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedFoliageSF", "Foliage"))
/** Allow to see the foliage bounds used in the occlusion test */
SHOWFLAG_FIXED_IN_SHIPPING(0, HISMCOcclusionBounds, SFG_Advanced, NSLOCTEXT("UnrealEd", "HISMOcclusionBoundsSF", "HISM/Foliage Occlusion Bounds"))
/** Allow to see the cluster tree bounds used used to generate the occlusion bounds and in the culling */
SHOWFLAG_FIXED_IN_SHIPPING(0, HISMCClusterTree, SFG_Advanced, NSLOCTEXT("UnrealEd", "HISMClusterTreeSF", "HISM/Foliage Cluster Tree"))
/** Allow to see where each instance is in each ISM Component */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeInstanceUpdates, SFG_Advanced, NSLOCTEXT("UnrealEd", "VisualizeInstanceUpdatesSF", "Visualize Instance Updates"))
/** Draws instanced grass, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedGrass, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedGrassSF", "Grass"))