r.Streaming.HiddenPrimitiveScale
r.Streaming.HiddenPrimitiveScale
#Overview
name: r.Streaming.HiddenPrimitiveScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Define the resolution scale to apply when not in range.\n.5: drop one mip\n1: ignore visiblity
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.HiddenPrimitiveScale is to define the resolution scale for hidden primitives in texture streaming. It is part of the texture streaming system in Unreal Engine 5.
This setting variable is primarily used by the Engine’s texture streaming subsystem, specifically within the rendering and streaming modules. Based on the callsites, it’s implemented in the TextureStreamingHelpers.cpp file, which is part of the Engine’s runtime.
The value of this variable is set through a console variable (cvar) system. It’s initialized with a default value of 0.5, which means it will drop one mip level for hidden primitives. Developers can modify this value at runtime using console commands.
The associated variable CVarStreamingHiddenPrimitiveScale directly interacts with r.Streaming.HiddenPrimitiveScale. They share the same value and purpose.
Developers must be aware that this variable affects the resolution of textures on hidden primitives. A value of 0.5 means hidden primitives will use textures with one mip level lower than they would if visible, while a value of 1 means visibility is ignored for texture resolution purposes.
Best practices when using this variable include:
- Use it to optimize memory usage by reducing the resolution of textures on hidden objects.
- Be cautious when setting it to 1, as it may increase memory usage unnecessarily.
- Consider the impact on visual quality when objects become visible if using a lower scale.
- Use in conjunction with other streaming settings for a comprehensive texture streaming strategy.
Regarding the associated variable CVarStreamingHiddenPrimitiveScale:
Its purpose is identical to r.Streaming.HiddenPrimitiveScale, serving as the actual cvar implementation.
It’s used in the FRenderAssetStreamingSettings::Update function to apply the current value to the HiddenPrimitiveScale member of the settings struct.
The value is retrieved using the GetValueOnAnyThread() method, allowing for thread-safe access.
Developers should be aware that changes to this cvar will affect the engine’s behavior on the next update of the streaming settings.
Best practices include using the cvar system to modify this value during development or debugging, and considering exposing it as a configurable setting in the final product if dynamic adjustment is needed.
#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:161
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarStreamingHiddenPrimitiveScale(
TEXT("r.Streaming.HiddenPrimitiveScale"),
0.5,
TEXT("Define the resolution scale to apply when not in range.\n")
TEXT(".5: drop one mip\n")
TEXT("1: ignore visiblity"),
ECVF_Default
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingHiddenPrimitiveScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:160
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarStreamingHiddenPrimitiveScale(
TEXT("r.Streaming.HiddenPrimitiveScale"),
0.5,
TEXT("Define the resolution scale to apply when not in range.\n")
TEXT(".5: drop one mip\n")
TEXT("1: ignore visiblity"),
ECVF_Default
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:325
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
MaxTextureUVDensity = CVarStreamingMaxTextureUVDensity.GetValueOnAnyThread();
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;