r.Lumen.TranslucencyVolume.GridCenterOffsetFromDepthBuffer
r.Lumen.TranslucencyVolume.GridCenterOffsetFromDepthBuffer
#Overview
name: r.Lumen.TranslucencyVolume.GridCenterOffsetFromDepthBuffer
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Offset in grid units to move grid center sample out form the depth buffer along the Z direction. -1 means disabled. This reduces sample self intersection with geometry when tracing the global distance field buffer, and thus reduces flickering in those areas, as well as results in less leaking sometimes.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.TranslucencyVolume.GridCenterOffsetFromDepthBuffer is to control the offset of the grid center sample from the depth buffer along the Z direction in the Lumen translucency volume lighting system. This setting is part of Unreal Engine 5’s rendering system, specifically the Lumen global illumination feature.
This setting variable is primarily used in the Lumen translucency volume lighting subsystem, which is part of the Renderer module in Unreal Engine 5. It’s utilized to improve the quality of translucency lighting by reducing sample self-intersection with geometry and minimizing flickering and light leaking issues.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 0.5f and can be modified at runtime using the console command system.
The associated variable GTranslucencyVolumeGridCenterOffsetFromDepthBuffer directly interacts with this setting. They share the same value, with the console variable acting as an interface for runtime modification.
Developers should be aware that:
- Setting this value to -1 disables the offset feature.
- Adjusting this value can impact the visual quality and performance of translucency lighting.
- The effect of this setting is closely tied to the global distance field buffer tracing.
Best practices when using this variable include:
- Experiment with different values to find the optimal balance between visual quality and performance for your specific scene.
- Monitor for any unintended side effects when modifying this value, such as changes in lighting consistency or performance impacts.
- Consider the interaction with other Lumen settings, particularly those related to translucency and the global distance field.
Regarding the associated variable GTranslucencyVolumeGridCenterOffsetFromDepthBuffer:
- Its purpose is to store the actual value used in the rendering calculations.
- It’s used directly in the GetTranslucencyLightingVolumeParameters function to set up the lighting volume parameters.
- The value is passed to the GPU for use in shader calculations.
- Developers should treat this as a read-only variable in most cases, modifying it through the console variable system instead of directly.
#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:236
Scope: file
Source code excerpt:
float GTranslucencyVolumeGridCenterOffsetFromDepthBuffer = 0.5f;
FAutoConsoleVariableRef CVarTranslucencyVolumeGridCenterOffsetFromDepthBuffer(
TEXT("r.Lumen.TranslucencyVolume.GridCenterOffsetFromDepthBuffer"),
GTranslucencyVolumeGridCenterOffsetFromDepthBuffer,
TEXT("Offset in grid units to move grid center sample out form the depth buffer along the Z direction. -1 means disabled. This reduces sample self intersection with geometry when tracing the global distance field buffer, and thus reduces flickering in those areas, as well as results in less leaking sometimes."),
ECVF_RenderThreadSafe
);
float GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset = 1.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GTranslucencyVolumeGridCenterOffsetFromDepthBuffer
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:234
Scope: file
Source code excerpt:
);
float GTranslucencyVolumeGridCenterOffsetFromDepthBuffer = 0.5f;
FAutoConsoleVariableRef CVarTranslucencyVolumeGridCenterOffsetFromDepthBuffer(
TEXT("r.Lumen.TranslucencyVolume.GridCenterOffsetFromDepthBuffer"),
GTranslucencyVolumeGridCenterOffsetFromDepthBuffer,
TEXT("Offset in grid units to move grid center sample out form the depth buffer along the Z direction. -1 means disabled. This reduces sample self intersection with geometry when tracing the global distance field buffer, and thus reduces flickering in those areas, as well as results in less leaking sometimes."),
ECVF_RenderThreadSafe
);
float GTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset = 1.0f;
FAutoConsoleVariableRef CVarTranslucencyVolumeOffsetThresholdToAcceptDepthBufferOffset(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:594
Scope (from outer to inner):
file
function FLumenTranslucencyLightingVolumeParameters GetTranslucencyLightingVolumeParameters
Source code excerpt:
Parameters.FrameJitterOffset = (FVector3f)TranslucencyVolumeTemporalRandom(View.ViewState ? View.ViewState->GetFrameIndex() : 0);
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;