r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold

r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold

#Overview

name: r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold is to set a depth test threshold for determining whether fragments being rendered match the single layer that reflections were calculated for in the Lumen lighting system. This setting is specifically used in the context of translucency reflections for the front layer.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s specifically utilized in the front layer translucency reflection calculations, which are part of the Lumen global illumination and reflection system.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1024.0f, but can be changed at runtime or through configuration files.

This variable interacts closely with its associated variable CVarLumenFrontLayerDepthThreshold. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable is measured in float ULP (Unit of Least Precision) units. This means it’s dealing with very precise floating-point comparisons, which can be sensitive to numerical stability issues.

Best practices when using this variable include:

  1. Understanding the impact on performance and visual quality when adjusting this value.
  2. Testing different values in various scenarios to find the optimal balance between accuracy and performance.
  3. Being cautious when changing this value, as it can affect the visual consistency of reflections in translucent materials.

Regarding the associated variable CVarLumenFrontLayerDepthThreshold:

The purpose of CVarLumenFrontLayerDepthThreshold is identical to r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold. It’s the actual console variable that controls the depth threshold setting.

This variable is used directly in the rendering code, specifically in the FDeferredShadingSceneRenderer::RenderLumenFrontLayerTranslucencyReflections function. Here, it’s used to set the RelativeDepthThreshold of the LumenFrontLayerTranslucency structure for each view.

The value of this variable is set through the console variable system and can be accessed on the render thread using the GetValueOnRenderThread() method.

Developers should be aware that changes to this variable will take effect on the render thread, which means there might be a slight delay before the changes are visible.

Best practices for using CVarLumenFrontLayerDepthThreshold include:

  1. Using the console command system to adjust this value for testing and debugging.
  2. Considering the impact on different hardware when setting this value, as it may affect performance differently on various GPUs.
  3. Documenting any non-default values used in a project to ensure consistency across the development team.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenFrontLayerTranslucency.cpp:40

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarLumenFrontLayerDepthThreshold(
	TEXT("r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold"),
	1024.0f,
	TEXT("Depth test threshold used to determine whether the fragments being rendered match the single layer that reflections were calculated for. In float ULP units."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

bool IsVSMTranslucentHighQualityEnabled();

#Associated Variable and Callsites

This variable is associated with another variable named CVarLumenFrontLayerDepthThreshold. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenFrontLayerTranslucency.cpp:39

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarLumenFrontLayerDepthThreshold(
	TEXT("r.Lumen.TranslucencyReflections.FrontLayer.DepthThreshold"),
	1024.0f,
	TEXT("Depth test threshold used to determine whether the fragments being rendered match the single layer that reflections were calculated for. In float ULP units."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenFrontLayerTranslucency.cpp:551

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderLumenFrontLayerTranslucencyReflections

Source code excerpt:


		View.LumenFrontLayerTranslucency.bEnabled = true;
		View.LumenFrontLayerTranslucency.RelativeDepthThreshold = CVarLumenFrontLayerDepthThreshold.GetValueOnRenderThread();
		View.LumenFrontLayerTranslucency.Radiance = ReflectionTexture;
		View.LumenFrontLayerTranslucency.Normal = ReflectionGBuffer.FrontLayerTranslucencyNormal;
		View.LumenFrontLayerTranslucency.SceneDepth = ReflectionGBuffer.FrontLayerTranslucencySceneDepth;
	}
}