r.Nanite.Culling.GlobalClipPlane
r.Nanite.Culling.GlobalClipPlane
#Overview
name: r.Nanite.Culling.GlobalClipPlane
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set to 0 to test disabling Nanite culling due to being beyond the global clip plane.\nNOTE: Has no effect if r.AllowGlobalClipPlane=0.
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:
- Setting this variable to 0 disables Nanite culling based on the global clip plane.
- This setting has no effect if another setting, r.AllowGlobalClipPlane, is set to 0.
- 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:
- 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.
- Only disable it (set to 0) for testing or debugging purposes, to isolate issues related to culling.
- Be aware of its interaction with r.AllowGlobalClipPlane and ensure both are set appropriately for the desired behavior.
- When making changes, consider the performance implications, especially in scenes with complex geometry.
Regarding the associated variable CVarNaniteCullingGlobalClipPlane:
- It’s an auto console variable of type int32, which allows for easy runtime modification and querying of the setting.
- It’s used in the Nanite::FRenderer constructor to set debug flags when disabled, specifically setting the NANITE_DEBUG_FLAG_DISABLE_CULL_GLOBAL_CLIP_PLANE flag.
- Developers should use this variable when they need to programmatically read or modify the global clip plane culling behavior in C++ code, particularly within the rendering pipeline.
#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)
{