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).

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:

  1. Setting this value to 0 disables the feature.
  2. Higher values will increase shadow quality but also increase rendering cost.
  3. This setting is marked with ECVF_Scalability, indicating it affects performance and can be adjusted for different quality presets.
  4. It’s also marked as ECVF_RenderThreadSafe, meaning it can be safely changed on the render thread.

Best practices when using this variable include:

  1. Balancing between shadow quality and performance based on target hardware.
  2. Using it in conjunction with other shadow-related settings for optimal results.
  3. Consider exposing it in scalability settings to allow users to adjust based on their hardware capabilities.

Regarding the associated variable CVarSMRTRayCountDirectional:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:146, section: [ShadowQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:170, section: [ShadowQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:197, section: [ShadowQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:224, section: [ShadowQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:251, section: [ShadowQuality@Cine]

#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