r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale
r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale
#Overview
name: r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scales the min step size to improve performance, for Mesh SDFs that contain mostly two sided materials (foliage)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale is to scale the minimum step size for Mesh Signed Distance Field (SDF) calculations, particularly for objects that contain mostly two-sided materials like foliage. This setting is part of the Lumen global illumination system in Unreal Engine 5, specifically targeting the diffuse indirect lighting calculations.
This setting variable is primarily used in the Lumen rendering subsystem, which is responsible for real-time global illumination in Unreal Engine 5. It’s specifically used in the Mesh SDF culling process, which is a part of the Lumen diffuse indirect lighting pipeline.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.
The associated variable GMeshSDFNotCoveredMinStepScale directly interacts with this console variable. They share the same value, with GMeshSDFNotCoveredMinStepScale being the actual variable used in the rendering code.
Developers should be aware that this variable affects performance and quality trade-offs in the Lumen system, particularly for scenes with a lot of foliage or other objects with two-sided materials. Increasing this value will improve performance but may reduce the accuracy of indirect lighting on these objects.
Best practices when using this variable include:
- Start with the default value (32) and adjust as needed based on performance and visual quality requirements.
- Monitor performance metrics when adjusting this value, as it can have a significant impact on rendering time.
- Be cautious when increasing this value, as it may lead to visible artifacts in the indirect lighting, especially on foliage and similar objects.
Regarding the associated variable GMeshSDFNotCoveredMinStepScale:
The purpose of GMeshSDFNotCoveredMinStepScale is to store the actual value used in the rendering calculations for scaling the minimum step size in Mesh SDF calculations.
This variable is used directly in the Lumen rendering code, specifically in the SetupLumenMeshSDFTracingParameters function, where it’s assigned to the MeshSDFNotCoveredMinStepScale field of the FLumenMeshSDFTracingParameters struct.
The value of GMeshSDFNotCoveredMinStepScale is set by the console variable r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale.
No other variables directly interact with GMeshSDFNotCoveredMinStepScale, but it’s used alongside other Mesh SDF-related variables in the Lumen system.
Developers should be aware that modifying GMeshSDFNotCoveredMinStepScale directly in code is not recommended, as its value is controlled by the console variable system.
Best practices for GMeshSDFNotCoveredMinStepScale include:
- Use the console variable r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale to modify its value rather than changing it directly in code.
- When debugging or profiling Lumen performance, monitor this variable’s impact on rendering time and quality.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshSDFCulling.cpp:41
Scope: file
Source code excerpt:
float GMeshSDFNotCoveredMinStepScale = 32;
FAutoConsoleVariableRef CVarMeshSDFNotCoveredMinStepScale(
TEXT("r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale"),
GMeshSDFNotCoveredMinStepScale,
TEXT("Scales the min step size to improve performance, for Mesh SDFs that contain mostly two sided materials (foliage)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GMeshSDFDitheredTransparencyStepThreshold = .1f;
#Associated Variable and Callsites
This variable is associated with another variable named GMeshSDFNotCoveredMinStepScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshSDFCulling.cpp:39
Scope: file
Source code excerpt:
);
float GMeshSDFNotCoveredMinStepScale = 32;
FAutoConsoleVariableRef CVarMeshSDFNotCoveredMinStepScale(
TEXT("r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredMinStepScale"),
GMeshSDFNotCoveredMinStepScale,
TEXT("Scales the min step size to improve performance, for Mesh SDFs that contain mostly two sided materials (foliage)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GMeshSDFDitheredTransparencyStepThreshold = .1f;
FAutoConsoleVariableRef CVarMeshSDFDitheredTransparencyStepThreshold(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshSDFCulling.cpp:79
Scope (from outer to inner):
file
function void SetupLumenMeshSDFTracingParameters
Source code excerpt:
OutParameters.DistanceFieldAtlas = DistanceField::SetupAtlasParameters(GraphBuilder, DistanceFieldSceneData);
OutParameters.MeshSDFNotCoveredExpandSurfaceScale = GMeshSDFNotCoveredExpandSurfaceScale;
OutParameters.MeshSDFNotCoveredMinStepScale = GMeshSDFNotCoveredMinStepScale;
OutParameters.MeshSDFDitheredTransparencyStepThreshold = GMeshSDFDitheredTransparencyStepThreshold;
}
uint32 CullMeshSDFObjectsForViewGroupSize = 64;
class FCullMeshSDFObjectsForViewCS : public FGlobalShader