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).

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:

  1. Adjusting it carefully to find a balance between preventing shadow artifacts and maintaining accurate shadow contact.
  2. Testing the impact of different values in various lighting scenarios.
  3. Considering performance implications, as ray tracing can be computationally expensive.

Regarding the associated variable CVarLumenDirectLightingHardwareRayTracingShadowRayBias:

#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)