r.Lumen.Reflections.HardwareRayTracing.Retrace.HitLighting
r.Lumen.Reflections.HardwareRayTracing.Retrace.HitLighting
#Overview
name: r.Lumen.Reflections.HardwareRayTracing.Retrace.HitLighting
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Determines whether a second trace will be fired for hit-lighting for invalid surface-cache hits (Default = 0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Reflections.HardwareRayTracing.Retrace.HitLighting is to control whether a second trace will be fired for hit-lighting when invalid surface-cache hits occur in Lumen reflections using hardware ray tracing.
This setting variable is primarily used by the Lumen reflection system, which is part of Unreal Engine’s advanced rendering capabilities. Specifically, it affects the hardware ray tracing component of Lumen reflections.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.
This variable interacts with the associated variable CVarLumenReflectionsHardwareRayTracingRetraceHitLighting, which shares the same value and purpose.
Developers must be aware that enabling this feature (by setting it to a non-zero value) may impact performance, as it introduces additional ray tracing operations. It should be used judiciously, considering the trade-off between visual quality and performance.
Best practices when using this variable include:
- Only enable it when necessary for improving the quality of reflections.
- Test thoroughly to ensure the performance impact is acceptable for your target hardware.
- Consider exposing this setting to end-users as a high-quality graphics option.
Regarding the associated variable CVarLumenReflectionsHardwareRayTracingRetraceHitLighting:
This is the internal C++ variable that directly controls the behavior described above. It’s used in the LumenReflections::UseHitLighting function to determine whether hit lighting should be used.
Developers should note that this variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating that it can be adjusted for different scalability presets and is safe to modify from the render thread.
When working with this variable in C++ code, developers should use CVarLumenReflectionsHardwareRayTracingRetraceHitLighting.GetValueOnRenderThread() to retrieve its current value, ensuring thread-safe access in render code.
#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:34
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLumenReflectionsHardwareRayTracingRetraceHitLighting(
TEXT("r.Lumen.Reflections.HardwareRayTracing.Retrace.HitLighting"),
0,
TEXT("Determines whether a second trace will be fired for hit-lighting for invalid surface-cache hits (Default = 0)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarLumenReflectionsHardwareRayTracingRetraceFarField(
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenReflectionsHardwareRayTracingRetraceHitLighting
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionHardwareRayTracing.cpp:33
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarLumenReflectionsHardwareRayTracingRetraceHitLighting(
TEXT("r.Lumen.Reflections.HardwareRayTracing.Retrace.HitLighting"),
0,
TEXT("Determines whether a second trace will be fired for hit-lighting for invalid surface-cache hits (Default = 0)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionHardwareRayTracing.cpp:77
Scope (from outer to inner):
file
function bool LumenReflections::UseHitLighting
Source code excerpt:
{
return IsHitLightingForceEnabled(View, bLumenGIEnabled)
|| (CVarLumenReflectionsHardwareRayTracingRetraceHitLighting.GetValueOnRenderThread() != 0);
}
#endif
return false;
}