r.Nanite.Culling.GlobalClipPlane

r.Nanite.Culling.GlobalClipPlane

#Overview

name: r.Nanite.Culling.GlobalClipPlane

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.GlobalClipPlane is to control the culling behavior of Nanite geometry with respect to the global clip plane in Unreal Engine’s rendering system. This setting variable is part of the Nanite rendering technology, which is a key feature of Unreal Engine 5 for efficient rendering of highly detailed geometry.

This setting variable is primarily used in the Nanite rendering subsystem, specifically in the culling and rasterization process. It’s referenced in the NaniteCullRaster.cpp file, which is part of the Renderer module.

The value of this variable is set through a console variable (CVarNaniteCullingGlobalClipPlane) with a default value of 1. It can be changed at runtime through console commands or programmatically.

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

Developers must be aware that:

  1. Setting this variable to 0 disables Nanite culling based on the global clip plane.
  2. This setting has no effect if another setting, r.AllowGlobalClipPlane, is set to 0.
  3. Changes to this variable are render thread safe, meaning they can be applied without causing threading issues in the rendering pipeline.

Best practices when using this variable include:

  1. Keep it enabled (set to 1) for optimal performance in most cases, as culling geometry beyond the global clip plane can significantly improve rendering efficiency.
  2. Only disable it (set to 0) for testing or debugging purposes, to isolate issues related to culling.
  3. Be aware of its interaction with r.AllowGlobalClipPlane and ensure both are set appropriately for the desired behavior.
  4. When making changes, consider the performance implications, especially in scenes with complex geometry.

Regarding the associated variable CVarNaniteCullingGlobalClipPlane:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNaniteCullingGlobalClipPlane(
	TEXT("r.Nanite.Culling.GlobalClipPlane"),
	1,
	TEXT("Set to 0 to test disabling Nanite culling due to being beyond the global clip plane.\n")
	TEXT("NOTE: Has no effect if r.AllowGlobalClipPlane=0."),
	ECVF_RenderThreadSafe
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarNaniteCullingGlobalClipPlane(
	TEXT("r.Nanite.Culling.GlobalClipPlane"),
	1,
	TEXT("Set to 0 to test disabling Nanite culling due to being beyond the global clip plane.\n")
	TEXT("NOTE: Has no effect if r.AllowGlobalClipPlane=0."),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    Nanite
function     FRenderer::FRenderer

Source code excerpt:

		}

		if (CVarNaniteCullingGlobalClipPlane.GetValueOnRenderThread() == 0)
		{
			DebugFlags |= NANITE_DEBUG_FLAG_DISABLE_CULL_GLOBAL_CLIP_PLANE;
		}

		if (CVarNaniteCullingDrawDistance.GetValueOnRenderThread() == 0)
		{