r.Lumen.Reflections.HardwareRayTracing.Retrace.FarField

r.Lumen.Reflections.HardwareRayTracing.Retrace.FarField

#Overview

name: r.Lumen.Reflections.HardwareRayTracing.Retrace.FarField

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.Lumen.Reflections.HardwareRayTracing.Retrace.FarField is to control whether a second trace is fired for far-field contribution in Lumen’s hardware ray-traced reflections system. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically focusing on the reflection component.

The Lumen reflection system within the Renderer module relies on this setting variable. It is used in the hardware ray tracing implementation of Lumen reflections.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning the second trace for far-field contribution is enabled by default.

This variable interacts with another variable named CVarLumenReflectionsHardwareRayTracingRetraceFarField. They share the same value and are essentially two ways to access the same setting.

Developers must be aware that this variable only has an effect when hardware ray tracing is enabled (RHI_RAYTRACING is defined). It’s also marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating that it can be used for scalability settings and is safe to modify from the render thread.

Best practices when using this variable include:

  1. Consider performance implications when enabling or disabling far-field retracing.
  2. Test the visual impact of this setting in various environments to ensure it provides the desired balance between quality and performance.
  3. Use this in conjunction with other Lumen settings to achieve optimal results.

Regarding the associated variable CVarLumenReflectionsHardwareRayTracingRetraceFarField:

This is the actual console variable that stores the setting. It’s used in the LumenReflections::UseFarField function to determine whether far-field retracing should be used. The function checks both if far-field is generally enabled for the view family and if this specific setting is enabled.

Developers should be aware that modifying this variable at runtime will immediately affect the behavior of the Lumen reflection system. It’s important to profile and test thoroughly when adjusting this setting to ensure it doesn’t negatively impact performance or visual quality in your specific use case.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionHardwareRayTracing.cpp:41

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenReflectionsHardwareRayTracingRetraceFarField(
	TEXT("r.Lumen.Reflections.HardwareRayTracing.Retrace.FarField"),
	1,
	TEXT("Determines whether a second trace will be fired for far-field contribution (Default = 1)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);
#endif // RHI_RAYTRACING

#Associated Variable and Callsites

This variable is associated with another variable named CVarLumenReflectionsHardwareRayTracingRetraceFarField. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionHardwareRayTracing.cpp:40

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenReflectionsHardwareRayTracingRetraceFarField(
	TEXT("r.Lumen.Reflections.HardwareRayTracing.Retrace.FarField"),
	1,
	TEXT("Determines whether a second trace will be fired for far-field contribution (Default = 1)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);
#endif // RHI_RAYTRACING

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionHardwareRayTracing.cpp:102

Scope (from outer to inner):

file
function     bool LumenReflections::UseFarField

Source code excerpt:

{
#if RHI_RAYTRACING
	return Lumen::UseFarField(ViewFamily) && CVarLumenReflectionsHardwareRayTracingRetraceFarField.GetValueOnRenderThread();
#else
	return false;
#endif
}

namespace LumenReflections