r.Lumen.TranslucencyVolume.Temporal.Jitter
r.Lumen.TranslucencyVolume.Temporal.Jitter
#Overview
name: r.Lumen.TranslucencyVolume.Temporal.Jitter
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to apply jitter to each frame\'s translucency GI computation, achieving temporal super sampling.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.TranslucencyVolume.Temporal.Jitter is to control whether jitter is applied to each frame’s translucency Global Illumination (GI) computation, achieving temporal super sampling in Unreal Engine’s Lumen lighting system.
This setting variable is primarily used in the rendering system, specifically within the Lumen subsystem for translucency volume lighting. It is part of the Renderer module in Unreal Engine 5.
The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be modified at runtime using console commands or through project settings.
The associated variable GTranslucencyVolumeJitter directly interacts with r.Lumen.TranslucencyVolume.Temporal.Jitter. They share the same value, and GTranslucencyVolumeJitter is used in the C++ code to control the behavior.
Developers must be aware that:
- This variable affects the quality and performance of translucency lighting.
- It is marked with ECVF_Scalability, indicating it can be used for performance scaling.
- It is thread-safe for the render thread (ECVF_RenderThreadSafe).
Best practices when using this variable include:
- Consider the performance impact when enabling jitter, especially on lower-end hardware.
- Use in conjunction with other Lumen settings for optimal results.
- Test thoroughly in different lighting scenarios to ensure desired visual quality.
Regarding the associated variable GTranslucencyVolumeJitter:
- It is an int32 variable that directly controls the jitter behavior in the code.
- It is used in the TranslucencyVolumeTemporalRandom function to determine whether to apply random offsets.
- In the GetTranslucencyLightingVolumeParameters function, it sets the UseJitter parameter, affecting the translucency lighting volume calculations.
Developers should be aware that modifying GTranslucencyVolumeJitter directly in code will have the same effect as changing the console variable, and should be done with caution, considering the same best practices mentioned above.
#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:100
Scope: file
Source code excerpt:
int32 GTranslucencyVolumeJitter = 1;
FAutoConsoleVariableRef CVarTranslucencyVolumeJitter(
TEXT("r.Lumen.TranslucencyVolume.Temporal.Jitter"),
GTranslucencyVolumeJitter,
TEXT("Whether to apply jitter to each frame's translucency GI computation, achieving temporal super sampling."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GTranslucencyVolumeHistoryWeight = .9f;
#Associated Variable and Callsites
This variable is associated with another variable named GTranslucencyVolumeJitter
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:98
Scope: file
Source code excerpt:
);
int32 GTranslucencyVolumeJitter = 1;
FAutoConsoleVariableRef CVarTranslucencyVolumeJitter(
TEXT("r.Lumen.TranslucencyVolume.Temporal.Jitter"),
GTranslucencyVolumeJitter,
TEXT("Whether to apply jitter to each frame's translucency GI computation, achieving temporal super sampling."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GTranslucencyVolumeHistoryWeight = .9f;
FAutoConsoleVariableRef CVarTranslucencyVolumeHistoryWeight(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:401
Scope (from outer to inner):
file
function FVector TranslucencyVolumeTemporalRandom
Source code excerpt:
FVector RandomOffsetValue(.5f, .5f, .5f);
if (GTranslucencyVolumeJitter)
{
RandomOffsetValue = FVector(Halton(FrameNumber & 1023, 2), Halton(FrameNumber & 1023, 3), Halton(FrameNumber & 1023, 5));
}
return RandomOffsetValue;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:591
Scope (from outer to inner):
file
function FLumenTranslucencyLightingVolumeParameters GetTranslucencyLightingVolumeParameters
Source code excerpt:
Parameters.TranslucencyGIGridSize = TranslucencyGridSize;
Parameters.UseJitter = GTranslucencyVolumeJitter;
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;