r.VT.Residency.LowerBound

r.VT.Residency.LowerBound

#Overview

name: r.VT.Residency.LowerBound

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VT.Residency.LowerBound is to control the Virtual Texture pool residency threshold below which the system decreases the mip bias. This setting is part of Unreal Engine 5’s Virtual Texturing system, which is a key component of the rendering subsystem.

This setting variable is primarily used in the Renderer module, specifically within the Virtual Texturing (VT) subsystem. It’s defined and used in the VirtualTexturePhysicalSpace.cpp file, which suggests it’s closely tied to the management of virtual texture physical spaces.

The value of this variable is set as a console variable with a default value of 0.95f. It can be modified at runtime through the console or configuration files.

The variable interacts with several other Virtual Texturing-related variables, such as CVarVTResidencyLockedUpperBound, CVarVTResidencyUpperBound, CVarVTResidencyAdjustmentRate, and CVarVTResidencyMaxMipMapBias. These variables work together to manage the residency and mip bias of virtual textures.

Developers should be aware that this variable directly affects the performance and quality trade-off in virtual texturing. A lower value might improve performance but could potentially reduce texture quality, while a higher value might maintain higher texture quality at the cost of performance.

Best practices when using this variable include:

  1. Carefully balancing it with other residency-related variables for optimal performance and quality.
  2. Testing different values in various scenarios to find the best setting for your specific use case.
  3. Considering the target hardware capabilities when adjusting this value.

Regarding the associated variable CVarVTResidencyLowerBound:

The purpose of CVarVTResidencyLowerBound is to provide a programmatic way to access and modify the r.VT.Residency.LowerBound setting within the C++ code.

This variable is used in the Renderer module, specifically in the VirtualTexturePhysicalSpace.cpp file. It’s part of the Virtual Texturing system’s implementation.

The value of CVarVTResidencyLowerBound is set to match r.VT.Residency.LowerBound, initialized with a default value of 0.95f.

It interacts with other VT residency-related variables in the UpdateResidencyTracking function, where it’s used to determine how to adjust the mip bias based on the current residency state.

Developers should be aware that modifying CVarVTResidencyLowerBound directly in code will affect the behavior of the Virtual Texturing system, potentially impacting rendering performance and quality.

Best practices for using CVarVTResidencyLowerBound include:

  1. Using GetValueOnRenderThread() when accessing its value to ensure thread-safety.
  2. Considering the impact on the entire Virtual Texturing system when modifying this value.
  3. Coordinating changes to this variable with other related VT residency variables for consistent behavior.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTexturePhysicalSpace.cpp:33

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarVTResidencyLowerBound(
	TEXT("r.VT.Residency.LowerBound"),
	0.95f,
	TEXT("Virtual Texture pool residency below which we decrease mip bias.\n")
	TEXT("Default 0.95"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarVTResidencyLockedUpperBound(

#Associated Variable and Callsites

This variable is associated with another variable named CVarVTResidencyLowerBound. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTexturePhysicalSpace.cpp:32

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarVTResidencyLowerBound(
	TEXT("r.VT.Residency.LowerBound"),
	0.95f,
	TEXT("Virtual Texture pool residency below which we decrease mip bias.\n")
	TEXT("Default 0.95"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTexturePhysicalSpace.cpp:217

Scope (from outer to inner):

file
function     void FVirtualTexturePhysicalSpace::UpdateResidencyTracking

Source code excerpt:

{
	float LockedUpperBound = CVarVTResidencyLockedUpperBound.GetValueOnRenderThread();
	float LowerBound = CVarVTResidencyLowerBound.GetValueOnRenderThread();
	float UpperBound = CVarVTResidencyUpperBound.GetValueOnRenderThread();
	float AdjustmentRate = CVarVTResidencyAdjustmentRate.GetValueOnRenderThread();
	float MaxMipMapBias = CVarVTResidencyMaxMipMapBias.GetValueOnRenderThread();

	const uint32 NumPages = Pool.GetNumPages();
	const uint32 NumLockedPages = Pool.GetNumLockedPages();