r.Nanite.Visualize.Composite

r.Nanite.Visualize.Composite

#Overview

name: r.Nanite.Visualize.Composite

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.Composite is to control the visualization of Nanite geometry composition with the scene depth. It is part of the Nanite visualization system in Unreal Engine 5’s rendering pipeline.

This setting variable is primarily used in the Nanite subsystem of the Unreal Engine rendering module. Based on the callsites, it’s specifically used in the NaniteVisualize.cpp file, which is responsible for handling various visualization aspects of Nanite geometry.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.

The associated variable GNaniteVisualizeComposite directly interacts with r.Nanite.Visualize.Composite. They share the same value, with GNaniteVisualizeComposite being the actual integer variable used in the code logic.

Developers must be aware that this variable has three possible states:

When using this variable, developers should consider the following best practices:

  1. Use it primarily for debugging and visualization purposes.
  2. Be cautious when modifying it in production builds, as it may affect performance or visual output.
  3. Remember to reset it to the default value (-1) after debugging to ensure normal behavior.

Regarding the associated variable GNaniteVisualizeComposite:

The purpose of GNaniteVisualizeComposite is to serve as the actual integer variable that controls the Nanite visualization composition behavior in the code.

It is used within the Nanite namespace, specifically in the AddVisualizationPasses function. This function is part of the Nanite visualization system and is responsible for adding various visualization passes to the rendering pipeline.

The value of GNaniteVisualizeComposite is set through the r.Nanite.Visualize.Composite console variable.

GNaniteVisualizeComposite directly interacts with the Visualization.bCompositeScene boolean variable, which determines whether the Nanite geometry should be composited with the scene depth or not.

Developers must be aware that modifying GNaniteVisualizeComposite will directly affect the visualization behavior of Nanite geometry. They should use it carefully and primarily for debugging purposes.

Best practices for using GNaniteVisualizeComposite include:

  1. Avoid modifying it directly in code; instead, use the r.Nanite.Visualize.Composite console variable.
  2. When debugging, check its value to understand the current visualization state.
  3. Remember that changing this variable may impact performance, so use it judiciously in non-development builds.

#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:26

Scope: file

Source code excerpt:

int32 GNaniteVisualizeComposite = -1;
FAutoConsoleVariableRef CVarNaniteVisualizeComposite(
	TEXT("r.Nanite.Visualize.Composite"),
	GNaniteVisualizeComposite,
	TEXT("")
);

int32 GNaniteVisualizeEdgeDetect = 1;
static FAutoConsoleVariableRef CVarNaniteVisualizeEdgeDetect(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

//  0: Force composition with scene depth off
//  1: Force composition with scene depth on
int32 GNaniteVisualizeComposite = -1;
FAutoConsoleVariableRef CVarNaniteVisualizeComposite(
	TEXT("r.Nanite.Visualize.Composite"),
	GNaniteVisualizeComposite,
	TEXT("")
);

int32 GNaniteVisualizeEdgeDetect = 1;
static FAutoConsoleVariableRef CVarNaniteVisualizeEdgeDetect(
	TEXT("r.Nanite.Visualize.EdgeDetect"),

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

Scope (from outer to inner):

file
namespace    Nanite
function     void AddVisualizationPasses

Source code excerpt:


						// Apply force off/on scene composition
						if (GNaniteVisualizeComposite == 0)
						{
							// Force off
							Visualization.bCompositeScene = false;
						}
						else if (GNaniteVisualizeComposite == 1)
						{
							// Force on
							Visualization.bCompositeScene = true;
						}

						FRDGTextureDesc VisualizationOutputDesc = FRDGTextureDesc::Create2D(