r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale

r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale

#Overview

name: r.LumenScene.GlobalSDF.NotCoveredExpandSurfaceScale

This variable is created as a Console Variable (cvar).

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:

  1. Testing different values to find the optimal balance between performance and visual quality for your specific scene.
  2. Being cautious when modifying this value, as it can affect the entire scene’s lighting and reflection quality.
  3. Considering the impact on performance, as higher values may increase computational cost.

Regarding the associated variable GLumenSceneGlobalSDFNotCoveredExpandSurfaceScale:

#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)