r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredExpandSurfaceScale
r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredExpandSurfaceScale
#Overview
name: r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredExpandSurfaceScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scales the surface expand used 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.NotCoveredExpandSurfaceScale is to scale the surface expansion used for Mesh Signed Distance Fields (SDFs) that primarily contain two-sided materials, such as foliage. This setting is part of the Lumen global illumination system in Unreal Engine 5, specifically for the diffuse indirect lighting calculations.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine 5’s rendering module. Based on the callsites, it’s implemented in the LumenMeshSDFCulling.cpp file, which is part of the Renderer’s private implementation.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 0.6f and can be modified at runtime using the console command system.
The associated variable GMeshSDFNotCoveredExpandSurfaceScale directly interacts with this setting. They share the same value, with the console variable acting as an interface to modify the global variable used in the actual rendering code.
Developers should be aware that this variable affects the rendering of objects with two-sided materials, particularly foliage. Adjusting this value will impact the appearance and performance of these objects in scenes using Lumen for global illumination.
Best practices when using this variable include:
- Fine-tuning it based on the specific needs of your scene, especially if you have a lot of foliage or two-sided materials.
- Balancing visual quality with performance, as higher values may improve visual fidelity but could impact rendering performance.
- Testing changes across a variety of scenes and viewing conditions to ensure consistent results.
Regarding the associated variable GMeshSDFNotCoveredExpandSurfaceScale:
The purpose of GMeshSDFNotCoveredExpandSurfaceScale is to store the actual value used in the rendering calculations. It’s the internal representation of the console variable.
This variable is used directly in the Lumen rendering pipeline, specifically in the SetupLumenMeshSDFTracingParameters function, where it’s assigned to the MeshSDFNotCoveredExpandSurfaceScale member of the FLumenMeshSDFTracingParameters struct.
The value of this variable is set by the console variable system and can be modified at runtime.
It interacts directly with the console variable r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredExpandSurfaceScale, reflecting any changes made through the console.
Developers should be aware that modifying this variable directly in code would bypass the console variable system and potentially lead to inconsistencies. It’s best to use the console variable for adjustments.
Best practices include:
- Treating this as a read-only variable in most cases, using the console variable for modifications.
- If needed in other parts of the rendering code, accessing it through the appropriate Lumen parameter structures rather than directly.
- Considering the performance implications when adjusting this value, as it affects the mesh SDF calculations in the Lumen pipeline.
#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:33
Scope: file
Source code excerpt:
float GMeshSDFNotCoveredExpandSurfaceScale = .6f;
FAutoConsoleVariableRef CVarMeshSDFNotCoveredExpandSurfaceScale(
TEXT("r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredExpandSurfaceScale"),
GMeshSDFNotCoveredExpandSurfaceScale,
TEXT("Scales the surface expand used for Mesh SDFs that contain mostly two sided materials (foliage)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GMeshSDFNotCoveredMinStepScale = 32;
#Associated Variable and Callsites
This variable is associated with another variable named GMeshSDFNotCoveredExpandSurfaceScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshSDFCulling.cpp:31
Scope: file
Source code excerpt:
);
float GMeshSDFNotCoveredExpandSurfaceScale = .6f;
FAutoConsoleVariableRef CVarMeshSDFNotCoveredExpandSurfaceScale(
TEXT("r.Lumen.DiffuseIndirect.MeshSDF.NotCoveredExpandSurfaceScale"),
GMeshSDFNotCoveredExpandSurfaceScale,
TEXT("Scales the surface expand used for Mesh SDFs that contain mostly two sided materials (foliage)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GMeshSDFNotCoveredMinStepScale = 32;
FAutoConsoleVariableRef CVarMeshSDFNotCoveredMinStepScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshSDFCulling.cpp:78
Scope (from outer to inner):
file
function void SetupLumenMeshSDFTracingParameters
Source code excerpt:
OutParameters.DistanceFieldObjectBuffers = DistanceField::SetupObjectBufferParameters(GraphBuilder, DistanceFieldSceneData);
OutParameters.DistanceFieldAtlas = DistanceField::SetupAtlasParameters(GraphBuilder, DistanceFieldSceneData);
OutParameters.MeshSDFNotCoveredExpandSurfaceScale = GMeshSDFNotCoveredExpandSurfaceScale;
OutParameters.MeshSDFNotCoveredMinStepScale = GMeshSDFNotCoveredMinStepScale;
OutParameters.MeshSDFDitheredTransparencyStepThreshold = GMeshSDFDitheredTransparencyStepThreshold;
}
uint32 CullMeshSDFObjectsForViewGroupSize = 64;