r.Shadow.Virtual.TranslucentQuality
r.Shadow.Virtual.TranslucentQuality
#Overview
name: r.Shadow.Virtual.TranslucentQuality
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Quality of shadow for lit translucent surfaces. This will be applied on all translucent surfaces, and has high-performance impact.\nSet to 1 to enable the high-quality mode.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.Virtual.TranslucentQuality is to control the quality of shadows for lit translucent surfaces in the rendering system of Unreal Engine 5.
This setting variable is primarily used in the rendering subsystem of Unreal Engine 5, specifically in the Virtual Shadow Maps (VSM) module. It affects the shadow quality for translucent objects.
The value of this variable is set through the console variable system. It is defined as a TAutoConsoleVariable with a default value of 0, which can be changed at runtime.
The associated variable CVarVSMTranslucentQuality interacts directly with r.Shadow.Virtual.TranslucentQuality, as they share the same value and purpose.
Developers must be aware that:
- This setting has a high-performance impact when enabled.
- It affects all translucent surfaces in the scene.
- The variable is marked as read-only and render thread safe, meaning it should not be modified frequently during runtime.
Best practices when using this variable include:
- Only enable it (set to 1) when high-quality shadows on translucent surfaces are necessary for the visual quality of the game.
- Consider the performance implications, especially on lower-end hardware.
- Use it in conjunction with other shadow and translucency settings for optimal results.
Regarding the associated variable CVarVSMTranslucentQuality:
- It is used internally to access the value of r.Shadow.Virtual.TranslucentQuality.
- The IsVSMTranslucentHighQualityEnabled() function uses this variable to determine if high-quality translucent shadows are enabled.
- When working with Virtual Shadow Maps and translucent objects, developers should use this associated variable or the IsVSMTranslucentHighQualityEnabled() function to check the current setting.
In summary, r.Shadow.Virtual.TranslucentQuality and its associated variable CVarVSMTranslucentQuality are crucial for controlling the shadow quality of translucent objects in Unreal Engine 5’s Virtual Shadow Map system, with significant implications for both visual quality and performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:147
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVSMTranslucentQuality(
TEXT("r.Shadow.Virtual.TranslucentQuality"),
0,
TEXT("Quality of shadow for lit translucent surfaces. This will be applied on all translucent surfaces, and has high-performance impact.\n")
TEXT("Set to 1 to enable the high-quality mode."),
ECVF_ReadOnly | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8484
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.Virtual.TranslucentQuality"));
const bool bHighQualityShadow = CVar && CVar->GetInt() > 0;
SET_SHADER_DEFINE(Input.Environment, SUPPORT_VSM_FOWARD_QUALITY, bHighQualityShadow ? 1 : 0);
}
{
const bool bUseTriangleStrips = GetHairStrandsUsesTriangleStrips();
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:2028
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Shadow.Virtual.TranslucentQuality"));
if (CVar && CVar->GetValueOnAnyThread() > 0)
{
KeyString += TEXT("_VSMTRANSQUALITY");
}
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarVSMTranslucentQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:146
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarVSMTranslucentQuality(
TEXT("r.Shadow.Virtual.TranslucentQuality"),
0,
TEXT("Quality of shadow for lit translucent surfaces. This will be applied on all translucent surfaces, and has high-performance impact.\n")
TEXT("Set to 1 to enable the high-quality mode."),
ECVF_ReadOnly | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:180
Scope (from outer to inner):
file
function bool IsVSMTranslucentHighQualityEnabled
Source code excerpt:
bool IsVSMTranslucentHighQualityEnabled()
{
return CVarVSMTranslucentQuality.GetValueOnRenderThread() > 0;
}
FVirtualShadowMapSMRTSettings GetVirtualShadowMapSMRTSettings(bool bDirectionalLight)
{
FVirtualShadowMapSMRTSettings Out;
Out.ScreenRayLength = CVarScreenRayLength.GetValueOnRenderThread();