r.Shadow.Virtual.SMRT.RayCountLocal
r.Shadow.Virtual.SMRT.RayCountLocal
#Overview
name: r.Shadow.Virtual.SMRT.RayCountLocal
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 local 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.RayCountLocal is to control the number of rays used for shadow map tracing of local lights in the Virtual Shadow Map system of Unreal Engine 5’s rendering pipeline.
This setting variable is primarily used by the rendering system, specifically the Virtual Shadow Map module. It’s part of the Shadow Map Ray Tracing (SMRT) feature for local lights.
Based on the callsites, this variable is utilized in the Renderer module, particularly in the VirtualShadowMaps subsystem. The file VirtualShadowMapProjection.cpp contains the implementation that uses this setting.
The value of this variable is set through a console variable (CVarSMRTRayCountLocal) with a default value of 7. It can be modified at runtime through console commands or project settings.
This variable interacts with other SMRT-related variables, such as CVarSMRTSamplesPerRayLocal, as seen in the GetVirtualShadowMapSMRTSettings function.
Developers should be aware that:
- Setting this value to 0 disables the feature.
- Higher values may improve shadow quality but at the cost of performance.
- This setting is specific to local lights and doesn’t affect other light types.
Best practices when using this variable include:
- Balancing between shadow quality and performance based on the target hardware.
- Testing different values to find the optimal setting for your specific scene and lighting setup.
- Considering scalability options, as this variable has the ECVF_Scalability flag.
Regarding the associated variable CVarSMRTRayCountLocal:
The purpose of CVarSMRTRayCountLocal is to provide a console-variable interface for the r.Shadow.Virtual.SMRT.RayCountLocal setting. It allows for runtime modification and access to the ray count value.
This variable is used in the same Renderer module and VirtualShadowMaps subsystem. Its value is set when the engine initializes the console variables, and it can be modified through console commands.
CVarSMRTRayCountLocal interacts directly with the r.Shadow.Virtual.SMRT.RayCountLocal setting, effectively controlling its value.
Developers should be aware that:
- Changes to this variable will immediately affect the shadow rendering for local lights.
- It’s thread-safe (ECVF_RenderThreadSafe flag) and can be safely modified from different threads.
Best practices for using CVarSMRTRayCountLocal include:
- Using it for debugging or performance tuning during development.
- Considering exposing it as a user-configurable setting for advanced graphics options.
- Monitoring its impact on performance when modifying its value, especially on lower-end hardware.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:148, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:172, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:199, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
8
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:226, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
8
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:253, 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:46
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSMRTRayCountLocal(
TEXT( "r.Shadow.Virtual.SMRT.RayCountLocal" ),
7,
TEXT( "Ray count for shadow map tracing of local lights. 0 = disabled." ),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarSMRTSamplesPerRayLocal(
#Associated Variable and Callsites
This variable is associated with another variable named CVarSMRTRayCountLocal
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:45
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarSMRTRayCountLocal(
TEXT( "r.Shadow.Virtual.SMRT.RayCountLocal" ),
7,
TEXT( "Ray count for shadow map tracing of local lights. 0 = disabled." ),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:200
Scope (from outer to inner):
file
function FVirtualShadowMapSMRTSettings GetVirtualShadowMapSMRTSettings
Source code excerpt:
else
{
Out.SMRTRayCount = CVarSMRTRayCountLocal.GetValueOnRenderThread();
Out.SMRTSamplesPerRay = CVarSMRTSamplesPerRayLocal.GetValueOnRenderThread();
Out.SMRTRayLengthScale = 0.0f; // unused in this path
Out.SMRTCotMaxRayAngleFromLight = 1.0f / FMath::Tan(CVarSMRTMaxRayAngleFromLight.GetValueOnRenderThread());
Out.SMRTTexelDitherScale = CVarSMRTTexelDitherScaleLocal.GetValueOnRenderThread();
Out.SMRTExtrapolateSlope = CVarSMRTExtrapolateMaxSlopeLocal.GetValueOnRenderThread();
Out.SMRTMaxSlopeBias = CVarSMRTMaxSlopeBiasLocal.GetValueOnRenderThread();