r.RayTracing.Shadows.Lights.Spot

r.RayTracing.Shadows.Lights.Spot

#Overview

name: r.RayTracing.Shadows.Lights.Spot

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.RayTracing.Shadows.Lights.Spot is to control the enablement of ray tracing shadows for spot lights in Unreal Engine’s rendering system. This setting variable is part of the ray tracing feature set, specifically targeting shadow rendering for spot lights.

This setting variable is primarily used by the Renderer module of Unreal Engine, as evidenced by its location in the LightRendering.cpp file within the Runtime/Renderer/Private directory.

The value of this variable is set using a TAutoConsoleVariable, which means it can be modified at runtime through console commands. Its default value is 1, indicating that ray tracing shadows for spot lights are enabled by default.

The associated variable CVarRayTracingShadowsSpotLight directly interacts with r.RayTracing.Shadows.Lights.Spot. They share the same value and purpose.

Developers must be aware that this variable affects the rendering performance and visual quality of spot light shadows. Enabling ray tracing shadows can provide more accurate and realistic shadows but may come at a performance cost.

Best practices when using this variable include:

  1. Consider the performance impact of enabling ray tracing shadows for spot lights, especially in performance-critical scenarios.
  2. Use this setting in conjunction with other ray tracing settings for a cohesive visual style.
  3. Test the visual and performance differences with this setting enabled and disabled to make informed decisions about its usage in your project.

Regarding the associated variable CVarRayTracingShadowsSpotLight:

The purpose of CVarRayTracingShadowsSpotLight is to provide programmatic access to the r.RayTracing.Shadows.Lights.Spot setting within the C++ code of the engine.

This variable is used in the Renderer module, specifically in the LightRendering.cpp file. It’s utilized in the ShouldRenderRayTracingShadowsForLightType function to determine whether ray tracing shadows should be rendered for spot lights.

The value of CVarRayTracingShadowsSpotLight is set when the TAutoConsoleVariable is initialized, but it can be changed at runtime through console commands that modify r.RayTracing.Shadows.Lights.Spot.

CVarRayTracingShadowsSpotLight interacts directly with the r.RayTracing.Shadows.Lights.Spot console variable, serving as its C++ representation within the engine code.

Developers should be aware that this variable is used in conditional statements to determine the rendering behavior for spot light shadows. Changes to this variable will affect the rendering pipeline for spot lights.

Best practices for using CVarRayTracingShadowsSpotLight include:

  1. Use GetValueOnRenderThread() when accessing its value to ensure thread-safe operations.
  2. Consider the implications of changing this value at runtime, as it may affect ongoing rendering operations.
  3. Use this variable in conjunction with other ray tracing and shadow-related variables for comprehensive control over the rendering pipeline.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:122

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingShadowsSpotLight(
	TEXT("r.RayTracing.Shadows.Lights.Spot"),
	1,
	TEXT("Enables ray tracing shadows for spot lights (default = 1)"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingShadowsRectLight(
	TEXT("r.RayTracing.Shadows.Lights.Rect"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:121

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingShadowsSpotLight(
	TEXT("r.RayTracing.Shadows.Lights.Spot"),
	1,
	TEXT("Enables ray tracing shadows for spot lights (default = 1)"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRayTracingShadowsRectLight(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:202

Scope (from outer to inner):

file
function     static bool ShouldRenderRayTracingShadowsForLightType

Source code excerpt:

		return !!CVarRayTracingShadowsPointLight.GetValueOnRenderThread();
	case LightType_Spot:
		return !!CVarRayTracingShadowsSpotLight.GetValueOnRenderThread();
	case LightType_Rect:
		return !!CVarRayTracingShadowsRectLight.GetValueOnRenderThread();
	default:
		return true;	
	}	
}