r.Ortho.VSM.ClipmapLODBias
r.Ortho.VSM.ClipmapLODBias
#Overview
name: r.Ortho.VSM.ClipmapLODBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
LOD setting for adjusting the VSM first level from it\'s OrthoWidth based value.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Ortho.VSM.ClipmapLODBias is to adjust the LOD (Level of Detail) setting for the first level of Virtual Shadow Map (VSM) clipmaps in orthographic projections. This setting variable is part of the rendering system, specifically for shadow rendering optimization.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the Virtual Shadow Maps subsystem. It’s implemented in the VirtualShadowMapClipmap.cpp file, which suggests it’s closely tied to the clipmap functionality of virtual shadow maps.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 0, which can be changed at runtime.
The associated variable CVarOrthoVSMClipmapLODBias interacts directly with r.Ortho.VSM.ClipmapLODBias. They share the same value and purpose.
Developers must be aware that this variable affects the LOD calculations for orthographic virtual shadow maps. It allows for manual correction of the first level of the VSM clipmap, which can impact shadow quality and performance.
Best practices when using this variable include:
- Use it cautiously, as it directly affects shadow rendering quality and performance.
- Test thoroughly after adjusting this value to ensure desired shadow quality is maintained.
- Consider the performance implications, especially on lower-end hardware.
- Use in conjunction with other shadow-related settings for optimal results.
Regarding the associated variable CVarOrthoVSMClipmapLODBias:
The purpose of CVarOrthoVSMClipmapLODBias is identical to r.Ortho.VSM.ClipmapLODBias. It’s the internal representation of the console variable in the C++ code.
This variable is used in the Renderer module, specifically in the Virtual Shadow Maps system. It’s defined and used in the VirtualShadowMapClipmap.cpp file.
The value is set when the TAutoConsoleVariable is initialized, but can be changed at runtime through the console or game settings.
CVarOrthoVSMClipmapLODBias interacts directly with the shadow mapping system, specifically in the FVirtualShadowMapClipmap constructor where it’s used to adjust the FirstLevel of the clipmap.
Developers should be aware that this variable is used directly in shadow calculations and can have a significant impact on shadow quality and performance.
Best practices include using GetValueOnRenderThread() to access its value, as shown in the provided code snippet, to ensure thread-safe access in render thread operations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapClipmap.cpp:101
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarOrthoVSMClipmapLODBias(
TEXT("r.Ortho.VSM.ClipmapLODBias"),
0,
TEXT("LOD setting for adjusting the VSM first level from it's OrthoWidth based value."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<bool> CVarOrthoVSMProjectViewOrigin(
#Associated Variable and Callsites
This variable is associated with another variable named CVarOrthoVSMClipmapLODBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapClipmap.cpp:100
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarOrthoVSMClipmapLODBias(
TEXT("r.Ortho.VSM.ClipmapLODBias"),
0,
TEXT("LOD setting for adjusting the VSM first level from it's OrthoWidth based value."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapClipmap.cpp:240
Scope (from outer to inner):
file
function FVirtualShadowMapClipmap::FVirtualShadowMapClipmap
Source code excerpt:
}
//Allow manual correction using the Ortho only FirstLevel bias.
FirstLevel = FMath::Max(FirstLevel + CVarOrthoVSMClipmapLODBias.GetValueOnRenderThread(), 0);
}
LastLevel = FMath::Max(FirstLevel, LastLevel);
int32 LevelCount = LastLevel - FirstLevel + 1;
// Per-clipmap projection data