r.LumenScene.GlobalSDF.DitheredTransparencyStepThreshold
r.LumenScene.GlobalSDF.DitheredTransparencyStepThreshold
#Overview
name: r.LumenScene.GlobalSDF.DitheredTransparencyStepThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Per-step stochastic semi-transparency threshold, for tracing users that have dithered transparency enabled, 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.DitheredTransparencyStepThreshold is to control the per-step stochastic semi-transparency threshold for tracing in regions of space that only contain Two Sided Mesh SDFs, specifically for tracing users that have dithered transparency enabled in the Lumen global scene rendering system.
This setting variable is primarily used in the rendering system, specifically in the Global Distance Field (GDF) component of Unreal Engine’s Lumen lighting system. It is part of the Renderer module, as evidenced by its location in the GlobalDistanceField.cpp file.
The value of this variable is set through the console variable system (CVarLumenSceneGlobalSDFDitheredTransparencyStepThreshold) with a default value of 0.5f. It can be modified at runtime using console commands or through engine configuration files.
The associated variable GLumenSceneGlobalSDFDitheredTransparencyStepThreshold directly interacts with this setting. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable affects the quality and performance of dithered transparency rendering in scenes using Lumen’s global illumination. Adjusting this value can impact the visual fidelity and potentially the performance of scenes with semi-transparent objects.
Best practices when using this variable include:
- Testing different values to find the optimal balance between visual quality and performance for your specific scene.
- Consider the impact on different hardware configurations, as this setting may affect performance differently on various GPUs.
- Use in conjunction with other Lumen and Global Distance Field settings for best results.
- Document any changes made to this value in your project settings to ensure consistency across the development team.
Regarding the associated variable GLumenSceneGlobalSDFDitheredTransparencyStepThreshold:
- It is used directly in shader parameter setup (FGlobalDistanceFieldParameters2 and FViewInfo::SetupGlobalDistanceFieldUniformBufferParameters).
- This variable allows the engine to pass the configured threshold value to the rendering shaders.
- Developers should treat this variable as read-only in most cases, as its value is set by the console variable system.
- When debugging or profiling rendering issues related to dithered transparency in Lumen, this variable can be a useful reference point to understand the current threshold being used in the shaders.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:246
Scope: file
Source code excerpt:
float GLumenSceneGlobalSDFDitheredTransparencyStepThreshold = .5f;
FAutoConsoleVariableRef CVarLumenSceneGlobalSDFDitheredTransparencyStepThreshold(
TEXT("r.LumenScene.GlobalSDF.DitheredTransparencyStepThreshold"),
GLumenSceneGlobalSDFDitheredTransparencyStepThreshold,
TEXT("Per-step stochastic semi-transparency threshold, for tracing users that have dithered transparency enabled, for regions of space that only contain Two Sided Mesh SDFs."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenSceneGlobalSDFDitheredTransparencyTraceThreshold = .9f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSceneGlobalSDFDitheredTransparencyStepThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:244
Scope: file
Source code excerpt:
);
float GLumenSceneGlobalSDFDitheredTransparencyStepThreshold = .5f;
FAutoConsoleVariableRef CVarLumenSceneGlobalSDFDitheredTransparencyStepThreshold(
TEXT("r.LumenScene.GlobalSDF.DitheredTransparencyStepThreshold"),
GLumenSceneGlobalSDFDitheredTransparencyStepThreshold,
TEXT("Per-step stochastic semi-transparency threshold, for tracing users that have dithered transparency enabled, for regions of space that only contain Two Sided Mesh SDFs."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenSceneGlobalSDFDitheredTransparencyTraceThreshold = .9f;
FAutoConsoleVariableRef CVarLumenSceneGlobalSDFDitheredTransparencyTraceThreshold(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:334
Scope (from outer to inner):
file
function FGlobalDistanceFieldParameters2 SetupGlobalDistanceFieldParameters
Source code excerpt:
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();
return ShaderParameters;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GlobalDistanceField.cpp:1362
Scope (from outer to inner):
file
function void FViewInfo::SetupGlobalDistanceFieldUniformBufferParameters
Source code excerpt:
ViewUniformShaderParameters.NotCoveredExpandSurfaceScale = GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale;
ViewUniformShaderParameters.NotCoveredMinStepScale = GLumenSceneGlobalSDFNotCoveredMinStepScale;
ViewUniformShaderParameters.DitheredTransparencyStepThreshold = GLumenSceneGlobalSDFDitheredTransparencyStepThreshold;
ViewUniformShaderParameters.DitheredTransparencyTraceThreshold = GLumenSceneGlobalSDFDitheredTransparencyTraceThreshold;
}
void ReadbackDistanceFieldClipmap(FRHICommandListImmediate& RHICmdList, FGlobalDistanceFieldInfo& GlobalDistanceFieldInfo)
{
FGlobalDistanceFieldReadback* Readback = GDFReadbackRequest;