r.ManyLights.HardwareRayTracing.Bias
r.ManyLights.HardwareRayTracing.Bias
#Overview
name: r.ManyLights.HardwareRayTracing.Bias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Constant bias for hardware ray traced shadow rays.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ManyLights.HardwareRayTracing.Bias is to provide a constant bias for hardware ray traced shadow rays in Unreal Engine 5’s rendering system. This setting variable is used to fine-tune the accuracy and performance of ray-traced shadows in the Many Lights rendering technique.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically in the Many Lights ray tracing subsystem. Based on the callsites, it’s clear that this variable is utilized in the hardware ray tracing pass for the Many Lights rendering technique.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 1.0f. Developers can modify this value at runtime or through configuration files.
The associated variable CVarManyLightsHardwareRayTracingBias interacts directly with r.ManyLights.HardwareRayTracing.Bias. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the accuracy and performance of ray-traced shadows. A higher bias value can help reduce shadow acne (self-shadowing artifacts) but may also cause some shadow detachment. Conversely, a lower value may increase the accuracy of shadows but could introduce more artifacts.
Best practices when using this variable include:
- Fine-tuning the value based on the specific needs of your scene and the desired balance between performance and visual quality.
- Testing different values in various lighting scenarios to ensure consistent results across your game.
- Considering the impact on performance, especially in scenes with many lights or complex geometry.
- Using it in conjunction with r.ManyLights.HardwareRayTracing.NormalBias for optimal shadow quality.
Regarding the associated variable CVarManyLightsHardwareRayTracingBias:
- Its purpose is the same as r.ManyLights.HardwareRayTracing.Bias, providing a constant bias for hardware ray traced shadow rays.
- It’s used in the same Renderer module and Many Lights ray tracing subsystem.
- The value is set through the console variable system, with the same default value of 1.0f.
- It interacts directly with r.ManyLights.HardwareRayTracing.Bias, sharing the same value.
- Developers should be aware that modifying one will affect the other, as they are essentially the same variable.
- Best practices for using this variable are the same as those for r.ManyLights.HardwareRayTracing.Bias.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLightsRayTracing.cpp:56
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarManyLightsHardwareRayTracingBias(
TEXT("r.ManyLights.HardwareRayTracing.Bias"),
1.0f,
TEXT("Constant bias for hardware ray traced shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarManyLightsHardwareRayTracingNormalBias(
#Associated Variable and Callsites
This variable is associated with another variable named CVarManyLightsHardwareRayTracingBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLightsRayTracing.cpp:55
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarManyLightsHardwareRayTracingBias(
TEXT("r.ManyLights.HardwareRayTracing.Bias"),
1.0f,
TEXT("Constant bias for hardware ray traced shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLightsRayTracing.cpp:414
Scope (from outer to inner):
file
function void ManyLights::SetHardwareRayTracingPassParameters
Source code excerpt:
PassParameters->RWLightSamples = GraphBuilder.CreateUAV(LightSamples);
PassParameters->LightSampleRayDistance = LightSampleRayDistance;
PassParameters->RayTracingBias = CVarManyLightsHardwareRayTracingBias.GetValueOnRenderThread();
PassParameters->RayTracingNormalBias = CVarManyLightsHardwareRayTracingNormalBias.GetValueOnRenderThread();
checkf(View.HasRayTracingScene(), TEXT("TLAS does not exist. Verify that the current pass is represented in Lumen::AnyLumenHardwareRayTracingPassEnabled()."));
PassParameters->TLAS = View.GetRayTracingSceneLayerViewChecked(ERayTracingSceneLayer::Base);
PassParameters->MaxTraversalIterations = FMath::Max(CVarManyLightsHardwareRayTracingMaxIterations.GetValueOnRenderThread(), 1);