r.Nanite.ShadowRaster.TimeBudgetMs
r.Nanite.ShadowRaster.TimeBudgetMs
#Overview
name: r.Nanite.ShadowRaster.TimeBudgetMs
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Frame\'s time budget for Nanite shadow raster in milliseconds.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Nanite.ShadowRaster.TimeBudgetMs is to set a frame’s time budget for Nanite shadow raster operations in milliseconds. This setting variable is part of Unreal Engine 5’s Nanite virtualized geometry system, specifically focusing on the shadow rendering aspect.
This setting variable is primarily used by the Nanite rendering subsystem within Unreal Engine 5. Based on the callsites, it’s clear that this variable is utilized in the NaniteCullRaster module, which is responsible for culling and rasterizing Nanite geometry for shadows.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s defined using TAutoConsoleVariable, making it accessible and modifiable during runtime.
The associated variable CVarNaniteShadowTimeBudgetMs directly interacts with r.Nanite.ShadowRaster.TimeBudgetMs. They share the same value and purpose.
Developers must be aware that this variable plays a crucial role in managing performance for Nanite shadow rendering. It’s part of the dynamic render scaling system, which adjusts rendering quality based on performance budgets. The default value is set to kBudgetMsDisabled, suggesting that by default, this budget is not enforced.
Best practices when using this variable include:
- Only modify it if you’re experiencing performance issues related to Nanite shadow rendering.
- Monitor its impact on overall frame time and shadow quality when adjusting.
- Use in conjunction with other Nanite and shadow-related settings for optimal performance.
- Consider the target hardware when setting this budget, as lower-end devices may require stricter budgets.
Regarding the associated variable CVarNaniteShadowTimeBudgetMs:
Its purpose is identical to r.Nanite.ShadowRaster.TimeBudgetMs, serving as the internal representation of the console variable.
It’s used within the GetDynamicNaniteScalingShadowSettings function to retrieve the current time budget for Nanite shadow rasterization. This function appears to be part of a dynamic scaling system for Nanite shadows, which likely adjusts the shadow quality based on performance metrics.
The value of CVarNaniteShadowTimeBudgetMs is set when r.Nanite.ShadowRaster.TimeBudgetMs is modified, as they are directly linked.
Developers should be aware that modifying r.Nanite.ShadowRaster.TimeBudgetMs will affect this associated variable, and consequently, the dynamic scaling behavior of Nanite shadows. When debugging or profiling Nanite shadow performance, checking the value of CVarNaniteShadowTimeBudgetMs can provide insight into the current time budget being used by the system.
#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:271
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarNaniteShadowTimeBudgetMs(
TEXT("r.Nanite.ShadowRaster.TimeBudgetMs"),
DynamicRenderScaling::FHeuristicSettings::kBudgetMsDisabled,
TEXT("Frame's time budget for Nanite shadow raster in milliseconds."),
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<float> CVarNaniteOccludedInstancesBufferSizeMultiplier(
TEXT("r.Nanite.OccludedInstancesBufferSizeMultiplier"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarNaniteShadowTimeBudgetMs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:270
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<float> CVarNaniteShadowTimeBudgetMs(
TEXT("r.Nanite.ShadowRaster.TimeBudgetMs"),
DynamicRenderScaling::FHeuristicSettings::kBudgetMsDisabled,
TEXT("Frame's time budget for Nanite shadow raster in milliseconds."),
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<float> CVarNaniteOccludedInstancesBufferSizeMultiplier(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:307
Scope (from outer to inner):
file
function static DynamicRenderScaling::FHeuristicSettings GetDynamicNaniteScalingShadowSettings
Source code excerpt:
BucketSetting.MinResolutionFraction = DynamicRenderScaling::PercentageToFraction(PixelsPerEdgeScalingPercentage);
BucketSetting.MaxResolutionFraction = DynamicRenderScaling::PercentageToFraction(100.0f);
BucketSetting.BudgetMs = CVarNaniteShadowTimeBudgetMs.GetValueOnAnyThread();
BucketSetting.ChangeThreshold = DynamicRenderScaling::PercentageToFraction(1.0f);
BucketSetting.TargetedHeadRoom = DynamicRenderScaling::PercentageToFraction(5.0f); // 5% headroom
BucketSetting.UpperBoundQuantization = DynamicRenderScaling::FHeuristicSettings::kDefaultUpperBoundQuantization;
return BucketSetting;
}