wp.Runtime.HLOD.WarmupNanite

wp.Runtime.HLOD.WarmupNanite

#Overview

name: wp.Runtime.HLOD.WarmupNanite

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of wp.Runtime.HLOD.WarmupNanite is to enable or disable the Nanite warmup for HLOD (Hierarchical Level of Detail) assets in Unreal Engine 5. This setting is part of the HLOD system, which is used for optimizing rendering performance in large open-world environments.

This setting variable is primarily used by the World Partition HLOD Runtime Subsystem, which is part of the Engine module. It’s specifically related to the rendering and optimization systems within Unreal Engine 5.

The value of this variable is set through a console variable (CVarHLODWarmupNanite) with a default value of 1 (enabled). It can be changed at runtime through console commands or programmatically.

This variable interacts closely with other HLOD-related settings, particularly:

  1. wp.Runtime.HLOD.WarmupEnabled: The Nanite warmup only occurs if this main warmup flag is also enabled.
  2. wp.Runtime.HLOD.WarmupVT: A similar setting for virtual texture warmup.
  3. wp.Runtime.HLOD.WarmupNumFrames: Determines the number of frames for the warmup process.

Developers should be aware that:

  1. This setting only takes effect if the main HLOD warmup (wp.Runtime.HLOD.WarmupEnabled) is also enabled.
  2. It’s specifically for Nanite-enabled HLOD assets.
  3. The warmup process can impact performance during initial loading or streaming, but aims to improve performance afterwards.

Best practices when using this variable include:

  1. Ensure it’s enabled for projects using Nanite and HLOD for large environments.
  2. Test performance with and without this setting to determine its impact on your specific project.
  3. Consider disabling it for development builds to reduce initial loading times, but keep it enabled for shipping builds.

Regarding the associated variable CVarHLODWarmupNanite: This is the actual console variable that controls the wp.Runtime.HLOD.WarmupNanite setting. It’s defined as a TAutoConsoleVariable, which means it can be easily accessed and modified at runtime. The variable is used in the UWorldPartitionHLODRuntimeSubsystem to determine whether Nanite warmup should be performed for HLOD assets. It’s checked in functions like ShouldPerformWarmup and OnBeginRenderViews to control the warmup behavior.

When working with CVarHLODWarmupNanite, developers should:

  1. Use CVarHLODWarmupNanite.GetValueOnGameThread() to safely read its current value.
  2. Be aware that changing this value at runtime will immediately affect the HLOD warmup behavior.
  3. Consider exposing this setting in your game’s graphics options if you want to give users control over this performance optimization.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:47

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHLODWarmupNanite(
	TEXT("wp.Runtime.HLOD.WarmupNanite"),
	1,
	TEXT("Enable Nanite warmup for HLOD assets. Requires wp.Runtime.HLOD.WarmupEnabled to be 1."));

static TAutoConsoleVariable<int32> CVarHLODWarmupNumFrames(
	TEXT("wp.Runtime.HLOD.WarmupNumFrames"),
	5,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:46

Scope: file

Source code excerpt:

	TEXT("Enable virtual texture warmup for HLOD assets. Requires wp.Runtime.HLOD.WarmupEnabled to be 1."));

static TAutoConsoleVariable<int32> CVarHLODWarmupNanite(
	TEXT("wp.Runtime.HLOD.WarmupNanite"),
	1,
	TEXT("Enable Nanite warmup for HLOD assets. Requires wp.Runtime.HLOD.WarmupEnabled to be 1."));

static TAutoConsoleVariable<int32> CVarHLODWarmupNumFrames(
	TEXT("wp.Runtime.HLOD.WarmupNumFrames"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:502

Scope (from outer to inner):

file
function     bool UWorldPartitionHLODRuntimeSubsystem::ShouldPerformWarmup

Source code excerpt:

	const bool bNaniteEnabled = UseNanite(ShaderPlatform);
	const bool bVirtualTextureEnabled = UseVirtualTexturing(ShaderPlatform);
	const bool bWarmupNanite = CVarHLODWarmupNanite.GetValueOnGameThread() != 0;
	const bool bWarmupVT = CVarHLODWarmupVT.GetValueOnGameThread() != 0;
	const bool bWarmupNeeded = (bNaniteEnabled && bWarmupNanite) || (bVirtualTextureEnabled && bWarmupVT);
	if (!bWarmupNeeded)
	{
		return false;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:659

Scope (from outer to inner):

file
function     void UWorldPartitionHLODRuntimeSubsystem::OnBeginRenderViews

Source code excerpt:

	TMap<Nanite::FResources*, int32> NaniteRequests;

	const bool bWarmupNanite = CVarHLODWarmupNanite.GetValueOnGameThread() != 0;
	const bool bWarmupVT = CVarHLODWarmupVT.GetValueOnGameThread() != 0;

	for (FHLODWarmupStateMap::TIterator HLODActorWarmupStateIt(HLODActorsToWarmup); HLODActorWarmupStateIt; ++HLODActorWarmupStateIt)
	{
		const FObjectKey& HLODActorObjectKey = HLODActorWarmupStateIt.Key();
		FWorldPartitionHLODWarmupState& HLODWarmupState = HLODActorWarmupStateIt.Value();