ShowFlag.InstancedGrass
ShowFlag.InstancedGrass
#Overview
name: ShowFlag.InstancedGrass
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.InstancedGrass is to control the visibility of instanced grass in the rendering system of Unreal Engine 5. This show flag is used to determine whether instanced grass should be rendered in the scene.
This setting variable is primarily used in the rendering system, specifically for managing the visibility of instanced grass elements. Based on the callsites, it’s utilized in the following Unreal Engine subsystems and modules:
- Engine module (Engine/Source/Runtime/Engine)
- Renderer module (Engine/Source/Runtime/Renderer)
The value of this variable is set through the engine show flags system. It’s defined as an always accessible show flag, which means it can be toggled on or off in various contexts, including scene captures.
The ShowFlag.InstancedGrass interacts with other variables and systems:
- It’s associated with the InstancedGrass variable, which shares the same value.
- It’s used in conjunction with other show flags like InstancedFoliage and InstancedStaticMeshes to determine the visibility of different types of instanced meshes.
- In the Nanite rendering system, it’s used to filter primitives, specifically for grass.
Developers should be aware of the following when using this variable:
- It affects the visibility of instanced grass in the scene, which can have performance implications.
- It’s always accessible, even in shipping builds, which means it can be toggled at runtime.
- It’s used in scene captures, so it may affect captured images or renders.
Best practices when using this variable include:
- Use it judiciously to balance visual quality and performance, especially in performance-critical scenarios.
- Consider its impact on scene captures when using them in your project.
- Be aware of its interaction with other instanced mesh types and adjust related show flags accordingly for consistent results.
Regarding the associated variable InstancedGrass:
The purpose of InstancedGrass is to serve as the internal representation of the ShowFlag.InstancedGrass in the engine’s show flags system. It’s used in the same context as ShowFlag.InstancedGrass to control the visibility of instanced grass.
This variable is used in the Engine module, specifically in the hierarchical instanced static mesh system. It’s set through the engine show flags system, just like ShowFlag.InstancedGrass.
The InstancedGrass variable interacts directly with the view relevance system, determining whether instanced grass should be considered relevant for rendering in a given view.
Developers should be aware that this variable is used in the core rendering pipeline to determine if instanced grass should be rendered. It’s part of the view family’s engine show flags, which means it can be accessed and modified through the standard show flag interfaces.
Best practices for using InstancedGrass include:
- Use it in conjunction with other show flags when fine-tuning scene visibility.
- Be aware of its performance implications, especially in scenes with a lot of instanced grass.
- Consider its state when debugging rendering issues related to instanced grass.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:185
Scope: file
Source code excerpt:
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"))
/** non baked shadows, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(DynamicShadows, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "DynamicShadowsSF", "Dynamic Shadows"))
/** Particles, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Particles, SFG_Normal, NSLOCTEXT("UnrealEd", "ParticlesSF", "Particle Sprites"))
/** Niagara, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_FIXED_IN_SHIPPING(1, Niagara, SFG_Advanced, NSLOCTEXT("UnrealEd", "NiagaraSF", "Niagara Renderers"))
#Associated Variable and Callsites
This variable is associated with another variable named InstancedGrass
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/HierarchicalInstancedStaticMesh.cpp:871
Scope (from outer to inner):
file
function FPrimitiveViewRelevance FHierarchicalStaticMeshSceneProxy::GetViewRelevance
Source code excerpt:
{
case EHISMViewRelevanceType::Grass:
bShowInstancedMesh = View->Family->EngineShowFlags.InstancedGrass;
break;
case EHISMViewRelevanceType::Foliage:
bShowInstancedMesh = View->Family->EngineShowFlags.InstancedFoliage;
break;
case EHISMViewRelevanceType::HISM:
bShowInstancedMesh = View->Family->EngineShowFlags.InstancedStaticMeshes;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:185
Scope: file
Source code excerpt:
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"))
/** non baked shadows, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(DynamicShadows, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "DynamicShadowsSF", "Dynamic Shadows"))
/** Particles, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(Particles, SFG_Normal, NSLOCTEXT("UnrealEd", "ParticlesSF", "Particle Sprites"))
/** Niagara, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_FIXED_IN_SHIPPING(1, Niagara, SFG_Advanced, NSLOCTEXT("UnrealEd", "NiagaraSF", "Niagara Renderers"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:3033
Scope (from outer to inner):
file
namespace Nanite
function void FRenderer::AddPass_PrimitiveFilter
Source code excerpt:
}
if (!SceneView.Family->EngineShowFlags.InstancedGrass)
{
HiddenFilterFlags |= EFilterFlags::Grass;
}
if (!SceneView.Family->EngineShowFlags.Landscape)
{