r.Nanite.DicingRate
r.Nanite.DicingRate
#Overview
name: r.Nanite.DicingRate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Size of the micropolygons that Nanite tessellation will dice to, measured in pixels.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Nanite.DicingRate is to control the size of micropolygons that Nanite tessellation will dice to, measured in pixels. This setting variable is primarily used in the rendering system, specifically within the Nanite subsystem of Unreal Engine 5.
The Nanite rendering system relies on this setting variable to determine the level of tessellation for geometric detail. It is used in the NaniteCullRaster module, which is responsible for culling and rasterizing Nanite geometry.
The value of this variable is set through the console variable system in Unreal Engine. It is initialized with a default value of 2.0f, but can be changed at runtime or through configuration files.
This variable interacts with another variable called CVarNaniteMaxPixelsPerEdge. Together, they determine the inverse dicing rate used in the rendering process. The inverse dicing rate is calculated as CVarNaniteMaxPixelsPerEdge / CVarNaniteDicingRate.
Developers must be aware that changing this variable will affect the visual quality and performance of Nanite-enabled geometry. A lower value will result in higher geometric detail but may impact performance, while a higher value will reduce detail but potentially improve performance.
Best practices when using this variable include:
- Balancing visual quality and performance requirements.
- Testing different values to find the optimal setting for your specific use case.
- Considering the target hardware capabilities when adjusting this value.
The associated variable CVarNaniteDicingRate is an internal representation of the r.Nanite.DicingRate console variable. It is used within the C++ code to access and modify the dicing rate value. This variable is defined as a TAutoConsoleVariable
#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:160
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarNaniteDicingRate(
TEXT("r.Nanite.DicingRate"),
2.0f,
TEXT("Size of the micropolygons that Nanite tessellation will dice to, measured in pixels."),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarNaniteMaxPatchesPerGroup(
#Associated Variable and Callsites
This variable is associated with another variable named CVarNaniteDicingRate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:159
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarNaniteDicingRate(
TEXT("r.Nanite.DicingRate"),
2.0f,
TEXT("Size of the micropolygons that Nanite tessellation will dice to, measured in pixels."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:4382
Scope (from outer to inner):
file
namespace Nanite
function FBinningData FRenderer::AddPass_Rasterize
lambda-function
Source code excerpt:
RasterPassParameters->TessellationTable_Offsets = GTessellationTable.Offsets.SRV;
RasterPassParameters->TessellationTable_VertsAndIndexes = GTessellationTable.VertsAndIndexes.SRV;
RasterPassParameters->InvDiceRate = CVarNaniteMaxPixelsPerEdge.GetValueOnRenderThread() / CVarNaniteDicingRate.GetValueOnRenderThread();
RasterPassParameters->MaxPatchesPerGroup = GetMaxPatchesPerGroup();
RasterPassParameters->MeshPass = Configuration.bIsLumenCapture ? ENaniteMeshPass::LumenCardCapture : ENaniteMeshPass::BasePass;
RasterPassParameters->VirtualShadowMap = VirtualTargetParameters;
RasterPassParameters->OutStatsBuffer = GraphBuilder.CreateUAV(StatsBuffer, ERDGUnorderedAccessViewFlags::SkipBarrier);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:4616
Scope (from outer to inner):
file
namespace Nanite
Source code excerpt:
PassParameters->TessellationTable_Offsets = GTessellationTable.Offsets.SRV;
PassParameters->TessellationTable_VertsAndIndexes = GTessellationTable.VertsAndIndexes.SRV;
PassParameters->InvDiceRate = CVarNaniteMaxPixelsPerEdge.GetValueOnRenderThread() / CVarNaniteDicingRate.GetValueOnRenderThread();
PassParameters->RWVisiblePatches = GraphBuilder.CreateUAV( VisiblePatches );
PassParameters->RWVisiblePatchesArgs = GraphBuilder.CreateUAV( VisiblePatchesArgs );
PassParameters->VisiblePatchesSize = VisiblePatches->GetSize() / 16;
PassParameters->OutStatsBuffer = GNaniteShowStats != 0u ? GraphBuilder.CreateUAV(StatsBuffer) : nullptr;