r.Nanite.Culling.WPODisableDistance

r.Nanite.Culling.WPODisableDistance

#Overview

name: r.Nanite.Culling.WPODisableDistance

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.Culling.WPODisableDistance is to control the behavior of World Position Offset (WPO) disable distance for Nanite instances in the culling process of Unreal Engine’s Nanite rendering system.

This setting variable is primarily used by the Nanite rendering system, which is a part of Unreal Engine’s rendering module. Based on the callsites, it’s specifically utilized in the culling and rasterization process of Nanite geometry.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of 1 in the C++ code.

The associated variable CVarNaniteCullingWPODisableDistance directly interacts with r.Nanite.Culling.WPODisableDistance. They share the same value and purpose.

Developers must be aware that setting this variable to 0 will disable the ‘World Position Offset Disable Distance’ feature for Nanite instances. This is primarily used for testing purposes, as indicated by the description in the code.

Best practices when using this variable include:

  1. Keep the default value (1) for normal operation.
  2. Only set it to 0 when specifically testing the impact of disabling WPO disable distance on Nanite instances.
  3. Be cautious when modifying this in a production environment, as it may impact rendering performance or visual quality.

Regarding the associated variable CVarNaniteCullingWPODisableDistance:

This is the actual console variable that controls the r.Nanite.Culling.WPODisableDistance setting. It’s defined as a TAutoConsoleVariable, which means it’s an integer value that can be changed at runtime through the console.

The variable is used in the Nanite renderer’s initialization process. When its value is 0, it sets a debug flag (NANITE_DEBUG_FLAG_DISABLE_WPO_DISABLE_DISTANCE) which likely affects how the renderer handles World Position Offset for Nanite geometry.

Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag in its definition.

When working with this variable, it’s important to understand its impact on the Nanite rendering pipeline and use it judiciously, primarily for debugging and testing purposes.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNaniteCullingWPODisableDistance(
	TEXT("r.Nanite.Culling.WPODisableDistance"),
	1,
	TEXT("Set to 0 to test disabling 'World Position Offset Disable Distance' for Nanite instances."),
	ECVF_RenderThreadSafe
);

int32 GNaniteCullingTwoPass = 1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarNaniteCullingWPODisableDistance(
	TEXT("r.Nanite.Culling.WPODisableDistance"),
	1,
	TEXT("Set to 0 to test disabling 'World Position Offset Disable Distance' for Nanite instances."),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    Nanite
function     FRenderer::FRenderer

Source code excerpt:

		}

		if (CVarNaniteCullingWPODisableDistance.GetValueOnRenderThread() == 0)
		{
			DebugFlags |= NANITE_DEBUG_FLAG_DISABLE_WPO_DISABLE_DISTANCE;
		}

		if (Configuration.bDrawOnlyRootGeometry)
		{