r.Lumen.TranslucencyVolume.OffsetThresholdToAcceptDepthBufferOffset
r.Lumen.TranslucencyVolume.OffsetThresholdToAcceptDepthBufferOffset
#Overview
name: r.Lumen.TranslucencyVolume.OffsetThresholdToAcceptDepthBufferOffset
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Offset in grid units to accept a sample to be moved forward in front of the depth buffer. This is to avoid moving all samples behind the depth buffer forward which would affect the lighting of translucent and volumetric at edges of mesh.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.TranslucencyVolume.OffsetThresholdToAcceptDepthBufferOffset is to control the offset threshold for accepting samples to be moved forward in front of the depth buffer in Lumen’s translucency volume lighting system. This setting is part of Unreal Engine 5’s rendering system, specifically the Lumen global illumination solution.
This setting variable is used by the Lumen Translucency Volume Lighting subsystem within the Renderer module of Unreal Engine 5. It’s primarily utilized in the LumenTranslucencyVolumeLighting.cpp file, which handles the lighting calculations for translucent objects using Lumen.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1.0f and can be modified at runtime using console commands.
This variable interacts directly with its associated variable GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset. They share the same value, with the console variable acting as an interface for developers to adjust the setting.
Developers must be aware that this variable affects the lighting of translucent and volumetric objects at the edges of meshes. It’s used to determine which samples should be moved forward in front of the depth buffer, which can impact the visual quality and performance of translucency lighting.
Best practices when using this variable include:
- Fine-tuning the value to balance visual quality and performance.
- Testing the impact of different values in various lighting scenarios.
- Being cautious when modifying this value, as it can affect the appearance of translucent objects in the scene.
Regarding the associated variable GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset:
This is the actual float variable that stores the offset threshold value. It’s used directly in the GetTranslucencyLightingVolumeParameters function to set up the parameters for translucency lighting calculations.
Developers should note that this variable is clamped to a minimum value of 0 when used in calculations (FMath::Max(0, GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset)). This ensures that the offset is always non-negative, preventing potential issues with reverse offsets.
When working with this variable, developers should consider its impact on the overall lighting calculations and adjust it in conjunction with other related translucency volume lighting settings for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:244
Scope: file
Source code excerpt:
float GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset = 1.0f;
FAutoConsoleVariableRef CVarTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset(
TEXT("r.Lumen.TranslucencyVolume.OffsetThresholdToAcceptDepthBufferOffset"),
GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset,
TEXT("Offset in grid units to accept a sample to be moved forward in front of the depth buffer. This is to avoid moving all samples behind the depth buffer forward which would affect the lighting of translucent and volumetric at edges of mesh."),
ECVF_RenderThreadSafe
);
namespace LumenTranslucencyVolume
#Associated Variable and Callsites
This variable is associated with another variable named GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:242
Scope: file
Source code excerpt:
);
float GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset = 1.0f;
FAutoConsoleVariableRef CVarTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset(
TEXT("r.Lumen.TranslucencyVolume.OffsetThresholdToAcceptDepthBufferOffset"),
GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset,
TEXT("Offset in grid units to accept a sample to be moved forward in front of the depth buffer. This is to avoid moving all samples behind the depth buffer forward which would affect the lighting of translucent and volumetric at edges of mesh."),
ECVF_RenderThreadSafe
);
namespace LumenTranslucencyVolume
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:595
Scope (from outer to inner):
file
function FLumenTranslucencyLightingVolumeParameters GetTranslucencyLightingVolumeParameters
Source code excerpt:
Parameters.UnjitteredClipToTranslatedWorld = FMatrix44f(View.ViewMatrices.ComputeInvProjectionNoAAMatrix() * View.ViewMatrices.GetTranslatedViewMatrix().GetTransposed()); // LWC_TODO: Precision loss?
Parameters.GridCenterOffsetFromDepthBuffer = GTranslucencyVolumeGridCenterOffsetFromDepthBuffer;
Parameters.GridCenterOffsetThresholdToAcceptDepthBufferOffset = FMath::Max(0, GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset);
Parameters.SceneTexturesStruct = View.GetSceneTextures().UniformBuffer;
Parameters.TranslucencyVolumeTracingOctahedronResolution = GTranslucencyVolumeTracingOctahedronResolution;
Parameters.FurthestHZBTexture = View.HZB;