r.Nanite.Visualize.ComplexityOverhead

r.Nanite.Visualize.ComplexityOverhead

#Overview

name: r.Nanite.Visualize.ComplexityOverhead

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 r.Nanite.Visualize.ComplexityOverhead is to adjust the visualization of shader complexity for Nanite meshes in Unreal Engine 5. It’s specifically used in the rendering system to account for the baseline ALU (Arithmetic Logic Unit) overhead of Nanite when visualizing shader complexity.

This setting variable is primarily used in the Nanite subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s utilized in the NaniteVisualize.cpp file, which is part of the Nanite visualization system.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 7400, but can be changed at runtime using console commands or through code.

The associated variable GNaniteVisualizeComplexityOverhead interacts directly with r.Nanite.Visualize.ComplexityOverhead. They share the same value, with GNaniteVisualizeComplexityOverhead being the C++ variable that’s used in the actual rendering code.

Developers must be aware that this variable affects the visualization of shader complexity specifically for Nanite meshes. It adds an overhead to the global shader budget when calculating the complexity for Nanite objects. This is done to provide a more accurate representation of Nanite’s performance impact compared to non-Nanite meshes.

Best practices when using this variable include:

  1. Understanding that it’s a visualization tool, not a performance optimization setting.
  2. Adjusting it if the default value doesn’t accurately represent the Nanite overhead on your specific hardware or in your specific use case.
  3. Using it in conjunction with other Nanite visualization tools for a comprehensive understanding of Nanite’s impact on your scene.

Regarding the associated variable GNaniteVisualizeComplexityOverhead:

The purpose of GNaniteVisualizeComplexityOverhead is to store the value of the complexity overhead for Nanite visualization within the C++ code.

It’s used directly in the Nanite visualization system, specifically in the RenderDebugViewMode function of the Nanite namespace.

The value is set initially to 7400, but can be modified through the r.Nanite.Visualize.ComplexityOverhead console variable.

This variable interacts with the global shader budget by being added to it to calculate the Nanite-specific shader budget.

Developers should be aware that modifying this variable will directly impact how Nanite mesh complexity is visualized in debug view modes.

Best practices include using this variable for debugging and profiling Nanite performance, and potentially adjusting it if the default value doesn’t accurately represent the Nanite overhead in your specific use case.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteVisualize.cpp:55

Scope: file

Source code excerpt:

int32 GNaniteVisualizeComplexityOverhead = 7400; // Baseline overhead of Nanite ALU (added to global shader budget)
FAutoConsoleVariableRef CVarNaniteVisualizeComplexityOverhead(
	TEXT("r.Nanite.Visualize.ComplexityOverhead"),
	GNaniteVisualizeComplexityOverhead,
	TEXT("")
);

int32 GNanitePickingDomain = NANITE_PICKING_DOMAIN_TRIANGLE;
FAutoConsoleVariableRef CVarNanitePickingDomain(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteVisualize.cpp:53

Scope: file

Source code excerpt:


// Fudge factor chosen by visually comparing Nanite vs non-Nanite cube shader complexity using default material, and choosing value where colors match.
int32 GNaniteVisualizeComplexityOverhead = 7400; // Baseline overhead of Nanite ALU (added to global shader budget)
FAutoConsoleVariableRef CVarNaniteVisualizeComplexityOverhead(
	TEXT("r.Nanite.Visualize.ComplexityOverhead"),
	GNaniteVisualizeComplexityOverhead,
	TEXT("")
);

int32 GNanitePickingDomain = NANITE_PICKING_DOMAIN_TRIANGLE;
FAutoConsoleVariableRef CVarNanitePickingDomain(
	TEXT("r.Nanite.Picking.Domain"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteVisualize.cpp:916

Scope (from outer to inner):

file
namespace    Nanite
function     void RenderDebugViewMode

Source code excerpt:


	// Increase the shader budget for Nanite meshes to account for baseline ALU overhead.
	const uint32 NaniteShaderBudget = GlobalShaderBudget + uint32(GNaniteVisualizeComplexityOverhead);

	const FLinearColor SelectionColor = GetSelectionColor(FLinearColor::White, true /* selected */, false /* hovered */, false /* use overlay intensity */);

	// TODO: Need to apply hover intensity to per-primitive wireframe color, not white
	//const FLinearColor HoveredColor = GetSelectionColor(FLinearColor::White, false /* selected */, true /* hovered */);