ShowFlag.NaniteStreamingGeometry

ShowFlag.NaniteStreamingGeometry

#Overview

name: ShowFlag.NaniteStreamingGeometry

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.NaniteStreamingGeometry is to control the rendering of Nanite streaming geometry in Unreal Engine 5. This setting variable is part of the Nanite system, which is a virtualized geometry system that allows for highly detailed meshes with minimal performance impact.

This setting variable is primarily used in the Nanite and Renderer subsystems of Unreal Engine 5. Based on the callsites, it’s clear that this flag is used to determine whether Nanite streaming geometry should be drawn or not.

The value of this variable is set through the engine’s show flags system. It’s defined using the SHOWFLAG_ALWAYS_ACCESSIBLE macro, which means it’s always available for modification, even in shipping builds.

The ShowFlag.NaniteStreamingGeometry interacts closely with the NaniteStreamingGeometry variable. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable directly affects the rendering of Nanite streaming geometry. When set to false, it will prevent the rendering of streaming geometry, which could be useful for debugging or performance optimization in certain scenarios.

Best practices when using this variable include:

  1. Use it for debugging purposes to isolate rendering issues related to Nanite streaming geometry.
  2. Be cautious when disabling it in production builds, as it may significantly affect the visual quality of Nanite-based meshes.
  3. Consider the performance implications of enabling or disabling this flag, especially in scenes with many Nanite meshes.

Regarding the associated variable NaniteStreamingGeometry:

The purpose of NaniteStreamingGeometry is identical to ShowFlag.NaniteStreamingGeometry. It’s used to control the rendering of Nanite streaming geometry.

This variable is used in the Nanite subsystem, specifically in the NaniteCullRaster module. It’s accessed through the View.Family->EngineShowFlags structure.

The value of this variable is set through the engine’s show flags system, just like ShowFlag.NaniteStreamingGeometry.

NaniteStreamingGeometry interacts directly with ShowFlag.NaniteStreamingGeometry, as they share the same value.

Developers should be aware that this variable is used to set the bDrawOnlyRootGeometry flag in the Nanite configuration. When NaniteStreamingGeometry is false, bDrawOnlyRootGeometry is set to true, which means only the root geometry of Nanite meshes will be drawn.

Best practices for using this variable are the same as those for ShowFlag.NaniteStreamingGeometry. It’s important to understand that modifying this variable will affect the rendering of Nanite meshes and could impact both visual quality and 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:446

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(NaniteMeshes, SFG_Nanite, NSLOCTEXT("UnrealEd", "NaniteMeshesSF", "Meshes"))
/** Draw Nanite streaming geometry */
SHOWFLAG_ALWAYS_ACCESSIBLE(NaniteStreamingGeometry, SFG_Nanite, NSLOCTEXT("UnrealEd", "NaniteStreamingGeometrySF", "Streaming Geometry"))

/** Visualize Skin Cache */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeGPUSkinCache, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeGPUSkinCache", "Visualize GPU Skin Cache"))

/** Enables ShaderPrint functionality that is used for debug printing from shaders (e.g. 'Nanitestats' command). Disable this for certain editor rendering (e.g. thumbnail rendering) */
SHOWFLAG_ALWAYS_ACCESSIBLE(ShaderPrint, SFG_Developer, NSLOCTEXT("UnrealEd", "ShaderPrint", "Shader Print"))

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(NaniteMeshes, SFG_Nanite, NSLOCTEXT("UnrealEd", "NaniteMeshesSF", "Meshes"))
/** Draw Nanite streaming geometry */
SHOWFLAG_ALWAYS_ACCESSIBLE(NaniteStreamingGeometry, SFG_Nanite, NSLOCTEXT("UnrealEd", "NaniteStreamingGeometrySF", "Streaming Geometry"))

/** Visualize Skin Cache */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeGPUSkinCache, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeGPUSkinCache", "Visualize GPU Skin Cache"))

/** Enables ShaderPrint functionality that is used for debug printing from shaders (e.g. 'Nanitestats' command). Disable this for certain editor rendering (e.g. thumbnail rendering) */
SHOWFLAG_ALWAYS_ACCESSIBLE(ShaderPrint, SFG_Developer, NSLOCTEXT("UnrealEd", "ShaderPrint", "Shader Print"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:5681

Scope (from outer to inner):

file
namespace    Nanite
function     void FConfiguration::SetViewFlags

Source code excerpt:

	bGameShowFlag						= !!View.Family->EngineShowFlags.Game;
	bEditorShowFlag						= !!View.Family->EngineShowFlags.Editor;
	bDrawOnlyRootGeometry				= !View.Family->EngineShowFlags.NaniteStreamingGeometry;
}

void FInstanceHierarchyDriver::Init(FRDGBuilder& GraphBuilder, bool bInIsEnabled, bool bTwoPassOcclusion, const FGlobalShaderMap* ShaderMap, FSceneInstanceCullingQuery* SceneInstanceCullingQuery) 
{
	bIsEnabled = bInIsEnabled && SceneInstanceCullingQuery != nullptr;