r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand
r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand
#Overview
name: r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use simple coverage based surface expansion. Less accurate but does not sample the coverage texture.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand is to control whether simple coverage-based surface expansion is used in the Lumen global scene distance field system. This setting is part of the rendering system, specifically the global distance field and Lumen subsystems in Unreal Engine 5.
The Unreal Engine subsystems that rely on this setting variable are the Renderer module and the Lumen global illumination system. This can be inferred from the file locations where the variable is referenced: GlobalDistanceField.cpp and LumenDiffuseIndirect.cpp.
The value of this variable is set through the Unreal Engine console variable system. It is defined as an integer with a default value of 0, which means the feature is disabled by default.
The associated variable GLumenSceneGlobalSDFSimpleCoverageBasedExpand interacts directly with this console variable. They share the same value, with the console variable controlling the engine variable.
Developers must be aware that enabling this variable (setting it to a non-zero value) will use a simpler, less accurate method for surface expansion in the global distance field. While this method is less accurate, it has the advantage of not sampling the coverage texture, which could potentially improve performance.
Best practices when using this variable include:
- Only enable it if you’re experiencing performance issues related to global distance field calculations.
- Test thoroughly after enabling to ensure the visual quality is still acceptable for your project.
- Consider using it as a scalability option, allowing it to be enabled on lower-end hardware.
Regarding the associated variable GLumenSceneGlobalSDFSimpleCoverageBasedExpand:
- Its purpose is to store the state of the simple coverage-based expansion feature within the engine’s C++ code.
- It is used in the Renderer module, specifically in the Lumen subsystem.
- Its value is set by the console variable r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand.
- It is checked in the Lumen::UseGlobalSDFSimpleCoverageBasedExpand() function to determine whether to use the simple coverage-based expansion.
- Developers should not modify this variable directly but instead use the console variable to control its value.
- When working with this variable in code, always use the Lumen::UseGlobalSDFSimpleCoverageBasedExpand() function to check its state, rather than accessing the variable directly.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:231
Scope: file
Source code excerpt:
int32 GLumenSceneGlobalSDFSimpleCoverageBasedExpand = 0;
FAutoConsoleVariableRef CVarLumenSceneGlobalSDFSimpleCoverageBasedExpand(
TEXT("r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand"),
GLumenSceneGlobalSDFSimpleCoverageBasedExpand,
TEXT("Whether to use simple coverage based surface expansion. Less accurate but does not sample the coverage texture."),
ECVF_Scalability | ECVF_RenderThreadSafe);
float GLumenSceneGlobalSDFNotCoveredMinStepScale = 4.0f;
FAutoConsoleVariableRef CVarLumenScenGlobalSDFNotCoveredMinStepScale(
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSceneGlobalSDFSimpleCoverageBasedExpand
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:229
Scope: file
Source code excerpt:
);
int32 GLumenSceneGlobalSDFSimpleCoverageBasedExpand = 0;
FAutoConsoleVariableRef CVarLumenSceneGlobalSDFSimpleCoverageBasedExpand(
TEXT("r.LumenScene.GlobalSDF.SimpleCoverageBasedExpand"),
GLumenSceneGlobalSDFSimpleCoverageBasedExpand,
TEXT("Whether to use simple coverage based surface expansion. Less accurate but does not sample the coverage texture."),
ECVF_Scalability | ECVF_RenderThreadSafe);
float GLumenSceneGlobalSDFNotCoveredMinStepScale = 4.0f;
FAutoConsoleVariableRef CVarLumenScenGlobalSDFNotCoveredMinStepScale(
TEXT("r.LumenScene.GlobalSDF.NotCoveredMinStepScale"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:14
Scope: file
Source code excerpt:
#include "ComponentRecreateRenderStateContext.h"
extern int32 GLumenSceneGlobalSDFSimpleCoverageBasedExpand;
FLumenGatherCvarState GLumenGatherCvars;
FLumenGatherCvarState::FLumenGatherCvarState()
{
TraceMeshSDFs = 1;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenDiffuseIndirect.cpp:204
Scope (from outer to inner):
file
function bool Lumen::UseGlobalSDFSimpleCoverageBasedExpand
Source code excerpt:
bool Lumen::UseGlobalSDFSimpleCoverageBasedExpand()
{
return GLumenSceneGlobalSDFSimpleCoverageBasedExpand != 0;
}
float Lumen::GetMaxTraceDistance(const FViewInfo& View)
{
return FMath::Clamp(View.FinalPostProcessSettings.LumenMaxTraceDistance * GLumenTraceDistanceScale, .01f, Lumen::MaxTraceDistance);
}