r.Streaming.UsePerTextureBias
r.Streaming.UsePerTextureBias
#Overview
name: r.Streaming.UsePerTextureBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If non-zero, each texture will be assigned a mip bias between 0 and MipBias as required to fit in budget.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.UsePerTextureBias is to control the texture streaming system’s behavior in assigning mip bias to individual textures. Specifically, it determines whether each texture should be assigned a mip bias between 0 and MipBias as required to fit within the texture streaming budget.
This setting variable is primarily used by the texture streaming subsystem within Unreal Engine’s rendering module. It’s an important part of the engine’s texture streaming optimization system.
The value of this variable is set through a console variable (CVarStreamingUsePerTextureBias) in the Engine’s texture streaming helpers. It’s initialized with a default value of 1, meaning the feature is enabled by default.
The associated variable CVarStreamingUsePerTextureBias directly interacts with r.Streaming.UsePerTextureBias. They share the same value and purpose.
Developers should be aware that this variable significantly impacts how textures are streamed and rendered. When enabled (non-zero value), it allows for more granular control over texture quality, potentially improving performance and memory usage by allowing textures to be loaded at lower mip levels when under memory pressure.
Best practices when using this variable include:
- Keeping it enabled (default value of 1) for most scenarios, as it allows for better texture memory management.
- Monitoring its impact on texture quality and performance, especially in memory-constrained environments.
- Consider disabling it (set to 0) only if you need all textures to be loaded at their full resolution regardless of memory constraints.
Regarding the associated variable CVarStreamingUsePerTextureBias:
- Its purpose is identical to r.Streaming.UsePerTextureBias, serving as the console variable interface for this setting.
- It’s used in the FRenderAssetStreamingSettings::Update function to update the bUsePerTextureBias flag, which likely controls the behavior of the texture streaming system.
- The value is retrieved using GetValueOnAnyThread(), indicating it can be accessed from multiple threads.
- Developers should be aware that changes to this console variable will affect the texture streaming behavior at runtime.
- Best practices include using this console variable for debugging or runtime adjustments, while relying on the r.Streaming.UsePerTextureBias setting for default configuration.
#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:181
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarStreamingUsePerTextureBias(
TEXT("r.Streaming.UsePerTextureBias"),
1,
TEXT("If non-zero, each texture will be assigned a mip bias between 0 and MipBias as required to fit in budget."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarStreamingFullyLoadUsedTextures(
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingUsePerTextureBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:180
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarStreamingUsePerTextureBias(
TEXT("r.Streaming.UsePerTextureBias"),
1,
TEXT("If non-zero, each texture will be assigned a mip bias between 0 and MipBias as required to fit in budget."),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:313
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
PoolSize = CVarStreamingPoolSize.GetValueOnAnyThread();
MeshPoolSize = CVarStreamingPoolSizeForMeshes.GetValueOnAnyThread();
bUsePerTextureBias = CVarStreamingUsePerTextureBias.GetValueOnAnyThread() != 0;
bUseNewMetrics = CVarStreamingUseNewMetrics.GetValueOnAnyThread() != 0;
bLimitPoolSizeToVRAM = !GIsEditor && CVarStreamingLimitPoolSizeToVRAM.GetValueOnAnyThread() != 0;
bFullyLoadUsedTextures = CVarStreamingFullyLoadUsedTextures.GetValueOnAnyThread() != 0;
bFullyLoadMeshes = CVarStreamingFullyLoadMeshes.GetValueOnAnyThread() != 0;
bUseAllMips = CVarStreamingUseAllMips.GetValueOnAnyThread() != 0;
MinMipForSplitRequest = CVarStreamingMinMipForSplitRequest.GetValueOnAnyThread();