ShowFlag.InstancedStaticMeshes
ShowFlag.InstancedStaticMeshes
#Overview
name: ShowFlag.InstancedStaticMeshes
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.InstancedStaticMeshes is to control the visibility of instanced static meshes in the rendering system of Unreal Engine 5. This setting is specifically for instanced static meshes that are not foliage or grass.
This setting variable is primarily used in the rendering system, particularly in the Engine and Renderer modules of Unreal Engine 5. It affects how instanced static meshes are processed and displayed in the scene.
The value of this variable is set through the engine’s show flags system, which allows developers and users to toggle various rendering features on and off. It’s accessible through the SceneCapture system and is always accessible (SHOWFLAG_ALWAYS_ACCESSIBLE), meaning it can be modified at runtime.
The InstancedStaticMeshes variable interacts closely with other show flags, particularly those related to other types of instanced geometry like InstancedFoliage. It’s also used in conjunction with view relevance checks and dynamic mesh element generation.
Developers should be aware that this flag affects both the visibility of instanced static meshes in the main view and their representation in debug views. When disabled, it can significantly change the appearance of a scene that heavily relies on instanced static meshes.
Best practices for using this variable include:
- Ensuring it’s enabled when instanced static meshes are a crucial part of your scene.
- Using it in conjunction with performance profiling to understand the impact of instanced static meshes on rendering performance.
- Considering its state when debugging rendering issues, as it can affect what’s visible in the scene.
The associated variable InstancedStaticMeshes is essentially the same as ShowFlag.InstancedStaticMeshes. It’s used in various parts of the engine code to check whether instanced static meshes should be rendered or included in view relevance calculations. This variable is typically accessed through the EngineShowFlags property of the view family (View->Family->EngineShowFlags.InstancedStaticMeshes).
The usage of InstancedStaticMeshes follows the same patterns and best practices as ShowFlag.InstancedStaticMeshes. It’s crucial for controlling the visibility and processing of instanced static meshes throughout the rendering pipeline.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:175
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(LightFunctions, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "LightFunctionsSF", "Light Functions"))
/** Draws instanced static meshes that are not foliage or grass, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedStaticMeshes, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedStaticMeshesSF", "Instanced Static Meshes"))
/** Draws instanced foliage, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
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"))
#Associated Variable and Callsites
This variable is associated with another variable named InstancedStaticMeshes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/InstancedStaticMesh.h:447
Scope (from outer to inner):
file
class class FInstancedStaticMeshSceneProxy : public FStaticMeshSceneProxy
function virtual FPrimitiveViewRelevance GetViewRelevance
Source code excerpt:
{
FPrimitiveViewRelevance Result;
if(View->Family->EngineShowFlags.InstancedStaticMeshes)
{
Result = FStaticMeshSceneProxy::GetViewRelevance(View);
#if WITH_EDITOR
// use dynamic path to render selected indices
if( bHasSelectedInstances )
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:877
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FHierarchicalStaticMeshSceneProxy::GetViewRelevance
Source code excerpt:
break;
case EHISMViewRelevanceType::HISM:
bShowInstancedMesh = View->Family->EngineShowFlags.InstancedStaticMeshes;
break;
default:
break;
}
if (bShowInstancedMesh)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:1947
Scope (from outer to inner):
file
function void FHierarchicalStaticMeshSceneProxy::GetDynamicMeshElements
Source code excerpt:
}
if (View->Family->EngineShowFlags.InstancedStaticMeshes)
{
RenderBounds(Collector.GetPDI(ViewIndex), ViewFamily.EngineShowFlags, GetBounds(), IsSelected());
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/InstancedStaticMesh.cpp:1125
Scope (from outer to inner):
file
function void FInstancedStaticMeshSceneProxy::GetDynamicMeshElements
Source code excerpt:
if(AllowDebugViewmodes())
{
if (ViewFamily.EngineShowFlags.InstancedStaticMeshes)
{
RenderBounds(Collector.GetPDI(ViewIndex), ViewFamily.EngineShowFlags, GetBounds(), IsSelected());
}
}
#endif
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:175
Scope: file
Source code excerpt:
SHOWFLAG_ALWAYS_ACCESSIBLE(LightFunctions, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "LightFunctionsSF", "Light Functions"))
/** Draws instanced static meshes that are not foliage or grass, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedStaticMeshes, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedStaticMeshesSF", "Instanced Static Meshes"))
/** Draws instanced foliage, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
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"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:3023
Scope (from outer to inner):
file
namespace Nanite
function void FRenderer::AddPass_PrimitiveFilter
Source code excerpt:
}
if (!SceneView.Family->EngineShowFlags.InstancedStaticMeshes)
{
HiddenFilterFlags |= EFilterFlags::InstancedStaticMesh;
}
if (!SceneView.Family->EngineShowFlags.InstancedFoliage)
{