r.LumenScene.Radiosity.DistanceFieldSurfaceSlopeBias
r.LumenScene.Radiosity.DistanceFieldSurfaceSlopeBias
#Overview
name: r.LumenScene.Radiosity.DistanceFieldSurfaceSlopeBias
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.DistanceFieldSurfaceSlopeBias is to control the surface slope bias in the Lumen radiosity system, which is part of Unreal Engine 5’s global illumination solution. This setting is specifically used in the distance field tracing process for radiosity calculations.
This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine 5’s advanced lighting and global illumination features. It’s referenced in the LumenRadiosity.cpp file, indicating its importance in the radiosity calculations for the Lumen scene.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 5.0f and can be modified at runtime using console commands or through project settings.
This variable interacts closely with GLumenRadiosityDistanceFieldSurfaceBias. They are both used in setting up the tracing parameters for the Lumen diffuse probes. Additionally, it’s used in conjunction with other radiosity-related variables like GLumenRadiosityMaxRayIntensity and GLumenRadiosityHardwareRayTracingSurfaceBias.
Developers must be aware that this variable affects the accuracy and performance of the Lumen radiosity system. A higher value may help reduce artifacts but could potentially impact performance or introduce other visual issues.
Best practices when using this variable include:
- Adjusting it in small increments to find the optimal balance between artifact reduction and performance.
- Testing its effects in various lighting scenarios to ensure consistent quality across different environments.
- Considering its interaction with other Lumen settings for a holistic approach to global illumination quality.
Regarding the associated variable GLumenRadiosityDistanceFieldSurfaceBias:
The purpose of GLumenRadiosityDistanceFieldSurfaceBias is to set a minimum trace distance for the Lumen radiosity system when using distance field tracing. It works in tandem with the slope bias to control the accuracy of the radiosity calculations.
This variable is also part of the Lumen rendering subsystem and is used in the same contexts as the slope bias variable.
Its value is set through the console variable system, with a default value of 10.0f.
GLumenRadiosityDistanceFieldSurfaceBias interacts directly with r.LumenScene.Radiosity.DistanceFieldSurfaceSlopeBias in the tracing parameter setup.
Developers should be aware that this bias affects the starting point of ray traces in the radiosity calculations, which can impact both the accuracy of the lighting and the performance of the system.
Best practices for using this variable include:
- Balancing it with the slope bias for optimal results.
- Adjusting it based on the scale of your scene to ensure appropriate coverage.
- Monitoring its impact on performance, especially in complex scenes with many objects.
#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:105
Scope: file
Source code excerpt:
float GLumenRadiosityDistanceFieldSurfaceSlopeBias = 5.0f;
FAutoConsoleVariableRef CVarLumenRadiosityDistanceFieldSurfaceBias(
TEXT("r.LumenScene.Radiosity.DistanceFieldSurfaceSlopeBias"),
GLumenRadiosityDistanceFieldSurfaceBias,
TEXT("."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadiosityHardwareRayTracingSurfaceBias = 0.1f;
#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,