r.VT.EnableLossyCompressLightmaps
r.VT.EnableLossyCompressLightmaps
#Overview
name: r.VT.EnableLossyCompressLightmaps
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables lossy compression on virtual texture lightmaps. Lossy compression tends to have lower quality on lightmap textures, vs regular color textures.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.EnableLossyCompressLightmaps is to control lossy compression on virtual texture lightmaps in Unreal Engine 5’s rendering system. This setting variable is primarily used in the lighting and texture compression subsystems of the engine.
Based on the callsites, this variable is utilized in the Engine module, specifically within the LightMap.cpp file. It is part of the virtual texturing system and affects how lightmaps are compressed and stored.
The value of this variable is set through a console variable (CVar) named CVarVTEnableLossyCompressLightmaps. It is initialized with a default value of 0, which means lossy compression for virtual texture lightmaps is disabled by default.
The associated variable CVarVTEnableLossyCompressLightmaps directly interacts with r.VT.EnableLossyCompressLightmaps. They share the same value and purpose.
Developers must be aware that enabling this variable (setting it to a non-zero value) will apply lossy compression to virtual texture lightmaps. The comment in the code warns that lossy compression tends to have lower quality on lightmap textures compared to regular color textures.
Best practices when using this variable include:
- Keeping it disabled (0) for highest lightmap quality.
- Enabling it only when memory constraints require compression and slight quality loss is acceptable.
- Testing the visual impact thoroughly when enabled, as lightmap quality can significantly affect the overall look of a scene.
Regarding the associated variable CVarVTEnableLossyCompressLightmaps:
- It is an auto console variable of type int32.
- It is used to get the current value of the setting in the code, particularly in the FLightMapPendingTexture::StartEncoding function.
- When used, it determines the LossyCompressionAmount for the virtual texture, setting it to TLCA_Default if enabled or TLCA_None if disabled.
- Developers should use this variable to read the current state of the lossy compression setting for virtual texture lightmaps in their code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LightMap.cpp:105
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVTEnableLossyCompressLightmaps(
TEXT("r.VT.EnableLossyCompressLightmaps"),
0,
TEXT("Enables lossy compression on virtual texture lightmaps. Lossy compression tends to have lower quality on lightmap textures, vs regular color textures."));
bool IsTexelDebuggingEnabled()
{
return CVarTexelDebugging.GetValueOnGameThread() != 0;
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTEnableLossyCompressLightmaps
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LightMap.cpp:104
Scope: file
Source code excerpt:
TEXT(" 1: Included."));
static TAutoConsoleVariable<int32> CVarVTEnableLossyCompressLightmaps(
TEXT("r.VT.EnableLossyCompressLightmaps"),
0,
TEXT("Enables lossy compression on virtual texture lightmaps. Lossy compression tends to have lower quality on lightmap textures, vs regular color textures."));
bool IsTexelDebuggingEnabled()
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LightMap.cpp:1864
Scope (from outer to inner):
file
function void FLightMapPendingTexture::StartEncoding
Source code excerpt:
VirtualTexture->CompressionNoAlpha = false;
VirtualTexture->CompressionNone = !GCompressLightmaps;
VirtualTexture->LossyCompressionAmount = CVarVTEnableLossyCompressLightmaps.GetValueOnAnyThread() ? TLCA_Default : TLCA_None;
// VirtualTexture->OodleTextureSdkVersion will be set to latest by default constructor
// dynamic/generated textures use latest OodleTextureSdkVersion
FTextureFormatSettings DefaultFormatSettings;
VirtualTexture->GetDefaultFormatSettings(DefaultFormatSettings);