r.Shadow.Virtual.SMRT.SamplesPerRayLocal

r.Shadow.Virtual.SMRT.SamplesPerRayLocal

#Overview

name: r.Shadow.Virtual.SMRT.SamplesPerRayLocal

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.SamplesPerRayLocal is to control the number of shadow map samples per ray for local lights in Unreal Engine 5’s virtual shadow map system. This setting is specifically used in the rendering system, particularly for shadow rendering optimization.

This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the Virtual Shadow Maps subsystem. It’s defined and used in the VirtualShadowMapProjection.cpp file, which is part of the rendering pipeline for virtual shadow maps.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 8, but can be changed at runtime through console commands or project settings.

The associated variable CVarSMRTSamplesPerRayLocal directly interacts with r.Shadow.Virtual.SMRT.SamplesPerRayLocal. They share the same value and purpose.

Developers should be aware that this variable affects the quality and performance of shadow rendering for local lights. Increasing the value will likely improve shadow quality but at the cost of performance, while decreasing it will improve performance but potentially reduce shadow quality.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your project, balancing between shadow quality and performance.
  2. Testing different values to find the optimal balance for your specific scenes and lighting setups.
  3. Considering different values for different quality settings in your game.

Regarding the associated variable CVarSMRTSamplesPerRayLocal:

The purpose of CVarSMRTSamplesPerRayLocal is the same as r.Shadow.Virtual.SMRT.SamplesPerRayLocal - it controls the number of shadow map samples per ray for local lights in the virtual shadow map system.

It’s used in the same Renderer module and Virtual Shadow Maps subsystem as r.Shadow.Virtual.SMRT.SamplesPerRayLocal.

The value is set through the CVar system and can be accessed in C++ code using CVarSMRTSamplesPerRayLocal.GetValueOnRenderThread().

This variable directly interacts with r.Shadow.Virtual.SMRT.SamplesPerRayLocal, as they represent the same setting.

Developers should be aware that changes to this variable will affect shadow rendering performance and quality for local lights.

Best practices include using this variable in rendering code when you need to access the current value of the samples per ray setting, and potentially allowing it to be adjusted dynamically based on performance requirements or quality settings.

#Setting Variables

#References In INI files

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

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

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

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

Location: <Workspace>/Engine/Config/BaseScalability.ini:254, 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:53

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSMRTSamplesPerRayLocal(
	TEXT( "r.Shadow.Virtual.SMRT.SamplesPerRayLocal" ),
	8,
	TEXT( "Shadow map samples per ray for local lights" ),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarSMRTMaxRayAngleFromLight(

#Associated Variable and Callsites

This variable is associated with another variable named CVarSMRTSamplesPerRayLocal. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:52

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarSMRTSamplesPerRayLocal(
	TEXT( "r.Shadow.Virtual.SMRT.SamplesPerRayLocal" ),
	8,
	TEXT( "Shadow map samples per ray for local lights" ),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapProjection.cpp:201

Scope (from outer to inner):

file
function     FVirtualShadowMapSMRTSettings GetVirtualShadowMapSMRTSettings

Source code excerpt:

	{
		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();
	}