r.RayTracing.Shadows.LODTransitionStart
r.RayTracing.Shadows.LODTransitionStart
#Overview
name: r.RayTracing.Shadows.LODTransitionStart
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The start of an LOD transition range (default = 4000)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Shadows.LODTransitionStart is to define the starting 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 optimization.
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 as a console variable with a default value of 4000.0 (which represents 40 meters in the game world). It can be modified at runtime through the console or configuration files.
This variable interacts closely with another variable called CVarRayTracingShadowsLODTransitionEnd, which defines the end of the LOD transition range. Together, these two variables create a range where LOD transitions occur for ray-traced shadows.
Developers should be aware that this variable affects the performance and quality trade-off in ray-traced shadow rendering. A lower value will start the LOD transition closer to the camera, potentially improving performance but reducing shadow quality at closer distances. A higher value will maintain higher quality shadows for a greater distance but may impact performance.
Best practices when using this variable include:
- Adjusting it in conjunction with CVarRayTracingShadowsLODTransitionEnd to find the optimal balance between performance and visual quality.
- Testing different values in various scenes to ensure it works well across different environment scales.
- Considering the typical viewing distances in your game when setting this value.
Regarding the associated variable CVarRayTracingShadowsLODTransitionStart:
This is the actual console variable object that controls the r.RayTracing.Shadows.LODTransitionStart setting. It’s defined as a TAutoConsoleVariable
The purpose of CVarRayTracingShadowsLODTransitionStart is to provide a programmatic interface to get and set the LOD transition start distance for ray-traced shadows.
This variable is used within the ray tracing shadow system to retrieve the current value of the setting. For example, it’s accessed in the render thread to set up common pass parameters for ray-traced shadow rendering.
Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag used in its definition.
Best practices for using CVarRayTracingShadowsLODTransitionStart include:
- Accessing its value using GetValueOnRenderThread() when in render thread code.
- Considering thread safety when modifying or reading this value, especially in multi-threaded rendering scenarios.
- Using this variable in conjunction with other ray tracing shadow settings for comprehensive control over the shadow rendering system.
#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:89
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRayTracingShadowsLODTransitionStart(
TEXT("r.RayTracing.Shadows.LODTransitionStart"),
4000.0, // 40 m
TEXT("The start of an LOD transition range (default = 4000)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsLODTransitionEnd(
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingShadowsLODTransitionStart
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:88
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarRayTracingShadowsLODTransitionStart(
TEXT("r.RayTracing.Shadows.LODTransitionStart"),
4000.0, // 40 m
TEXT("The start of an LOD transition range (default = 4000)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RayTracing/RayTracingShadows.cpp:412
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();