r.Shadow.Virtual.SMRT.SamplesPerRayDirectional
r.Shadow.Virtual.SMRT.SamplesPerRayDirectional
#Overview
name: r.Shadow.Virtual.SMRT.SamplesPerRayDirectional
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:
Shadow map samples per ray for directional lights
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.Virtual.SMRT.SamplesPerRayDirectional is to control the number of shadow map samples per ray for directional lights in Unreal Engine 5’s virtual shadow mapping system.
This setting variable is primarily used by the rendering system, specifically the virtual shadow mapping subsystem. It’s part of the SMRT (Shadow Map Ray Tracing) technique used for directional lights.
The value of this variable is set through a console variable (CVar) system. It’s defined with a default value of 8, but can be changed at runtime or through configuration files.
The associated variable CVarSMRTSamplesPerRayDirectional directly interacts with r.Shadow.Virtual.SMRT.SamplesPerRayDirectional. This CVar is used to retrieve the current value of the setting in the C++ code.
Developers should be aware that this variable affects the quality and performance of virtual shadow maps for directional lights. A higher value will result in higher quality shadows but at the cost of increased performance overhead.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project, balancing between shadow quality and performance.
- Testing different values to find the optimal setting for your specific scenes.
- Considering scalability options, as this variable is marked with ECVF_Scalability flag.
Regarding the associated variable CVarSMRTSamplesPerRayDirectional:
The purpose of CVarSMRTSamplesPerRayDirectional is to provide a programmatic interface to access and modify the r.Shadow.Virtual.SMRT.SamplesPerRayDirectional setting within the C++ code of Unreal Engine.
This variable is used in the rendering system, specifically in the VirtualShadowMapProjection module. It’s used to retrieve the current value of the setting when calculating virtual shadow map SMRT settings.
The value of CVarSMRTSamplesPerRayDirectional is set when the r.Shadow.Virtual.SMRT.SamplesPerRayDirectional console variable is modified.
It interacts directly with the r.Shadow.Virtual.SMRT.SamplesPerRayDirectional setting, essentially serving as its in-code representation.
Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which is important for thread safety in rendering code.
Best practices when using this variable include:
- Always access it on the render thread in rendering code.
- Use it in conjunction with other SMRT settings for a cohesive shadow mapping strategy.
- Consider the performance implications when modifying this value, especially in performance-critical sections of code.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:147, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:171, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:198, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:225, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:252, section: [ShadowQuality@Cine]
- INI Section:
ShadowQuality@Cine
- Raw value:
8
- 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:76
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSMRTSamplesPerRayDirectional(
TEXT( "r.Shadow.Virtual.SMRT.SamplesPerRayDirectional" ),
8,
TEXT( "Shadow map samples per ray for directional lights" ),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarSMRTRayLengthScaleDirectional(
#Associated Variable and Callsites
This variable is associated with another variable named CVarSMRTSamplesPerRayDirectional
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:75
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarSMRTSamplesPerRayDirectional(
TEXT( "r.Shadow.Virtual.SMRT.SamplesPerRayDirectional" ),
8,
TEXT( "Shadow map samples per ray for directional lights" ),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:191
Scope (from outer to inner):
file
function FVirtualShadowMapSMRTSettings GetVirtualShadowMapSMRTSettings
Source code excerpt:
{
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
}