r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField
r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField
#Overview
name: r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Determines whether a second trace will be fired for far-field contribution (Default = 1)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField is to control whether a second ray trace is performed for far-field contributions in Lumen’s radiance cache when using hardware ray tracing.
This setting variable is primarily used in the Lumen rendering system, specifically in the hardware ray tracing component of the radiance cache. It’s part of Unreal Engine 5’s global illumination solution.
The value of this variable is set through the console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime.
The associated variable CVarLumenRadianceCacheHardwareRayTracingRetraceFarField directly interacts with it. This is the actual console variable object that stores and provides access to the setting’s value.
Developers should be aware that:
- This setting only takes effect when hardware ray tracing is enabled.
- Enabling this feature (value = 1) may increase rendering quality but at the cost of performance, as it involves an additional ray trace.
- The setting is render thread safe, meaning it can be changed dynamically without causing thread safety issues.
Best practices when using this variable include:
- Consider the performance implications when enabling this feature, especially on less powerful hardware.
- Use it in conjunction with other Lumen settings to fine-tune the balance between visual quality and performance.
- Test the impact of enabling/disabling this feature in various scenes to understand its effect on your specific project.
Regarding the associated variable CVarLumenRadianceCacheHardwareRayTracingRetraceFarField:
- Its purpose is to provide a programmatic interface to the r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField setting.
- It’s used within the Lumen subsystem to determine whether to perform the additional far-field ray trace.
- The value is typically accessed using the GetValueOnRenderThread() method, ensuring thread-safe access.
- It’s used in conjunction with the UseFarField function to determine if far-field tracing should be used for the radiance cache.
- Developers should be aware that changes to this variable will immediately affect the rendering pipeline, so it should be used cautiously in performance-critical scenarios.
- Best practice is to use this variable for runtime toggling of the feature, such as in response to user settings or dynamic performance scaling.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:34
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLumenRadianceCacheHardwareRayTracingRetraceFarField(
TEXT("r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField"),
1,
TEXT("Determines whether a second trace will be fired for far-field contribution (Default = 1)"),
ECVF_RenderThreadSafe
);
#endif // RHI_RAYTRACING
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenRadianceCacheHardwareRayTracingRetraceFarField
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:33
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarLumenRadianceCacheHardwareRayTracingRetraceFarField(
TEXT("r.Lumen.RadianceCache.HardwareRayTracing.Retrace.FarField"),
1,
TEXT("Determines whether a second trace will be fired for far-field contribution (Default = 1)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:247
Scope (from outer to inner):
file
function bool UseFarFieldForRadianceCache
Source code excerpt:
bool UseFarFieldForRadianceCache(const FSceneViewFamily& ViewFamily)
{
return Lumen::UseFarField(ViewFamily) && CVarLumenRadianceCacheHardwareRayTracingRetraceFarField.GetValueOnRenderThread();
}
void FDeferredShadingSceneRenderer::PrepareLumenHardwareRayTracingRadianceCache(const FViewInfo& View, TArray<FRHIRayTracingShader*>& OutRayGenShaders)
{
}