r.Streaming.HLODStrategy
r.Streaming.HLODStrategy
#Overview
name: r.Streaming.HLODStrategy
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Define the HLOD streaming strategy.\n0: stream\n1: stream only mip 0\n2: disable streaming
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.HLODStrategy is to define the streaming strategy for Hierarchical Level of Detail (HLOD) in Unreal Engine 5. This setting variable is part of the texture streaming system, which is responsible for managing the loading and unloading of texture mip levels based on the camera’s distance from objects in the scene.
This setting variable is primarily used by the Engine’s streaming subsystem, specifically within the texture streaming helpers. It’s defined in the TextureStreamingHelpers.cpp file, which is part of the Engine’s runtime module.
The value of this variable is set through a console variable (CVarStreamingHLODStrategy) with three possible options: 0: stream normally 1: stream only mip 0 (highest resolution) 2: disable streaming
The associated variable CVarStreamingHLODStrategy interacts directly with r.Streaming.HLODStrategy, as they share the same value. This console variable is used to get the current value of the HLOD strategy in the FRenderAssetStreamingSettings::Update function.
Developers must be aware that changing this variable can significantly impact performance and memory usage. Setting it to 1 (stream only mip 0) or 2 (disable streaming) can lead to increased memory consumption, as it either forces the highest resolution textures to be loaded or prevents any streaming optimization for HLODs.
Best practices when using this variable include:
- Leave it at the default value (0) for most cases, as this allows the engine to optimize HLOD streaming automatically.
- Use value 1 only when you need the highest quality HLODs at all times and have sufficient memory to handle it.
- Use value 2 with caution, as it disables HLOD streaming entirely, which can lead to performance issues in large scenes.
- Always profile your game’s performance and memory usage when adjusting this setting, especially in large or complex scenes.
Regarding the associated variable CVarStreamingHLODStrategy, it’s an internal console variable used to control the r.Streaming.HLODStrategy setting. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime through console commands. This variable is used in the FRenderAssetStreamingSettings::Update function to retrieve the current HLOD strategy value and apply it to the streaming settings. Developers should interact with this setting through the r.Streaming.HLODStrategy console command rather than directly manipulating the CVarStreamingHLODStrategy variable in code.
#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:136
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarStreamingHLODStrategy(
TEXT("r.Streaming.HLODStrategy"),
0,
TEXT("Define the HLOD streaming strategy.\n")
TEXT("0: stream\n")
TEXT("1: stream only mip 0\n")
TEXT("2: disable streaming"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingHLODStrategy
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:135
Scope: file
Source code excerpt:
ECVF_Cheat);
TAutoConsoleVariable<int32> CVarStreamingHLODStrategy(
TEXT("r.Streaming.HLODStrategy"),
0,
TEXT("Define the HLOD streaming strategy.\n")
TEXT("0: stream\n")
TEXT("1: stream only mip 0\n")
TEXT("2: disable streaming"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:309
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
MaxEffectiveScreenSize = CVarStreamingScreenSizeEffectiveMax.GetValueOnAnyThread();
MaxTempMemoryAllowed = CVarStreamingMaxTempMemoryAllowed.GetValueOnAnyThread();
HLODStrategy = CVarStreamingHLODStrategy.GetValueOnAnyThread();
GlobalMipBias = !GIsEditor ? FMath::FloorToInt(FMath::Max<float>(0.f, CVarStreamingMipBias.GetValueOnAnyThread())) : 0;
PoolSize = CVarStreamingPoolSize.GetValueOnAnyThread();
MeshPoolSize = CVarStreamingPoolSizeForMeshes.GetValueOnAnyThread();
bUsePerTextureBias = CVarStreamingUsePerTextureBias.GetValueOnAnyThread() != 0;
bUseNewMetrics = CVarStreamingUseNewMetrics.GetValueOnAnyThread() != 0;
bLimitPoolSizeToVRAM = !GIsEditor && CVarStreamingLimitPoolSizeToVRAM.GetValueOnAnyThread() != 0;