r.Nanite.Culling.HZB

r.Nanite.Culling.HZB

#Overview

name: r.Nanite.Culling.HZB

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.HZB is to control the occlusion culling of Nanite geometry using the hierarchical depth buffer (HZB) in Unreal Engine 5’s rendering system.

This setting variable is primarily used by the Nanite rendering subsystem, which is part of Unreal Engine 5’s advanced geometry system. It is specifically utilized in the culling process of Nanite geometry.

The value of this variable is set through a console variable (CVarNaniteCullingHZB) in the Unreal Engine’s rendering system. It is defined with a default value of 1, meaning the HZB culling is enabled by default.

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

Developers must be aware that setting this variable to 0 will disable Nanite culling based on occlusion by the hierarchical depth buffer. This can be useful for testing purposes but may impact rendering performance in a production environment.

Best practices when using this variable include:

  1. Keeping it enabled (set to 1) for optimal performance in most scenarios.
  2. Only disabling it (setting to 0) when specifically testing or debugging Nanite culling behavior.
  3. Being aware that disabling this culling mechanism may result in increased rendering load, as more geometry might be processed unnecessarily.

Regarding the associated variable CVarNaniteCullingHZB:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNaniteCullingHZB(
	TEXT("r.Nanite.Culling.HZB"),
	1,
	TEXT("Set to 0 to test disabling Nanite culling due to occlusion by the hierarchical depth buffer."),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarNaniteCullingFrustum(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarNaniteCullingHZB(
	TEXT("r.Nanite.Culling.HZB"),
	1,
	TEXT("Set to 0 to test disabling Nanite culling due to occlusion by the hierarchical depth buffer."),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    Nanite
function     FRenderer::FRenderer

Source code excerpt:

		}

		if (CVarNaniteCullingHZB.GetValueOnRenderThread() == 0)
		{
			DebugFlags |= NANITE_DEBUG_FLAG_DISABLE_CULL_HZB;
		}

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