r.Streaming.LowResHandlingMode
r.Streaming.LowResHandlingMode
#Overview
name: r.Streaming.LowResHandlingMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
How to handle assets with too many missing MIPs or LODs. 0 (default): do nothing, 1: load before regular streaming requests, 2: load before async loading precache requests.
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.LowResHandlingMode is to control how Unreal Engine handles assets with too many missing MIPs (Mipmaps) or LODs (Levels of Detail) during streaming. This setting is primarily used in the rendering and asset streaming systems.
-
The Unreal Engine subsystem that relies on this setting variable is the asset streaming system, particularly for textures, static meshes, and skeletal meshes.
-
The value of this variable is set through a console variable (CVarStreamingLowResHandlingMode) defined in the TextureStreamingHelpers.cpp file. It can be changed at runtime using console commands or through code.
-
This variable interacts with other variables related to asset streaming and async loading, such as s.AsyncLoadingPrecachePriority.
-
Developers must be aware that this variable affects the priority of loading low-resolution assets. It can impact performance and visual quality, especially in situations where many assets are streaming simultaneously.
-
Best practices when using this variable:
- Use the default value (0) unless there are specific issues with low-resolution assets.
- If low-resolution assets are causing visual problems, consider setting it to 1 or 2 to prioritize their loading.
- Monitor performance when changing this setting, as it can affect loading times and memory usage.
Regarding the associated variable CVarStreamingLowResHandlingMode:
- It is the actual console variable that stores and manages the r.Streaming.LowResHandlingMode setting.
- It is defined as an integer with three possible values: 0: Do nothing (default) 1: Load before regular streaming requests 2: Load before async loading precache requests
- This variable is used in various parts of the engine to determine how to handle low-resolution assets during streaming operations.
- When using this variable in code, developers should use the GetValueOnAnyThread() method to retrieve its current value, as seen in the provided code snippets.
- Changes to this variable will affect the behavior of asset streaming across the engine, so it should be modified with caution and thorough testing.
#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:268
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarStreamingLowResHandlingMode(
TEXT("r.Streaming.LowResHandlingMode"),
(int32)FRenderAssetStreamingSettings::LRHM_DoNothing,
TEXT("How to handle assets with too many missing MIPs or LODs. 0 (default): do nothing, 1: load before regular streaming requests, 2: load before async loading precache requests."),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarPrioritizeMeshLODRetention(
TEXT("r.Streaming.PrioritizeMeshLODRetention"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingLowResHandlingMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Internal/Streaming/SkeletalMeshUpdate.cpp:458
Scope (from outer to inner):
file
function void FSkeletalMeshStreamIn_IO::SetIORequest
Source code excerpt:
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
Priority = (EAsyncIOPriorityAndFlags)FMath::Clamp<int32>(AsyncIOPriority + 1, AIOP_BelowNormal, AIOP_MAX);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StaticMeshUpdate.cpp:574
Scope (from outer to inner):
file
function void FStaticMeshStreamIn_IO::SetIORequest
Source code excerpt:
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
Priority = (EAsyncIOPriorityAndFlags)FMath::Clamp<int32>(AsyncIOPriority + 1, AIOP_BelowNormal, AIOP_MAX);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/Texture2DMipDataProvider_IO.cpp:105
Scope (from outer to inner):
file
function int32 FTexture2DMipDataProvider_IO::GetMips
Source code excerpt:
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
Priority = (EAsyncIOPriorityAndFlags)FMath::Clamp<int32>(AsyncIOPriority + 1, AIOP_BelowNormal, AIOP_MAX);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/Texture2DStreamIn_IO.cpp:83
Scope (from outer to inner):
file
function void FTexture2DStreamIn_IO::SetIORequests
Source code excerpt:
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
Priority = (EAsyncIOPriorityAndFlags)FMath::Clamp<int32>(AsyncIOPriority + 1, AIOP_BelowNormal, AIOP_MAX);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:267
Scope: file
Source code excerpt:
TEXT("Texture streaming is time sliced per frame. This values gives the number of frames to visit all textures."));
TAutoConsoleVariable<int32> CVarStreamingLowResHandlingMode(
TEXT("r.Streaming.LowResHandlingMode"),
(int32)FRenderAssetStreamingSettings::LRHM_DoNothing,
TEXT("How to handle assets with too many missing MIPs or LODs. 0 (default): do nothing, 1: load before regular streaming requests, 2: load before async loading precache requests."),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarPrioritizeMeshLODRetention(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:326
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
bUseMaterialData = bUseNewMetrics && CVarStreamingUseMaterialData.GetValueOnAnyThread() != 0;
HiddenPrimitiveScale = bUseNewMetrics ? CVarStreamingHiddenPrimitiveScale.GetValueOnAnyThread() : 1.f;
LowResHandlingMode = (ELowResHandlingMode)CVarStreamingLowResHandlingMode.GetValueOnAnyThread();
bMipCalculationEnablePerLevelList = CVarStreamingMipCalculationEnablePerLevelList.GetValueOnAnyThread() != 0;
bPrioritizeMeshLODRetention = CVarPrioritizeMeshLODRetention.GetValueOnAnyThread() != 0;
VRAMPercentageClamp = CVarStreamingVRAMPercentageClamp.GetValueOnAnyThread();
MaterialQualityLevel = (int32)GetCachedScalabilityCVars().MaterialQualityLevel;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.h:66
Scope: file
Source code excerpt:
extern TAutoConsoleVariable<int32> CVarStreamingDefragDynamicBounds;
extern TAutoConsoleVariable<float> CVarStreamingMaxTextureUVDensity;
extern TAutoConsoleVariable<int32> CVarStreamingLowResHandlingMode;
struct FRenderAssetStreamingSettings
{
// How to handle assets with too many missing MIPs or LODs
enum ELowResHandlingMode
{