r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse
r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse
#Overview
name: r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse
The value of this variable can be defined or overridden in .ini config files. 3
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to gather lighting along the backface for the Two Sided Foliage shading model, which adds some GPU cost. The final lighting is then DiffuseColor * FrontfaceLighting + SubsurfaceColor * BackfaceLighting. When disabled, SubsurfaceColor will simply be added to DiffuseColor instead.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse is to control the rendering of two-sided foliage in Unreal Engine 5’s Lumen global illumination system. Specifically, it determines whether to gather lighting along the backface for the Two Sided Foliage shading model.
This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine 5’s advanced lighting and global illumination features. It’s specifically utilized in the Screen Probe Gather process of Lumen.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1 (enabled) in the C++ code.
The associated variable GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse directly interacts with this console variable. They share the same value, with the console variable controlling the C++ variable.
Developers must be aware that enabling this feature adds some GPU cost. When enabled, the final lighting calculation for two-sided foliage becomes:
DiffuseColor * FrontfaceLighting + SubsurfaceColor * BackfaceLighting
When disabled, the calculation simplifies to adding SubsurfaceColor to DiffuseColor.
Best practices when using this variable include:
- Consider the performance impact. Enable it for higher-end hardware or when two-sided foliage lighting quality is crucial.
- Test the visual difference with the setting on and off to determine if the additional GPU cost is justified for your specific use case.
- Be aware of how this setting interacts with your foliage materials, especially those using the Two Sided Foliage shading model.
Regarding the associated variable GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse:
The purpose of this variable is to store the state of the r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse console variable in the C++ code.
It’s used in the Lumen rendering subsystem, specifically in the Screen Probe Gather process.
The value is set by the console variable system, initialized to 1 by default.
This variable directly controls the behavior of the two-sided foliage backface diffuse gathering in the rendering code. For example, it’s used to determine whether to create and use a BackfaceDiffuseIndirect texture in the RenderLumenScreenProbeGather function.
Developers should be aware that this variable directly affects rendering performance and quality for two-sided foliage.
Best practices include using this variable in conjunction with performance profiling tools to fine-tune the balance between visual quality and rendering performance for foliage in your specific game or application.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:284, section: [GlobalIlluminationQuality@2]
- INI Section:
GlobalIlluminationQuality@2
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:307, section: [GlobalIlluminationQuality@3]
- INI Section:
GlobalIlluminationQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:331, section: [GlobalIlluminationQuality@Cine]
- INI Section:
GlobalIlluminationQuality@Cine
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:123
Scope: file
Source code excerpt:
int32 GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse = 1;
FAutoConsoleVariableRef CVarLumenScreenProbeSupportBackfaceDiffuse(
TEXT("r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse"),
GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse,
TEXT("Whether to gather lighting along the backface for the Two Sided Foliage shading model, which adds some GPU cost. The final lighting is then DiffuseColor * FrontfaceLighting + SubsurfaceColor * BackfaceLighting. When disabled, SubsurfaceColor will simply be added to DiffuseColor instead."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenScreenProbeDiffuseIntegralMethod = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:121
Scope: file
Source code excerpt:
);
int32 GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse = 1;
FAutoConsoleVariableRef CVarLumenScreenProbeSupportBackfaceDiffuse(
TEXT("r.Lumen.ScreenProbeGather.TwoSidedFoliageBackfaceDiffuse"),
GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse,
TEXT("Whether to gather lighting along the backface for the Two Sided Foliage shading model, which adds some GPU cost. The final lighting is then DiffuseColor * FrontfaceLighting + SubsurfaceColor * BackfaceLighting. When disabled, SubsurfaceColor will simply be added to DiffuseColor instead."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenScreenProbeDiffuseIntegralMethod = 0;
FAutoConsoleVariableRef CVarLumenScreenProbeDiffuseIntegralMethod(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:2242
Scope (from outer to inner):
file
function FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenScreenProbeGather
Source code excerpt:
FRDGTextureRef DiffuseIndirect = GraphBuilder.CreateTexture(DiffuseIndirectDesc, TEXT("Lumen.ScreenProbeGather.DiffuseIndirect"));
const bool bSupportBackfaceDiffuse = GLumenScreenProbeSupportTwoSidedFoliageBackfaceDiffuse != 0;
FRDGTextureRef BackfaceDiffuseIndirect = nullptr;
if (bSupportBackfaceDiffuse)
{
FRDGTextureDesc BackfaceDiffuseIndirectDesc = FRDGTextureDesc::Create2DArray(EffectiveResolution, PF_FloatRGB, FClearValueBinding::Black, TexCreate_ShaderResource | TexCreate_UAV, ClosureCount);
BackfaceDiffuseIndirect = GraphBuilder.CreateTexture(BackfaceDiffuseIndirectDesc, TEXT("Lumen.ScreenProbeGather.BackfaceDiffuseIndirect"));