r.Streaming.FullyLoadMeshes

r.Streaming.FullyLoadMeshes

#Overview

name: r.Streaming.FullyLoadMeshes

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.FullyLoadMeshes is to control mesh LOD (Level of Detail) streaming in Unreal Engine 5. It is primarily used in the rendering and streaming systems of the engine.

This setting variable is relied upon by the Engine module, specifically within the texture streaming subsystem. It’s referenced in the TextureStreamingHelpers.cpp file, which suggests it’s an integral part of the texture and mesh streaming functionality.

The value of this variable is set through a console variable (CVarStreamingFullyLoadMeshes). It’s initialized with a default value of 0, meaning mesh LOD streaming is enabled by default.

This variable interacts with other streaming-related variables, such as CVarStreamingUseAllMips, within the FRenderAssetStreamingSettings struct.

Developers must be aware that setting this variable to a non-zero value will cause the engine to stream in all mesh LODs, effectively semi-disabling mesh LOD streaming. This can have significant performance implications, especially for projects with complex or numerous meshes.

Best practices when using this variable include:

  1. Keeping it at 0 (default) for normal operation to benefit from mesh LOD streaming.
  2. Using it judiciously for debugging or specific scenarios where you need to see all mesh LODs.
  3. Being mindful of the performance impact when enabling it, especially in production builds.

Regarding the associated variable CVarStreamingFullyLoadMeshes:

The purpose of CVarStreamingFullyLoadMeshes is to serve as the actual console variable that controls the r.Streaming.FullyLoadMeshes setting. It’s the implementation detail behind the user-facing console command.

This variable is part of the Engine module and is used in the texture streaming subsystem. It’s defined and used in the same file as r.Streaming.FullyLoadMeshes (TextureStreamingHelpers.cpp).

The value of CVarStreamingFullyLoadMeshes is set when the console command r.Streaming.FullyLoadMeshes is used. It directly controls the behavior of mesh LOD streaming.

This variable interacts with the FRenderAssetStreamingSettings struct, where its value is queried to set the bFullyLoadMeshes member.

Developers should be aware that this is the actual variable being modified when they use the r.Streaming.FullyLoadMeshes console command. Any code that needs to query this setting should use CVarStreamingFullyLoadMeshes.GetValueOnAnyThread().

Best practices include:

  1. Using the r.Streaming.FullyLoadMeshes console command for runtime changes rather than directly modifying CVarStreamingFullyLoadMeshes.
  2. When querying the value in C++ code, use the GetValueOnAnyThread() method to ensure thread-safe access.
  3. Remember that changes to this variable will affect the entire engine’s mesh streaming behavior, so use it cautiously.

#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:194

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarStreamingFullyLoadMeshes(
	TEXT("r.Streaming.FullyLoadMeshes"),
	0,
	TEXT("If non-zero, stream in all mesh LODs. This allows semi-disabling mesh LOD streaming without recook."),
	ECVF_Default);

TAutoConsoleVariable<int32> CVarStreamingUseAllMips(
	TEXT("r.Streaming.UseAllMips"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> CVarStreamingFullyLoadMeshes(
	TEXT("r.Streaming.FullyLoadMeshes"),
	0,
	TEXT("If non-zero, stream in all mesh LODs. This allows semi-disabling mesh LOD streaming without recook."),
	ECVF_Default);

TAutoConsoleVariable<int32> CVarStreamingUseAllMips(

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

Scope (from outer to inner):

file
function     void FRenderAssetStreamingSettings::Update

Source code excerpt:

	bLimitPoolSizeToVRAM = !GIsEditor && CVarStreamingLimitPoolSizeToVRAM.GetValueOnAnyThread() != 0;
	bFullyLoadUsedTextures = CVarStreamingFullyLoadUsedTextures.GetValueOnAnyThread() != 0;
	bFullyLoadMeshes = CVarStreamingFullyLoadMeshes.GetValueOnAnyThread() != 0;
	bUseAllMips = CVarStreamingUseAllMips.GetValueOnAnyThread() != 0;
	MinMipForSplitRequest = CVarStreamingMinMipForSplitRequest.GetValueOnAnyThread();
	PerTextureBiasViewBoostThreshold = CVarStreamingPerTextureBiasViewBoostThreshold.GetValueOnAnyThread();
	MaxHiddenPrimitiveViewBoost = FMath::Max<float>(1.f, CVarStreamingMaxHiddenPrimitiveViewBoost.GetValueOnAnyThread());
	MinLevelRenderAssetScreenSize = CVarStreamingMinLevelRenderAssetScreenSize.GetValueOnAnyThread();
	MaxTextureUVDensity = CVarStreamingMaxTextureUVDensity.GetValueOnAnyThread();