r.VT.TileSize
r.VT.TileSize
#Overview
name: r.VT.TileSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Size in pixels to use for virtual texture tiles (rounded to next power-of-2)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.TileSize is to set the size in pixels for virtual texture tiles in Unreal Engine’s virtual texturing system. This setting is crucial for the rendering system, specifically for managing virtual textures.
This setting variable is primarily used in the Engine module, particularly within the virtual texturing subsystem. It’s referenced in the VirtualTextureBuildSettings.cpp file, which suggests it’s an integral part of the virtual texture building process.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 128 pixels, but can be changed at runtime or through configuration files.
The r.VT.TileSize variable interacts directly with CVarVTTileSize, which is the actual TAutoConsoleVariable that stores and manages the value. They essentially represent the same setting, with r.VT.TileSize being the console command to access it, and CVarVTTileSize being the C++ variable that holds the value.
Developers must be aware that this variable affects the size of virtual texture tiles, which can have significant implications for memory usage and rendering performance. The value is rounded to the next power of 2, so inputting a non-power-of-2 value will result in the next higher power of 2 being used.
Best practices when using this variable include:
- Carefully consider the balance between tile size and performance. Larger tiles may reduce the number of tiles needed but increase memory usage per tile.
- Test different values to find the optimal setting for your specific use case.
- Be aware of how changes to this value might affect other parts of the virtual texturing system.
- Use in conjunction with other virtual texturing settings for best results.
Regarding CVarVTTileSize, it’s the C++ variable that directly holds and manages the value set by r.VT.TileSize. It’s used internally by the engine to retrieve the current tile size setting, as seen in the FVirtualTextureBuildSettings::Init() function. When working with virtual textures in C++ code, developers would typically use CVarVTTileSize.GetValueOnAnyThread() to access the current tile size value. This ensures that any runtime changes to the r.VT.TileSize setting are reflected in the code’s behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureBuildSettings.cpp:7
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVTTileSize(
TEXT("r.VT.TileSize"),
128,
TEXT("Size in pixels to use for virtual texture tiles (rounded to next power-of-2)")
);
static TAutoConsoleVariable<int32> CVarVTTileBorderSize(
TEXT("r.VT.TileBorderSize"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTTileSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureBuildSettings.cpp:6
Scope: file
Source code excerpt:
#include UE_INLINE_GENERATED_CPP_BY_NAME(VirtualTextureBuildSettings)
static TAutoConsoleVariable<int32> CVarVTTileSize(
TEXT("r.VT.TileSize"),
128,
TEXT("Size in pixels to use for virtual texture tiles (rounded to next power-of-2)")
);
static TAutoConsoleVariable<int32> CVarVTTileBorderSize(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureBuildSettings.cpp:20
Scope (from outer to inner):
file
function void FVirtualTextureBuildSettings::Init
Source code excerpt:
void FVirtualTextureBuildSettings::Init()
{
TileSize = CVarVTTileSize.GetValueOnAnyThread();
TileBorderSize = CVarVTTileBorderSize.GetValueOnAnyThread();
}