r.ManyLights.HardwareRayTracing.NormalBias
r.ManyLights.HardwareRayTracing.NormalBias
#Overview
name: r.ManyLights.HardwareRayTracing.NormalBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Normal 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.NormalBias is to set the normal bias for hardware ray-traced shadow rays in the many lights rendering system of Unreal Engine 5. This setting is specifically used in the context of hardware ray tracing for shadows.
This setting variable is primarily used in the Renderer module, specifically within the ManyLights subsystem. It’s part of the ray tracing functionality for handling shadows in scenes with numerous light sources.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined with a default value of 0.1f, but can be adjusted at runtime or through configuration files.
The variable interacts directly with its associated C++ variable CVarManyLightsHardwareRayTracingNormalBias. This associated variable is used to retrieve the current value of the setting in the render thread.
Developers should be aware that this variable affects the precision and visual quality of shadows in ray-traced scenes. Adjusting this value can help mitigate shadow acne or other artifacts that may occur in ray-traced shadows.
Best practices when using this variable include:
- Keeping the value as low as possible while still achieving desired shadow quality to maintain performance.
- Testing different values in various lighting scenarios to find the optimal balance between visual quality and performance.
- Being mindful of how changes to this value interact with other ray tracing settings.
Regarding the associated variable CVarManyLightsHardwareRayTracingNormalBias:
The purpose of CVarManyLightsHardwareRayTracingNormalBias is to provide a C++ interface for accessing and modifying the r.ManyLights.HardwareRayTracing.NormalBias setting within the engine’s code.
This variable is used within the Renderer module, specifically in the ManyLights ray tracing implementation.
The value of this variable is set when the r.ManyLights.HardwareRayTracing.NormalBias console variable is defined, and it’s accessed using the GetValueOnRenderThread() method.
It interacts directly with the r.ManyLights.HardwareRayTracing.NormalBias console variable, essentially serving as its C++ representation.
Developers should be aware that this variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating it’s safe to modify on the render thread and can be adjusted for different scalability settings.
Best practices for using this variable include:
- Accessing its value using GetValueOnRenderThread() when used in render thread operations.
- Considering its impact on performance and visual quality when modifying its value.
- Using it in conjunction with other ray tracing parameters for optimal results.
#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:63
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarManyLightsHardwareRayTracingNormalBias(
TEXT("r.ManyLights.HardwareRayTracing.NormalBias"),
0.1f,
TEXT("Normal bias for hardware ray traced shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarManyLightsHardwareRayTracingMaxIterations(
#Associated Variable and Callsites
This variable is associated with another variable named CVarManyLightsHardwareRayTracingNormalBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLightsRayTracing.cpp:62
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarManyLightsHardwareRayTracingNormalBias(
TEXT("r.ManyLights.HardwareRayTracing.NormalBias"),
0.1f,
TEXT("Normal bias for hardware ray traced shadow rays."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLightsRayTracing.cpp:415
Scope (from outer to inner):
file
function void ManyLights::SetHardwareRayTracingPassParameters
Source code excerpt:
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);
// Inline