r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias
r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias
#Overview
name: r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Bias for hardware ray tracing shadow rays.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias is to control the bias for hardware ray tracing shadow rays in the Lumen Scene Direct Lighting system. This setting is part of Unreal Engine 5’s rendering system, specifically the Lumen global illumination feature.
This setting variable is primarily used by the Lumen Scene Direct Lighting subsystem within the Renderer module of Unreal Engine 5. It’s specifically related to the hardware ray tracing functionality for shadow calculations.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined with a default value of 1.0f, but can be adjusted at runtime or through configuration files.
The associated variable CVarLumenDirectLightingHardwareRayTracingShadowRayBias directly interacts with this setting. It’s used to access the value of the setting within the C++ code.
Developers should be aware that this variable affects the precision and quality of shadow rendering when using hardware ray tracing in Lumen. A higher bias value can help prevent shadow acne (self-shadowing artifacts) but may also cause some shadow detachment.
Best practices when using this variable include:
- Adjusting it carefully to find a balance between preventing shadow artifacts and maintaining accurate shadow contact.
- Testing the impact of different values in various lighting scenarios.
- Considering performance implications, as ray tracing can be computationally expensive.
Regarding the associated variable CVarLumenDirectLightingHardwareRayTracingShadowRayBias:
- Its purpose is to provide a programmatic interface to access the shadow ray bias setting within the C++ code.
- It’s used directly in the LumenSceneDirectLighting subsystem.
- Its value is set by the console variable system, mirroring the r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias setting.
- It’s accessed in the GetHardwareRayTracingShadowRayBias() function, which ensures the value is never negative.
- Developers should be aware that changes to this variable will directly affect the shadow rendering in hardware ray traced scenes.
- Best practice is to access this variable through the provided getter function rather than directly, to ensure proper thread safety and value clamping.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:73
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarLumenDirectLightingHardwareRayTracingShadowRayBias(
TEXT("r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias"),
1.0f,
TEXT("Bias for hardware ray tracing shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarLumenDirectLightingBatchShadows(
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenDirectLightingHardwareRayTracingShadowRayBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:72
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarLumenDirectLightingHardwareRayTracingShadowRayBias(
TEXT("r.LumenScene.DirectLighting.HardwareRayTracing.ShadowRayBias"),
1.0f,
TEXT("Bias for hardware ray tracing shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:102
Scope (from outer to inner):
file
function float LumenSceneDirectLighting::GetHardwareRayTracingShadowRayBias
Source code excerpt:
float LumenSceneDirectLighting::GetHardwareRayTracingShadowRayBias()
{
return FMath::Max(CVarLumenDirectLightingHardwareRayTracingShadowRayBias.GetValueOnRenderThread(), 0.0f);
}
class FLumenGatheredLight
{
public:
FLumenGatheredLight(const FScene* Scene, TConstArrayView<FViewInfo> Views, const FLightSceneInfo* InLightSceneInfo, uint32 InLightIndex, bool bUseHardwareRayTracing)