r.Nanite.Picking.Domain

r.Nanite.Picking.Domain

#Overview

name: r.Nanite.Picking.Domain

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Nanite.Picking.Domain is to control the picking domain for Nanite geometry in Unreal Engine 5. It is used in the rendering system, specifically for the Nanite visualization and picking functionality.

This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the Nanite subsystem. Based on the callsites, it’s evident that this variable is used in the NaniteVisualize.cpp file, which is responsible for visualizing various aspects of Nanite geometry.

The value of this variable is set using the Unreal Engine’s 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 GNanitePickingDomain directly interacts with r.Nanite.Picking.Domain. They share the same value, with GNanitePickingDomain being the actual integer variable used in the C++ code.

Developers must be aware that this variable affects how picking (selection) of Nanite geometry is performed. It can be set to different modes, specifically NANITE_PICKING_DOMAIN_TRIANGLE and NANITE_PICKING_DOMAIN_CLUSTER, as seen in the DisplayPicking function.

Best practices when using this variable include:

  1. Understanding the implications of each picking domain on performance and accuracy.
  2. Using it in conjunction with other Nanite visualization tools for debugging and optimization.
  3. Being cautious when modifying it at runtime, as it can affect the behavior of selection tools in the engine.

Regarding the associated variable GNanitePickingDomain:

The purpose of GNanitePickingDomain is to store the actual integer value of the picking domain mode for Nanite geometry. It’s used internally in the C++ code to determine the current picking domain.

This variable is used in the Renderer module, specifically in the Nanite visualization and picking functionality. It’s directly accessed in the NaniteVisualize.cpp file.

The value of GNanitePickingDomain is set through the r.Nanite.Picking.Domain console variable. They are linked through the FAutoConsoleVariableRef system.

GNanitePickingDomain interacts closely with the r.Nanite.Picking.Domain console variable. It’s also used in conditional statements to determine the current picking domain mode.

Developers should be aware that modifying GNanitePickingDomain directly in code might lead to inconsistencies with the console variable. It’s best to modify the value through the console variable system.

Best practices include using the predefined constants (like NANITE_PICKING_DOMAIN_TRIANGLE and NANITE_PICKING_DOMAIN_CLUSTER) when working with this variable to ensure consistency and readability in the code.

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

Scope: file

Source code excerpt:

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

int32 GNanitePixelProgrammableVisMode = NANITE_PIXEL_PROG_VIS_MODE_DEFAULT;
FAutoConsoleVariableRef CVarNanitePixelProgrammableVisMode(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:107

Scope: file

Source code excerpt:


extern int32 GNaniteShowStats;
extern int32 GNanitePickingDomain;

extern DynamicRenderScaling::FBudget GDynamicNaniteScalingPrimary;

static TAutoConsoleVariable<int32> CVarClearCoatNormal(
	TEXT("r.ClearCoatNormal"),
	0,

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

Scope: file

Source code excerpt:

);

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

int32 GNanitePixelProgrammableVisMode = NANITE_PIXEL_PROG_VIS_MODE_DEFAULT;
FAutoConsoleVariableRef CVarNanitePixelProgrammableVisMode(
	TEXT("r.Nanite.Visualize.PixelProgrammableVisMode"),

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

Scope (from outer to inner):

file
function     static FIntVector4 GetVisualizeConfig

Source code excerpt:

		{
		case NANITE_VISUALIZE_PICKING:
			ModeArg = GNanitePickingDomain;
			break;
		case NANITE_VISUALIZE_PIXEL_PROGRAMMABLE_RASTER:
			ModeArg = GNanitePixelProgrammableVisMode;
		default:
			break;
		}

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

Scope (from outer to inner):

file
namespace    Nanite
function     void DisplayPicking

Source code excerpt:

	}

	switch (GNanitePickingDomain)
	{
	case NANITE_PICKING_DOMAIN_TRIANGLE:
		Writer.DrawLine(FText::FromString(TEXT("Domain [Triangle]")), 10, FColor::Yellow);
		break;

	case NANITE_PICKING_DOMAIN_CLUSTER: