r.VT.Residency.AdjustmentRate

r.VT.Residency.AdjustmentRate

#Overview

name: r.VT.Residency.AdjustmentRate

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.AdjustmentRate is to control the rate at which the mip bias is adjusted due to Virtual Texture pool residency in Unreal Engine’s rendering system.

This setting variable is primarily used by the Virtual Texturing subsystem within Unreal Engine’s rendering module. It’s specifically utilized in the VirtualTexturePhysicalSpace component, which manages the physical memory space for virtual textures.

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

The associated variable CVarVTResidencyAdjustmentRate directly interacts with r.VT.Residency.AdjustmentRate. They share the same value and purpose.

Developers must be aware that this variable affects the performance and visual quality of virtual textures. A higher adjustment rate will cause faster changes in mip bias, which could lead to more noticeable transitions in texture quality but potentially better memory usage. A lower rate will result in smoother transitions but might be slower to react to memory pressure.

Best practices when using this variable include:

  1. Fine-tuning the value based on the specific needs of the project, balancing between visual quality and memory efficiency.
  2. Monitoring its impact on performance, especially in memory-constrained environments.
  3. Consider adjusting it in conjunction with other Virtual Texturing settings for optimal results.

Regarding the associated variable CVarVTResidencyAdjustmentRate:

The purpose of CVarVTResidencyAdjustmentRate is identical to r.VT.Residency.AdjustmentRate, as they are directly linked.

This variable is used within the FVirtualTexturePhysicalSpace::UpdateResidencyTracking function to retrieve the current adjustment rate value. It’s part of the calculation that determines how to adjust the Virtual Texture system based on current memory usage.

The value is set and accessed using the TAutoConsoleVariable template, which allows for runtime modification.

CVarVTResidencyAdjustmentRate interacts with other Virtual Texturing variables such as CVarVTResidencyLowerBound, CVarVTResidencyUpperBound, and CVarVTResidencyMaxMipMapBias in the residency tracking update process.

Developers should be aware that changes to this variable will directly affect the behavior of the Virtual Texturing system. It’s crucial to understand the implications of adjusting this value on both visual quality and performance.

Best practices include testing different values in various scenarios to find the optimal setting for your specific use case, and potentially exposing this setting to artists or technical artists for fine-tuning in different areas of your game or application.

#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:48

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarVTResidencyAdjustmentRate(
	TEXT("r.VT.Residency.AdjustmentRate"),
	0.2,
	TEXT("Rate at which we adjust mip bias due to Virtual Texture pool residency.\n")
	TEXT("Default 0.2"),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarVTResidencyAdjustmentRate(
	TEXT("r.VT.Residency.AdjustmentRate"),
	0.2,
	TEXT("Rate at which we adjust mip bias due to Virtual Texture pool residency.\n")
	TEXT("Default 0.2"),
	ECVF_RenderThreadSafe);

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

Scope (from outer to inner):

file
function     void FVirtualTexturePhysicalSpace::UpdateResidencyTracking

Source code excerpt:

	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();
	const float LockedPageResidency = (float)NumLockedPages / (float)NumPages;