r.Shadow.Virtual.SMRT.RayCountDirectional
r.Shadow.Virtual.SMRT.RayCountDirectional
#Overview
name: r.Shadow.Virtual.SMRT.RayCountDirectional
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Ray count for shadow map tracing of directional lights. 0 = disabled.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.Virtual.SMRT.RayCountDirectional is to control the number of rays used for shadow map tracing of directional lights in Unreal Engine’s virtual shadow map system. This setting is part of the rendering system, specifically for shadow rendering.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the Virtual Shadow Maps subsystem. It’s referenced in the VirtualShadowMapProjection.cpp file, which suggests it’s crucial for the shadow projection calculations.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 7, but can be changed at runtime through console commands or project settings.
The associated variable CVarSMRTRayCountDirectional directly interacts with r.Shadow.Virtual.SMRT.RayCountDirectional. They share the same value and purpose.
Developers should be aware that:
- Setting this value to 0 disables the feature.
- Higher values will increase shadow quality but also increase rendering cost.
- This setting is marked with ECVF_Scalability, indicating it affects performance and can be adjusted for different quality presets.
- It’s also marked as ECVF_RenderThreadSafe, meaning it can be safely changed on the render thread.
Best practices when using this variable include:
- Balancing between shadow quality and performance based on target hardware.
- Using it in conjunction with other shadow-related settings for optimal results.
- Consider exposing it in scalability settings to allow users to adjust based on their hardware capabilities.
Regarding the associated variable CVarSMRTRayCountDirectional:
- It’s purpose is the same as r.Shadow.Virtual.SMRT.RayCountDirectional.
- It’s used in the GetVirtualShadowMapSMRTSettings function to populate the SMRTRayCount field of the FVirtualShadowMapSMRTSettings struct.
- The value is retrieved using GetValueOnRenderThread(), ensuring thread-safe access.
- It’s used specifically for directional lights, as evidenced by the bDirectionalLight condition.
- Developers should be aware that changes to this CVar will directly affect the behavior of the virtual shadow map system for directional lights.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:146, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:170, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:197, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
8
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:224, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
8
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:251, section: [ShadowQuality@Cine]
- INI Section:
ShadowQuality@Cine
- Raw value:
16
- Is Array:
False
#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:69
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSMRTRayCountDirectional(
TEXT( "r.Shadow.Virtual.SMRT.RayCountDirectional" ),
7,
TEXT( "Ray count for shadow map tracing of directional lights. 0 = disabled." ),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarSMRTSamplesPerRayDirectional(
#Associated Variable and Callsites
This variable is associated with another variable named CVarSMRTRayCountDirectional
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:68
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarSMRTRayCountDirectional(
TEXT( "r.Shadow.Virtual.SMRT.RayCountDirectional" ),
7,
TEXT( "Ray count for shadow map tracing of directional lights. 0 = disabled." ),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:190
Scope (from outer to inner):
file
function FVirtualShadowMapSMRTSettings GetVirtualShadowMapSMRTSettings
Source code excerpt:
if (bDirectionalLight)
{
Out.SMRTRayCount = CVarSMRTRayCountDirectional.GetValueOnRenderThread();
Out.SMRTSamplesPerRay = CVarSMRTSamplesPerRayDirectional.GetValueOnRenderThread();
Out.SMRTRayLengthScale = CVarSMRTRayLengthScaleDirectional.GetValueOnRenderThread();
Out.SMRTCotMaxRayAngleFromLight = 0.0f; // unused in this path
Out.SMRTTexelDitherScale = CVarSMRTTexelDitherScaleDirectional.GetValueOnRenderThread();
Out.SMRTExtrapolateSlope = CVarSMRTExtrapolateMaxSlopeDirectional.GetValueOnRenderThread();
Out.SMRTMaxSlopeBias = 0.0f; // unused in this path