r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale
r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale
#Overview
name: r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scales the half voxel SDF expand used by the Global SDF to reconstruct surfaces that are thinner than the distance between two voxels, for regions of space that only contain Two Sided Mesh SDFs.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale is to control the scaling of the half voxel SDF expansion used by the Global SDF in Unreal Engine 5’s Lumen rendering system. This variable specifically affects the reconstruction of surfaces that are thinner than the distance between two voxels, particularly in regions of space that only contain Two Sided Mesh SDFs.
This setting variable is primarily used in the rendering system, specifically within the Global Distance Field component of the Lumen lighting system. Based on the callsites, it appears to be part of the Renderer module in Unreal Engine 5.
The value of this variable is set through the FAutoConsoleVariableRef system, which allows it to be changed at runtime. It’s initialized with a default value of 0.6f.
The associated variable GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale directly interacts with this console variable. They share the same value, with the console variable acting as an interface for runtime modification.
Developers should be aware that this variable affects the quality of surface reconstruction in the Global SDF, particularly for thin objects. Adjusting this value can impact the visual fidelity of lighting and reflections in scenes with detailed geometry.
Best practices when using this variable include:
- Testing different values to find the optimal balance between performance and visual quality for your specific scene.
- Being cautious when modifying this value, as it can affect the entire scene’s lighting and reflection quality.
- Considering the impact on performance, as higher values may increase computational cost.
Regarding the associated variable GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale:
- Its purpose is to store the actual value used in the rendering calculations.
- It’s used in the SetupGlobalDistanceFieldParameters and SetupGlobalDistanceFieldUniformBufferParameters functions, indicating its importance in setting up the Global Distance Field for rendering.
- The value is set directly from the console variable.
- It interacts closely with other Global SDF parameters like CoveredExpandSurfaceScale and NotCoveredMinStepScale.
- Developers should treat this variable as read-only in most cases, modifying it through the console variable instead.
- Best practice is to access this variable when needed for rendering calculations, ensuring that any changes are made through the proper console variable system for consistency and maintainability.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:223
Scope: file
Source code excerpt:
float GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale = .6f;
FAutoConsoleVariableRef CVarLumenScenGlobalSDFNotCoveredExpandSurfaceScale(
TEXT("r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale"),
GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale,
TEXT("Scales the half voxel SDF expand used by the Global SDF to reconstruct surfaces that are thinner than the distance between two voxels, for regions of space that only contain Two Sided Mesh SDFs."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenSceneGlobalSDFSimpleCoverageBasedExpand = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:221
Scope: file
Source code excerpt:
);
float GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale = .6f;
FAutoConsoleVariableRef CVarLumenScenGlobalSDFNotCoveredExpandSurfaceScale(
TEXT("r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale"),
GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale,
TEXT("Scales the half voxel SDF expand used by the Global SDF to reconstruct surfaces that are thinner than the distance between two voxels, for regions of space that only contain Two Sided Mesh SDFs."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenSceneGlobalSDFSimpleCoverageBasedExpand = 0;
FAutoConsoleVariableRef CVarLumenSceneGlobalSDFSimpleCoverageBasedExpand(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:332
Scope (from outer to inner):
file
function FGlobalDistanceFieldParameters2 SetupGlobalDistanceFieldParameters
Source code excerpt:
ShaderParameters.CoveredExpandSurfaceScale = GLumenSceneGlobalSDFCoveredExpandSurfaceScale;
ShaderParameters.NotCoveredExpandSurfaceScale = GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale;
ShaderParameters.NotCoveredMinStepScale = GLumenSceneGlobalSDFNotCoveredMinStepScale;
ShaderParameters.DitheredTransparencyStepThreshold = GLumenSceneGlobalSDFDitheredTransparencyStepThreshold;
ShaderParameters.DitheredTransparencyTraceThreshold = GLumenSceneGlobalSDFDitheredTransparencyTraceThreshold;
ShaderParameters.GlobalDistanceFieldCoverageAtlasTextureSampler = TStaticSamplerState<SF_Trilinear, AM_Wrap, AM_Wrap, AM_Wrap>::GetRHI();
ShaderParameters.GlobalDistanceFieldPageAtlasTextureSampler = TStaticSamplerState<SF_Trilinear, AM_Wrap, AM_Wrap, AM_Wrap>::GetRHI();
ShaderParameters.GlobalDistanceFieldMipTextureSampler = TStaticSamplerState<SF_Trilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:1360
Scope (from outer to inner):
file
function void FViewInfo::SetupGlobalDistanceFieldUniformBufferParameters
Source code excerpt:
ViewUniformShaderParameters.CoveredExpandSurfaceScale = GLumenSceneGlobalSDFCoveredExpandSurfaceScale;
ViewUniformShaderParameters.NotCoveredExpandSurfaceScale = GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale;
ViewUniformShaderParameters.NotCoveredMinStepScale = GLumenSceneGlobalSDFNotCoveredMinStepScale;
ViewUniformShaderParameters.DitheredTransparencyStepThreshold = GLumenSceneGlobalSDFDitheredTransparencyStepThreshold;
ViewUniformShaderParameters.DitheredTransparencyTraceThreshold = GLumenSceneGlobalSDFDitheredTransparencyTraceThreshold;
}
void ReadbackDistanceFieldClipmap(FRHICommandListImmediate& RHICmdList, FGlobalDistanceFieldInfo& GlobalDistanceFieldInfo)