r.Nanite.Culling.HZB
r.Nanite.Culling.HZB
#Overview
name: r.Nanite.Culling.HZB
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set to 0 to test disabling Nanite culling due to occlusion by the hierarchical depth buffer.
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:
- Keeping it enabled (set to 1) for optimal performance in most scenarios.
- Only disabling it (setting to 0) when specifically testing or debugging Nanite culling behavior.
- 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:
- It is defined as a TAutoConsoleVariable
, which allows it to be changed at runtime through console commands. - It is used in the Nanite renderer’s initialization process to set up debug flags for culling.
- When its value is 0, it adds the NANITE_DEBUG_FLAG_DISABLE_CULL_HZB flag to the DebugFlags, effectively disabling HZB culling for Nanite geometry.
- Developers should use this variable in the same manner as r.Nanite.Culling.HZB, as they are effectively the same setting exposed through different interfaces (console variable vs. engine setting).
#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)
{