r.LumenScene.Radiosity.DistanceFieldSurfaceBias
r.LumenScene.Radiosity.DistanceFieldSurfaceBias
#Overview
name: r.LumenScene.Radiosity.DistanceFieldSurfaceBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.Radiosity.DistanceFieldSurfaceBias is to control the surface bias for distance field tracing in Lumen’s radiosity calculations. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically within the radiosity component.
This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is utilized in the LumenRadiosity.cpp file, which handles radiosity calculations for the Lumen global illumination system.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 10.0f and can be modified at runtime using the console command system.
The associated variable GLumenRadiosityDistanceFieldSurfaceBias directly interacts with r.LumenScene.Radiosity.DistanceFieldSurfaceBias. They share the same value, with the console variable acting as an interface to modify the global variable used in the code.
Developers should be aware that this variable affects the accuracy and performance of distance field tracing in Lumen’s radiosity calculations. A higher value may help prevent self-intersection artifacts but could potentially lead to light leaking or loss of detail in tight spaces.
Best practices when using this variable include:
- Adjusting it in small increments to find the optimal balance between artifact reduction and visual accuracy.
- Testing the changes in various lighting scenarios to ensure consistent results.
- Considering performance implications, as higher values might affect tracing efficiency.
Regarding the associated variable GLumenRadiosityDistanceFieldSurfaceBias:
The purpose of GLumenRadiosityDistanceFieldSurfaceBias is to store the actual value used in the rendering calculations. It’s the C++ variable that directly influences the distance field surface bias in the radiosity tracing process.
This variable is used within the Lumen radiosity subsystem of the Unreal Engine renderer. It’s applied in the setup of tracing parameters for probes and affects the minimum trace distance in indirect tracing.
The value of GLumenRadiosityDistanceFieldSurfaceBias is set through the associated console variable r.LumenScene.Radiosity.DistanceFieldSurfaceBias. This allows for runtime adjustment of the surface bias.
Other variables that interact with it include GLumenRadiosityDistanceFieldSurfaceSlopeBias and GLumenRadiosityHardwareRayTracingSurfaceBias, which are related settings for the radiosity tracing process.
Developers should be aware that this variable directly affects the tracing behavior in the radiosity calculations. Its value is clamped between 0.0f and 1000.0f when used in the tracing parameters, ensuring it stays within a reasonable range.
Best practices for using this variable include:
- Coordinating changes with the console variable r.LumenScene.Radiosity.DistanceFieldSurfaceBias.
- Monitoring its impact on both visual quality and performance when modified.
- Considering its interaction with other radiosity-related variables for a holistic approach to tuning the Lumen system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:97
Scope: file
Source code excerpt:
float GLumenRadiosityDistanceFieldSurfaceBias = 10.0f;
FAutoConsoleVariableRef CVarLumenRadiositySurfaceBias(
TEXT("r.LumenScene.Radiosity.DistanceFieldSurfaceBias"),
GLumenRadiosityDistanceFieldSurfaceBias,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadiosityDistanceFieldSurfaceSlopeBias = 5.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenRadiosityDistanceFieldSurfaceBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:92
Scope: file
Source code excerpt:
GLumenRadiosityMaxRayIntensity,
TEXT("Clamps Radiosity trace intensity, relative to current view exposure. Useful for reducing artifacts from small bright emissive sources, but loses energy and adds view dependence."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadiosityDistanceFieldSurfaceBias = 10.0f;
FAutoConsoleVariableRef CVarLumenRadiositySurfaceBias(
TEXT("r.LumenScene.Radiosity.DistanceFieldSurfaceBias"),
GLumenRadiosityDistanceFieldSurfaceBias,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadiosityDistanceFieldSurfaceSlopeBias = 5.0f;
FAutoConsoleVariableRef CVarLumenRadiosityDistanceFieldSurfaceBias(
TEXT("r.LumenScene.Radiosity.DistanceFieldSurfaceSlopeBias"),
GLumenRadiosityDistanceFieldSurfaceBias,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadiosityHardwareRayTracingSurfaceBias = 0.1f;
FAutoConsoleVariableRef CVarLumenRadiosityHardwareRayTracingSurfaceBias(
TEXT("r.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias"),
GLumenRadiosityHardwareRayTracingSurfaceBias,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:843
Scope: file
Source code excerpt:
PassParameters->RWTraceRadianceAtlas = TraceRadianceAtlasUAV;
PassParameters->RWTraceHitDistanceAtlas = TraceHitDistanceAtlasUAV;
PassParameters->TracingParameters = TracingParameters;
SetupLumenDiffuseTracingParametersForProbe(View, PassParameters->IndirectTracingParameters, 0.0f);
PassParameters->IndirectTracingParameters.SurfaceBias = FMath::Clamp(GLumenRadiosityDistanceFieldSurfaceSlopeBias, 0.0f, 1000.0f);
PassParameters->IndirectTracingParameters.MinTraceDistance = FMath::Clamp(GLumenRadiosityDistanceFieldSurfaceBias, 0.0f, 1000.0f);
PassParameters->IndirectTracingParameters.MaxTraceDistance = Lumen::GetMaxTraceDistance(View);
PassParameters->MaxRayIntensity = FMath::Clamp(GLumenRadiosityMaxRayIntensity, 0.0f, 1000000.0f);
FLumenRadiosityDistanceFieldTracingCS::FPermutationDomain PermutationVector;
PermutationVector.Set<FLumenRadiosityDistanceFieldTracingCS::FThreadGroupSize32>(Lumen::UseThreadGroupSize32());
PermutationVector.Set<FLumenRadiosityDistanceFieldTracingCS::FTraceGlobalSDF>(Lumen::UseGlobalSDFTracing(*View.Family));
PermutationVector.Set<FLumenRadiosityDistanceFieldTracingCS::FSimpleCoverageBasedExpand>(Lumen::UseGlobalSDFTracing(*View.Family) && Lumen::UseGlobalSDFSimpleCoverageBasedExpand());
auto ComputeShader = GlobalShaderMap->GetShader<FLumenRadiosityDistanceFieldTracingCS>(PermutationVector);
FComputeShaderUtils::AddPass(
GraphBuilder,