r.VolumetricFog.LightFunction
r.VolumetricFog.LightFunction
#Overview
name: r.VolumetricFog.LightFunction
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This is an alias, please use r.VolumetricFog.UsesLightFunctionAtlas.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog.LightFunction is to control whether the light function atlas is sampled when rendering local lights in volumetric fog. This setting variable is specifically related to the rendering system, particularly the volumetric fog and light function components.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the light function atlas system. It’s directly tied to the volumetric fog rendering process.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1, indicating that by default, the light function atlas is used for local lights in volumetric fog.
r.VolumetricFog.LightFunction interacts directly with the associated variable GVolumetricFogUsesLightFunctionAtlas. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable is actually an alias for r.VolumetricFog.UsesLightFunctionAtlas. The comments in the code suggest using the latter instead of r.VolumetricFog.LightFunction.
Best practices when using this variable include:
- Use r.VolumetricFog.UsesLightFunctionAtlas instead of r.VolumetricFog.LightFunction as recommended in the code comments.
- Be aware that this setting affects performance and visual quality, so it should be adjusted based on the specific needs of the project and target hardware.
- Consider the interaction with other rendering systems like deferred lighting and Many Lights when adjusting this setting.
Regarding the associated variable GVolumetricFogUsesLightFunctionAtlas:
The purpose of GVolumetricFogUsesLightFunctionAtlas is to store the actual value that determines whether the light function atlas is used for local lights in volumetric fog rendering.
This variable is used in the Renderer module, specifically in the light function atlas and volumetric fog systems.
The value of this variable is set through the console variable system, initialized with a default value of 1.
GVolumetricFogUsesLightFunctionAtlas interacts with several other rendering systems, including deferred lighting, Many Lights system, and Lumen. Its value is checked in the BeginSceneFrame function to determine if the light function atlas should be enabled for volumetric fog.
Developers should be aware that this variable affects multiple rendering systems and can have performance implications.
Best practices for using this variable include:
- Use the console variable r.VolumetricFog.UsesLightFunctionAtlas to modify its value rather than directly changing the variable in code.
- Consider the overall performance impact when enabling or disabling this feature, especially on lower-end hardware.
- Test thoroughly with different combinations of rendering features to ensure optimal visual quality and 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:86
Scope: file
Source code excerpt:
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"),
#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());