r.RayTracing.Shadows.LODTransitionEnd

r.RayTracing.Shadows.LODTransitionEnd

#Overview

name: r.RayTracing.Shadows.LODTransitionEnd

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.LODTransitionEnd is to define the end distance of the Level of Detail (LOD) transition range for ray-traced shadows in Unreal Engine 5. This setting is part of the ray tracing system, specifically for shadow rendering.

This setting variable is primarily used in the Renderer module, particularly in the ray tracing subsystem for shadows. It’s referenced in the RayTracingShadows.cpp file, which is part of the ray-traced shadow implementation.

The value of this variable is set through the console variable system (CVarRayTracingShadowsLODTransitionEnd). It’s initialized with a default value of 5000.0 (representing 50 meters in-game), but can be changed at runtime through console commands or project settings.

This variable interacts closely with CVarRayTracingShadowsLODTransitionStart, which likely defines the start of the LOD transition range. Together, these variables create a range where LOD transitions occur for ray-traced shadows.

Developers should be aware that this variable affects the visual quality and performance of ray-traced shadows. A larger value will extend the high-quality shadow rendering further from the camera, potentially impacting performance.

Best practices when using this variable include:

  1. Balancing it with CVarRayTracingShadowsLODTransitionStart for smooth LOD transitions.
  2. Adjusting it based on the scale and requirements of your specific game environment.
  3. Testing different values to find the optimal balance between visual quality and performance.

Regarding the associated variable CVarRayTracingShadowsLODTransitionEnd:

This is the actual console variable that stores and provides access to the r.RayTracing.Shadows.LODTransitionEnd value. It’s defined as a TAutoConsoleVariable, which means it’s an integer value that can be changed at runtime.

The purpose of CVarRayTracingShadowsLODTransitionEnd is to provide a programmatic interface to access and modify the LOD transition end distance for ray-traced shadows.

This variable is used in the Renderer module, specifically in the ray tracing shadow pass. It’s accessed using the GetValueOnRenderThread() method, ensuring thread-safe access to its value during rendering.

The value of this variable is set when it’s defined, but can be modified through console commands or engine code at runtime.

Developers should be aware that changes to this variable will take effect on the render thread, potentially causing visual changes in real-time.

Best practices for using this variable include:

  1. Accessing it using GetValueOnRenderThread() when used in render thread code.
  2. Considering performance implications when modifying its value, especially in shipping builds.
  3. Using it in conjunction with other ray tracing shadow settings for comprehensive control over shadow quality and performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:96

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingShadowsLODTransitionEnd(
	TEXT("r.RayTracing.Shadows.LODTransitionEnd"),
	5000.0f, // 50 m
	TEXT("The end of an LOD transition range (default = 5000)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarRayTracingShadowsAcceptFirstHit(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:95

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarRayTracingShadowsLODTransitionEnd(
	TEXT("r.RayTracing.Shadows.LODTransitionEnd"),
	5000.0f, // 50 m
	TEXT("The end of an LOD transition range (default = 5000)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:413

Scope: file

Source code excerpt:

		CommonPassParameters->TraceDistance = LightSceneProxy->GetTraceDistance();
		CommonPassParameters->LODTransitionStart = CVarRayTracingShadowsLODTransitionStart.GetValueOnRenderThread();
		CommonPassParameters->LODTransitionEnd = CVarRayTracingShadowsLODTransitionEnd.GetValueOnRenderThread();
		CommonPassParameters->AvoidSelfIntersectionTraceDistance = GRayTracingShadowsAvoidSelfIntersectionTraceDistance;
		CommonPassParameters->bAcceptFirstHit = CVarRayTracingShadowsAcceptFirstHit.GetValueOnRenderThread();
		CommonPassParameters->bTwoSidedGeometry = EnableRayTracingShadowTwoSidedGeometry() ? 1 : 0;
		CommonPassParameters->TranslucentShadow = CVarRayTracingShadowsTranslucency.GetValueOnRenderThread();
		CommonPassParameters->MaxTranslucencyHitCount = GetRayTracingShadowsMaxTranslucencyHitCount();
		CommonPassParameters->TLAS = View.GetRayTracingSceneLayerViewChecked(ERayTracingSceneLayer::Base);