r.SingleLayerWater.UsesLightFunctionAtlas
r.SingleLayerWater.UsesLightFunctionAtlas
#Overview
name: r.SingleLayerWater.UsesLightFunctionAtlas
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable sampling of the light function atlas on SingleLAyer Water mateirals.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SingleLayerWater.UsesLightFunctionAtlas is to control whether single-layer water materials in Unreal Engine 5 use the light function atlas for rendering. This setting is part of the rendering system, specifically related to water rendering and lighting.
This setting variable is primarily used in the RenderCore module of Unreal Engine 5, as evidenced by its declaration in the RenderUtils.cpp file.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 0, meaning it’s disabled by default. Developers can change this value at runtime using console commands or through project settings.
The associated variable CVarSingleLayerWaterUsesLightFunctionAtlas directly interacts with r.SingleLayerWater.UsesLightFunctionAtlas. They share the same value and purpose.
Developers must be aware that this variable is marked as ECVF_ReadOnly and ECVF_RenderThreadSafe. This means that while it can be read from any thread, it should only be modified in specific circumstances, likely during engine initialization or through dedicated configuration systems.
Best practices when using this variable include:
- Only enable it when necessary, as it may have performance implications.
- Test thoroughly when enabled to ensure it doesn’t negatively impact visual quality or performance.
- Consider its interaction with other water and lighting settings in the engine.
Regarding the associated variable CVarSingleLayerWaterUsesLightFunctionAtlas:
Its purpose is identical to r.SingleLayerWater.UsesLightFunctionAtlas, serving as the internal representation of the console variable.
It is used in the RenderCore module, specifically in the GetSingleLayerWaterUsesLightFunctionAtlas() function, which likely provides an interface for other parts of the engine to query this setting.
The value is set through the CVar system, initialized to 0 by default.
Developers should be aware that this variable is accessed using GetValueOnAnyThread(), indicating it’s designed for multi-threaded environments.
Best practices include using the provided getter function (GetSingleLayerWaterUsesLightFunctionAtlas()) to access this value rather than directly accessing the CVar, as this provides a layer of abstraction and potential for future optimization or changes in implementation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1660
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSingleLayerWaterUsesLightFunctionAtlas(
TEXT("r.SingleLayerWater.UsesLightFunctionAtlas"),
0,
TEXT("Enable sampling of the light function atlas on SingleLAyer Water mateirals."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarTranslucentUsesLightFunctionAtlas(
TEXT("r.Translucent.UsesLightFunctionAtlas"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSingleLayerWaterUsesLightFunctionAtlas
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1659
Scope: file
Source code excerpt:
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSingleLayerWaterUsesLightFunctionAtlas(
TEXT("r.SingleLayerWater.UsesLightFunctionAtlas"),
0,
TEXT("Enable sampling of the light function atlas on SingleLAyer Water mateirals."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarTranslucentUsesLightFunctionAtlas(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1702
Scope (from outer to inner):
file
function bool GetSingleLayerWaterUsesLightFunctionAtlas
Source code excerpt:
bool GetSingleLayerWaterUsesLightFunctionAtlas()
{
return CVarSingleLayerWaterUsesLightFunctionAtlas.GetValueOnAnyThread() > 0;
}
bool GetTranslucentUsesLightFunctionAtlas()
{
return CVarTranslucentUsesLightFunctionAtlas.GetValueOnAnyThread() > 0;
}