r.Streaming.PrioritizeMeshLODRetention

r.Streaming.PrioritizeMeshLODRetention

#Overview

name: r.Streaming.PrioritizeMeshLODRetention

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Streaming.PrioritizeMeshLODRetention is to control whether the Unreal Engine should prioritize retaining mesh LODs (Levels of Detail) during streaming operations. This setting is primarily related to the mesh and texture streaming system within the engine.

This setting variable is primarily utilized by the Unreal Engine’s streaming subsystem, specifically the texture and mesh streaming components. It is defined and used within the Engine module, as evidenced by its location in the Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp file.

The value of this variable is set using a console variable (CVar) system. It is initialized with a default value of 1, meaning that by default, the engine will prioritize retaining mesh LODs.

The associated variable CVarPrioritizeMeshLODRetention interacts directly with r.Streaming.PrioritizeMeshLODRetention. This console variable is used to get the current value of the setting and apply it to the engine’s streaming behavior.

Developers should be aware that this variable can significantly impact the performance and visual quality of their game, especially in scenarios with complex or numerous meshes. Enabling this option (set to 1) may improve visual quality by keeping higher detail mesh LODs loaded, but it could also increase memory usage.

Best practices when using this variable include:

  1. Testing the impact on performance and memory usage with it enabled and disabled.
  2. Considering the target hardware capabilities when deciding whether to enable or disable this feature.
  3. Using it in conjunction with other LOD and streaming settings for optimal results.

Regarding the associated variable CVarPrioritizeMeshLODRetention:

When working with CVarPrioritizeMeshLODRetention, it’s important to ensure that any modifications are made in a thread-safe manner, as indicated by the use of GetValueOnAnyThread().

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:274

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarPrioritizeMeshLODRetention(
	TEXT("r.Streaming.PrioritizeMeshLODRetention"),
	1,
	TEXT("Whether to prioritize retaining mesh LODs"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarStreamingStressTest(
	TEXT("r.Streaming.StressTest"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:273

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> CVarPrioritizeMeshLODRetention(
	TEXT("r.Streaming.PrioritizeMeshLODRetention"),
	1,
	TEXT("Whether to prioritize retaining mesh LODs"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarStreamingStressTest(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:328

Scope (from outer to inner):

file
function     void FRenderAssetStreamingSettings::Update

Source code excerpt:

	LowResHandlingMode = (ELowResHandlingMode)CVarStreamingLowResHandlingMode.GetValueOnAnyThread();
	bMipCalculationEnablePerLevelList = CVarStreamingMipCalculationEnablePerLevelList.GetValueOnAnyThread() != 0;
	bPrioritizeMeshLODRetention = CVarPrioritizeMeshLODRetention.GetValueOnAnyThread() != 0;
	VRAMPercentageClamp = CVarStreamingVRAMPercentageClamp.GetValueOnAnyThread();

	MaterialQualityLevel = (int32)GetCachedScalabilityCVars().MaterialQualityLevel;

	if (MinMipForSplitRequest <= 0)
	{