r.VolumetricFog.UsesLightFunctionAtlas
r.VolumetricFog.UsesLightFunctionAtlas
#Overview
name: r.VolumetricFog.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.VolumetricFog.UsesLightFunctionAtlas is to control whether the light function atlas is sampled when rendering local lights in volumetric fog. This setting variable is primarily used in the rendering system, specifically for volumetric fog lighting.
This setting variable is relied upon by the Renderer module of Unreal Engine, particularly in the volumetric fog rendering subsystem. It’s used in conjunction with the light function atlas, which is a texture atlas used to efficiently store and sample light functions for multiple lights.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using the console or through configuration files.
The variable r.VolumetricFog.UsesLightFunctionAtlas interacts directly with its associated variable GVolumetricFogUsesLightFunctionAtlas. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable specifically controls the use of the light function atlas for local lights in volumetric fog. It does not affect the directional light, which always generates a light function for volumetric fog.
Best practices when using this variable include:
- Consider performance implications when enabling it, as sampling the light function atlas for many lights could impact rendering performance.
- Use it in conjunction with other volumetric fog and lighting settings for optimal visual results.
- Be aware that it’s a scalability option, so it might be automatically adjusted based on the overall graphics settings.
Regarding the associated variable GVolumetricFogUsesLightFunctionAtlas:
The purpose of GVolumetricFogUsesLightFunctionAtlas is identical to r.VolumetricFog.UsesLightFunctionAtlas. It’s an internal representation of the console variable.
This variable is used directly in the rendering code to determine whether to sample the light function atlas for local lights in volumetric fog.
The value of GVolumetricFogUsesLightFunctionAtlas is set by the console variable system when r.VolumetricFog.UsesLightFunctionAtlas is modified.
It interacts with other rendering systems, such as deferred lighting and many lights system, to determine if the light function atlas should be created and sampled.
Developers should be aware that modifying GVolumetricFogUsesLightFunctionAtlas directly in code is not recommended. Instead, they should use the console variable r.VolumetricFog.UsesLightFunctionAtlas to change its value.
Best practices include using this variable in conditional statements to enable or disable light function atlas sampling for volumetric fog, and considering its value when optimizing rendering performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightFunctionAtlas.cpp:92
Scope: file
Source code excerpt:
);
FAutoConsoleVariableRef CVarVolumetricFogUsesLightFunctionAtlas(
TEXT("r.VolumetricFog.UsesLightFunctionAtlas"),
GVolumetricFogUsesLightFunctionAtlas,
TEXT("Whether the light function atlas is sampled when rendering local lights."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
// This deferred CVar includes deferred lights splatting (batched or not) as well as clustered lighting.
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFogUsesLightFunctionAtlas
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightFunctionAtlas.cpp:81
Scope: file
Source code excerpt:
// The CVars here represent systems that can request the creation/sampling of the light function atlas.
// They do not require shader recompilation since they are handled via permutations
// Volumetric fog always generate a light function for the directional light.
// So this alias really only controls the use of the LightFunctionAtlas on the local lights.
int GVolumetricFogUsesLightFunctionAtlas = 1;
FAutoConsoleVariableRef CVarVolumetricFogLightFunction(
TEXT("r.VolumetricFog.LightFunction"),
GVolumetricFogUsesLightFunctionAtlas,
TEXT("This is an alias, please use r.VolumetricFog.UsesLightFunctionAtlas."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
FAutoConsoleVariableRef CVarVolumetricFogUsesLightFunctionAtlas(
TEXT("r.VolumetricFog.UsesLightFunctionAtlas"),
GVolumetricFogUsesLightFunctionAtlas,
TEXT("Whether the light function atlas is sampled when rendering local lights."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
// 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
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightFunctionAtlas.cpp:266
Scope (from outer to inner):
file
namespace LightFunctionAtlas
function void FLightFunctionAtlas::BeginSceneFrame
Source code excerpt:
bool bDeferredlightingRequestsLF = false;
bool bManyLightsRequestsLF = false;
bool bLumenRequestsLF = false;
if (bLightFunctionAtlasEnabled)
{
bVolumetricFogRequestsLF = bShouldRenderVolumetricFog && GVolumetricFogUsesLightFunctionAtlas > 0;
bDeferredlightingRequestsLF = GDeferredUsesLightFunctionAtlas > 0;
bManyLightsRequestsLF = ManyLights::IsUsingLightFunctions();
bLumenRequestsLF = GLumenUsesLightFunctionAtlas > 0;// && IsLumenTranslucencyGIEnabled();// GLumenScene enabled ...;
bLightFunctionAtlasEnabled = bLightFunctionAtlasEnabled &&
(bVolumetricFogRequestsLF ||
bDeferredlightingRequestsLF ||
bManyLightsRequestsLF ||
bLumenRequestsLF ||
GetSingleLayerWaterUsesLightFunctionAtlas() ||
GetTranslucentUsesLightFunctionAtlas());