r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias
r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias
#Overview
name: r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Bias for tracing global SDF shadow rays.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias is to provide a bias value for tracing global SDF (Signed Distance Field) shadow rays in the Lumen lighting system of Unreal Engine 5. This setting is specifically related to the rendering system, particularly the Lumen global illumination solution.
This setting variable is primarily used by the Lumen Scene Direct Lighting subsystem within the Renderer module of Unreal Engine 5. It’s part of the Lumen global illumination system, which is responsible for real-time dynamic global illumination.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1.0f, but can be changed at runtime or through configuration files.
The associated variable CVarLumenDirectLightingGlobalSDFShadowRayBias interacts directly with this setting. It’s the actual console variable object that stores and provides access to the value set by r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias.
Developers must be aware that this variable affects the accuracy and performance of shadow rendering in the Lumen system. A higher bias value can help reduce shadow acne (self-shadowing artifacts) but may also cause some shadow detachment.
Best practices when using this variable include:
- Fine-tuning the value based on the specific needs of the scene, as different scenes may require different bias values for optimal results.
- Testing the impact of changes across various lighting scenarios to ensure consistent quality.
- Considering performance implications, as adjusting this value may affect rendering performance.
Regarding the associated variable CVarLumenDirectLightingGlobalSDFShadowRayBias:
- Its purpose is to provide programmatic access to the shadow ray bias value within the engine’s C++ code.
- It’s used directly in the LumenSceneDirectLighting class to retrieve the current bias value.
- The value is accessed on the render thread, indicating its use in real-time rendering calculations.
- Developers should note that the GetGlobalSDFShadowRayBias() function enforces a minimum value of 0.0f, preventing negative bias values which could cause rendering artifacts.
When working with this variable, developers should coordinate any changes with the broader Lumen configuration to ensure optimal lighting results and performance.
#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:66
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarLumenDirectLightingGlobalSDFShadowRayBias(
TEXT("r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias"),
1.0f,
TEXT("Bias for tracing global SDF shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarLumenDirectLightingHardwareRayTracingShadowRayBias(
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenDirectLightingGlobalSDFShadowRayBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:65
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarLumenDirectLightingGlobalSDFShadowRayBias(
TEXT("r.LumenScene.DirectLighting.GlobalSDF.ShadowRayBias"),
1.0f,
TEXT("Bias for tracing global SDF shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:97
Scope (from outer to inner):
file
function float LumenSceneDirectLighting::GetGlobalSDFShadowRayBias
Source code excerpt:
float LumenSceneDirectLighting::GetGlobalSDFShadowRayBias()
{
return FMath::Max(CVarLumenDirectLightingGlobalSDFShadowRayBias.GetValueOnRenderThread(), 0.0f);
}
float LumenSceneDirectLighting::GetHardwareRayTracingShadowRayBias()
{
return FMath::Max(CVarLumenDirectLightingHardwareRayTracingShadowRayBias.GetValueOnRenderThread(), 0.0f);
}