r.Deferred.UsesLightFunctionAtlas
r.Deferred.UsesLightFunctionAtlas
#Overview
name: r.Deferred.UsesLightFunctionAtlas
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether the light function atlas is sampled when rendering local lights.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Deferred.UsesLightFunctionAtlas is to control whether the light function atlas is sampled when rendering local lights in the deferred rendering pipeline. This setting is part of Unreal Engine 5’s rendering system, specifically related to light function rendering optimization.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its location in the LightFunctionAtlas.cpp file within the Runtime/Renderer/Private directory.
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 configuration files.
This variable interacts closely with GDeferredUsesLightFunctionAtlas, which is the actual integer variable that stores the value. The console variable r.Deferred.UsesLightFunctionAtlas is effectively an interface to modify and access GDeferredUsesLightFunctionAtlas.
Developers should be aware that this variable affects the performance and quality of light function rendering in deferred lighting scenarios. Enabling it (setting to 1) may improve performance by using the light function atlas, but it might have implications on memory usage or rendering quality that should be considered.
Best practices when using this variable include:
- Testing the performance impact in your specific use case before enabling or disabling it.
- Considering the trade-offs between rendering quality and performance.
- Ensuring that any changes to this variable are properly synchronized with other related rendering settings.
Regarding the associated variable GDeferredUsesLightFunctionAtlas:
The purpose of GDeferredUsesLightFunctionAtlas is to store the actual integer value that determines whether the light function atlas is used for deferred lighting.
This variable is used directly in the Renderer module, specifically in the LightFunctionAtlas namespace and FLightFunctionAtlas class.
The value of GDeferredUsesLightFunctionAtlas is set through the r.Deferred.UsesLightFunctionAtlas console variable.
It interacts with other variables like bVolumetricFogRequestsLF, bDeferredlightingRequestsLF, bManyLightsRequestsLF, and bLumenRequestsLF to determine if the light function atlas should be enabled.
Developers must be aware that this variable directly affects the behavior of the light function atlas in deferred lighting scenarios. Its value (0 or non-zero) determines whether the atlas is used.
Best practices for using GDeferredUsesLightFunctionAtlas include:
- Avoiding direct modification of this variable; instead, use the r.Deferred.UsesLightFunctionAtlas console variable.
- Considering the impact on rendering performance and quality when changing this value.
- Ensuring that related systems (like volumetric fog, many lights system, and Lumen) are properly configured when modifying this setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightFunctionAtlas.cpp:101
Scope: file
Source code excerpt:
int GDeferredUsesLightFunctionAtlas = 0;
FAutoConsoleVariableRef CVarDeferredLightsUsesLightFunctionAtlas(
TEXT("r.Deferred.UsesLightFunctionAtlas"),
GDeferredUsesLightFunctionAtlas,
TEXT("Whether the light function atlas is sampled when rendering local lights."),
ECVF_RenderThreadSafe
);
int GLumenUsesLightFunctionAtlas = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GDeferredUsesLightFunctionAtlas
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightFunctionAtlas.cpp:99
Scope: file
Source code excerpt:
// This deferred CVar includes deferred lights splatting (batched or not) as well as clustered lighting.
int GDeferredUsesLightFunctionAtlas = 0;
FAutoConsoleVariableRef CVarDeferredLightsUsesLightFunctionAtlas(
TEXT("r.Deferred.UsesLightFunctionAtlas"),
GDeferredUsesLightFunctionAtlas,
TEXT("Whether the light function atlas is sampled when rendering local lights."),
ECVF_RenderThreadSafe
);
int GLumenUsesLightFunctionAtlas = 1;
FAutoConsoleVariableRef CVarLumenUsesLightFunctionAtlas(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightFunctionAtlas.cpp:270
Scope (from outer to inner):
file
namespace LightFunctionAtlas
function void FLightFunctionAtlas::BeginSceneFrame
Source code excerpt:
{
bVolumetricFogRequestsLF = bShouldRenderVolumetricFog && GVolumetricFogUsesLightFunctionAtlas > 0;
bDeferredlightingRequestsLF = GDeferredUsesLightFunctionAtlas > 0;
bManyLightsRequestsLF = ManyLights::IsUsingLightFunctions();
bLumenRequestsLF = GLumenUsesLightFunctionAtlas > 0;// && IsLumenTranslucencyGIEnabled();// GLumenScene enabled ...;
bLightFunctionAtlasEnabled = bLightFunctionAtlasEnabled &&
(bVolumetricFogRequestsLF ||
bDeferredlightingRequestsLF ||