r.Streaming.MaxHiddenPrimitiveViewBoost
r.Streaming.MaxHiddenPrimitiveViewBoost
#Overview
name: r.Streaming.MaxHiddenPrimitiveViewBoost
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum view boost that can affect hidden primitive.\nThis prevents temporary small FOV from streaming all textures to their highest mips.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.MaxHiddenPrimitiveViewBoost is to set a maximum view boost that can affect hidden primitives in the texture streaming system. This setting prevents temporary small fields of view (FOV) from streaming all textures to their highest mip levels, which could potentially cause unnecessary memory usage and performance issues.
This setting variable is primarily used in the texture streaming subsystem of Unreal Engine 5. It’s part of the engine’s rendering and memory management systems, specifically focusing on optimizing texture streaming for hidden primitives.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 1.5.
The associated variable CVarStreamingMaxHiddenPrimitiveViewBoost interacts directly with r.Streaming.MaxHiddenPrimitiveViewBoost. They share the same value and purpose.
Developers must be aware that this variable affects how aggressively textures for hidden primitives are streamed. Setting this value too high might result in unnecessary texture streaming for objects that aren’t visible, potentially impacting performance and memory usage. Conversely, setting it too low might cause visible popping or lower quality textures when objects become visible.
Best practices when using this variable include:
- Keep the value reasonable (close to the default of 1.5) unless there’s a specific need to change it.
- Monitor performance and memory usage when adjusting this value.
- Consider the nature of your game’s camera movement and level design when tuning this value.
- Test thoroughly with different FOVs and camera movements to ensure optimal texture streaming behavior.
Regarding the associated variable CVarStreamingMaxHiddenPrimitiveViewBoost:
- Its purpose is identical to r.Streaming.MaxHiddenPrimitiveViewBoost.
- It’s used in the FRenderAssetStreamingSettings::Update function to set the MaxHiddenPrimitiveViewBoost value.
- The value is retrieved using GetValueOnAnyThread(), indicating it can be accessed from multiple threads.
- It’s clamped to a minimum value of 1.0 using FMath::Max
(1.f, …), ensuring that hidden primitives always have at least a neutral boost factor.
When working with this associated variable, developers should follow the same best practices and considerations as with r.Streaming.MaxHiddenPrimitiveViewBoost.
#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:153
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarStreamingMaxHiddenPrimitiveViewBoost(
TEXT("r.Streaming.MaxHiddenPrimitiveViewBoost"),
1.5,
TEXT("Maximum view boost that can affect hidden primitive.\n")
TEXT("This prevents temporary small FOV from streaming all textures to their highest mips."),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureInstanceView.h:237
Scope: file
Source code excerpt:
float ScreenSizeFloat;
// The extra view boost for visible primitive (if ViewInfo.BoostFactor > "r.Streaming.MaxHiddenPrimitiveViewBoost").
float ExtraBoostForVisiblePrimitiveFloat;
};
typedef TArray<FStreamingViewInfoExtra, TInlineAllocator<4>> FStreamingViewInfoExtraArray;
// Data used to compute visibility
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingMaxHiddenPrimitiveViewBoost
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:152
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarStreamingMaxHiddenPrimitiveViewBoost(
TEXT("r.Streaming.MaxHiddenPrimitiveViewBoost"),
1.5,
TEXT("Maximum view boost that can affect hidden primitive.\n")
TEXT("This prevents temporary small FOV from streaming all textures to their highest mips."),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:321
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
MinMipForSplitRequest = CVarStreamingMinMipForSplitRequest.GetValueOnAnyThread();
PerTextureBiasViewBoostThreshold = CVarStreamingPerTextureBiasViewBoostThreshold.GetValueOnAnyThread();
MaxHiddenPrimitiveViewBoost = FMath::Max<float>(1.f, CVarStreamingMaxHiddenPrimitiveViewBoost.GetValueOnAnyThread());
MinLevelRenderAssetScreenSize = CVarStreamingMinLevelRenderAssetScreenSize.GetValueOnAnyThread();
MaxTextureUVDensity = CVarStreamingMaxTextureUVDensity.GetValueOnAnyThread();
bUseMaterialData = bUseNewMetrics && CVarStreamingUseMaterialData.GetValueOnAnyThread() != 0;
HiddenPrimitiveScale = bUseNewMetrics ? CVarStreamingHiddenPrimitiveScale.GetValueOnAnyThread() : 1.f;
LowResHandlingMode = (ELowResHandlingMode)CVarStreamingLowResHandlingMode.GetValueOnAnyThread();
bMipCalculationEnablePerLevelList = CVarStreamingMipCalculationEnablePerLevelList.GetValueOnAnyThread() != 0;