r.RayTracing.Shadows.Lights.Directional
r.RayTracing.Shadows.Lights.Directional
#Overview
name: r.RayTracing.Shadows.Lights.Directional
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables ray tracing shadows for directional lights (default = 1)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Shadows.Lights.Directional is to enable or disable ray-traced shadows for directional lights in Unreal Engine 5’s rendering system.
This setting variable is primarily used by the rendering system, specifically in the ray tracing subsystem for shadow calculations. Based on the callsites, it’s part of the Renderer module in Unreal Engine 5.
The value of this variable is set as a console variable with a default value of 1 (enabled). It can be changed at runtime through the console or configuration files.
The associated variable CVarRayTracingShadowsDirectionalLight directly interacts with r.RayTracing.Shadows.Lights.Directional. They share the same value and purpose.
Developers must be aware that this variable affects the performance and visual quality of directional light shadows in ray-traced environments. Enabling this feature may have performance implications, especially on less powerful hardware.
Best practices when using this variable include:
- Consider the target hardware when deciding to enable or disable this feature.
- Use it in conjunction with other ray tracing settings for a consistent visual experience.
- Profile the performance impact in various scenarios to ensure it meets the project’s requirements.
Regarding the associated variable CVarRayTracingShadowsDirectionalLight:
This is an internal representation of the r.RayTracing.Shadows.Lights.Directional console variable. It’s used within the C++ code to query the current state of the setting.
The purpose of CVarRayTracingShadowsDirectionalLight is to provide a programmatic way to access the ray-traced directional light shadows setting within the rendering code.
This variable is used in the Renderer module, specifically in the LightRendering.cpp file. It’s queried in the ShouldRenderRayTracingShadowsForLightType function to determine if ray-traced shadows should be rendered for directional lights.
The value of this variable is set when the console variable is initialized and can be accessed using the GetValueOnRenderThread() method.
Developers should be aware that this variable is meant for internal use within the engine’s rendering code. It’s not typically manipulated directly by game code.
Best practices for using CVarRayTracingShadowsDirectionalLight include:
- Use it for conditional logic in rendering code that depends on the ray-traced directional shadows setting.
- Access its value using the GetValueOnRenderThread() method to ensure thread-safety in render thread operations.
- Avoid direct manipulation of this variable; instead, modify the r.RayTracing.Shadows.Lights.Directional console variable when needed.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:110
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRayTracingShadowsDirectionalLight(
TEXT("r.RayTracing.Shadows.Lights.Directional"),
1,
TEXT("Enables ray tracing shadows for directional lights (default = 1)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsPointLight(
TEXT("r.RayTracing.Shadows.Lights.Point"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingShadowsDirectionalLight
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:109
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsDirectionalLight(
TEXT("r.RayTracing.Shadows.Lights.Directional"),
1,
TEXT("Enables ray tracing shadows for directional lights (default = 1)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsPointLight(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightRendering.cpp:198
Scope (from outer to inner):
file
function static bool ShouldRenderRayTracingShadowsForLightType
Source code excerpt:
{
case LightType_Directional:
return !!CVarRayTracingShadowsDirectionalLight.GetValueOnRenderThread();
case LightType_Point:
return !!CVarRayTracingShadowsPointLight.GetValueOnRenderThread();
case LightType_Spot:
return !!CVarRayTracingShadowsSpotLight.GetValueOnRenderThread();
case LightType_Rect:
return !!CVarRayTracingShadowsRectLight.GetValueOnRenderThread();