r.Streaming.MipBias
r.Streaming.MipBias
#Overview
name: r.Streaming.MipBias
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0..x reduce texture quality for streaming by a floating point number.\n0: use full resolution (default)\n1: drop one mip\n2: drop two mips
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.MipBias is to reduce texture quality for streaming by adjusting the mip level of textures. This setting is primarily used for scalability, affecting GPU memory usage and potential streaming stalls.
This setting variable is utilized by the Unreal Engine’s texture streaming system, which is part of the rendering module. It’s specifically referenced in the Engine’s runtime, as seen in the TextureStreamingHelpers.cpp file.
The value of this variable is set through a console variable (CVarStreamingMipBias) with a default value of 0.0f. It can be adjusted at runtime, allowing for dynamic changes to texture streaming behavior.
The r.Streaming.MipBias interacts directly with the GlobalMipBias variable within the FRenderAssetStreamingSettings struct. The value of r.Streaming.MipBias is used to calculate GlobalMipBias, but only when not in editor mode.
Developers should be aware that:
- This setting affects the entire game’s texture quality, not individual textures.
- Higher values result in lower texture quality but reduced memory usage and potentially improved performance.
- The setting is ignored in the editor to maintain visual fidelity during development.
Best practices when using this variable include:
- Use it as a scalability option, allowing players with lower-end hardware to reduce texture quality for better performance.
- Consider exposing this as a user-adjustable setting in graphics options.
- Test thoroughly with different values to ensure acceptable visual quality is maintained.
Regarding the associated variable CVarStreamingMipBias:
The purpose of CVarStreamingMipBias is to provide a console-accessible way to control the r.Streaming.MipBias setting. It’s the actual variable that stores and provides the value for r.Streaming.MipBias.
This variable is part of the Engine’s console variable system, which allows for runtime configuration of various engine parameters.
The value is set when the engine initializes the console variables, but can be changed at runtime through console commands or code.
CVarStreamingMipBias interacts directly with the r.Streaming.MipBias setting, as they represent the same value. It’s also used to calculate the GlobalMipBias in FRenderAssetStreamingSettings.
Developers should be aware that:
- Changes to this variable will immediately affect texture streaming behavior.
- The variable accepts floating-point values, allowing for fine-grained control.
Best practices for using CVarStreamingMipBias include:
- Use it for debugging or testing different mip bias values during development.
- Consider exposing it through a dev console in builds for quick adjustments during testing.
- Remember that changes made through this variable will be temporary unless saved to a configuration file.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:556, section: [TextureQuality@0]
- INI Section:
TextureQuality@0
- Raw value:
16
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:567, section: [TextureQuality@1]
- INI Section:
TextureQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:578, section: [TextureQuality@2]
- INI Section:
TextureQuality@2
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:589, section: [TextureQuality@3]
- INI Section:
TextureQuality@3
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:600, section: [TextureQuality@Cine]
- INI Section:
TextureQuality@Cine
- Raw value:
0
- Is Array:
False
#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:171
Scope: file
Source code excerpt:
// Used for scalability (GPU memory, streaming stalls)
TAutoConsoleVariable<float> CVarStreamingMipBias(
TEXT("r.Streaming.MipBias"),
0.0f,
TEXT("0..x reduce texture quality for streaming by a floating point number.\n")
TEXT("0: use full resolution (default)\n")
TEXT("1: drop one mip\n")
TEXT("2: drop two mips"),
ECVF_Scalability
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingMipBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:170
Scope: file
Source code excerpt:
// Used for scalability (GPU memory, streaming stalls)
TAutoConsoleVariable<float> CVarStreamingMipBias(
TEXT("r.Streaming.MipBias"),
0.0f,
TEXT("0..x reduce texture quality for streaming by a floating point number.\n")
TEXT("0: use full resolution (default)\n")
TEXT("1: drop one mip\n")
TEXT("2: drop two mips"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:310
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
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;
bFullyLoadUsedTextures = CVarStreamingFullyLoadUsedTextures.GetValueOnAnyThread() != 0;