r.LightFunctionAtlas.Format
r.LightFunctionAtlas.Format
#Overview
name: r.LightFunctionAtlas.Format
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: grey scale in [0,1]. 1: colored in [0,1]
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LightFunctionAtlas.Format is to control the format of the Light Function Atlas in Unreal Engine’s rendering system. It determines whether the light function atlas should be rendered in grayscale or color.
This setting variable is primarily used by the rendering subsystem of Unreal Engine, specifically in the context of light functions and atlas generation.
The value of this variable is set through a console variable (CVar) named CVarLightFunctionAtlasFormat. It is defined in the RenderCore module, specifically in the RenderUtils.cpp file.
The associated variable CVarLightFunctionAtlasFormat interacts directly with r.LightFunctionAtlas.Format. It’s an instance of TAutoConsoleVariable
Developers must be aware that this variable is marked as read-only and render thread safe (ECVF_ReadOnly | ECVF_RenderThreadSafe). This means its value should not be changed during runtime, and it’s safe to access from the render thread.
Best practices when using this variable include:
- Understanding that 0 means grayscale in the range [0,1], while 1 means colored in the range [0,1].
- Setting this variable early in the application lifecycle, preferably during initialization, due to its read-only nature.
- Being aware that changing this setting may impact performance and visual quality, so thorough testing is recommended.
Regarding the associated variable CVarLightFunctionAtlasFormat:
The purpose of CVarLightFunctionAtlasFormat is to provide a programmatic interface to the r.LightFunctionAtlas.Format setting within the C++ code of Unreal Engine.
This variable is part of the RenderCore module and is used in the rendering subsystem to retrieve the current setting for the light function atlas format.
The value of CVarLightFunctionAtlasFormat is set when the console variable is initialized, with a default value of 0 (grayscale).
It interacts directly with the r.LightFunctionAtlas.Format setting, effectively serving as its in-code representation.
Developers should be aware that this variable is accessed through the GetLightFunctionAtlasFormat() function, which can be called from any thread.
Best practices for using CVarLightFunctionAtlasFormat include:
- Using the GetLightFunctionAtlasFormat() function to retrieve its value, rather than accessing it directly.
- Remembering that changes to this variable at runtime may not take effect due to its read-only nature.
- Considering the performance implications of color vs. grayscale light function atlases when deciding on a value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1654
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLightFunctionAtlasFormat(
TEXT("r.LightFunctionAtlas.Format"),
0,
TEXT("0: grey scale in [0,1]. 1: colored in [0,1]"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSingleLayerWaterUsesLightFunctionAtlas(
TEXT("r.SingleLayerWater.UsesLightFunctionAtlas"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarLightFunctionAtlasFormat
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1653
Scope: file
Source code excerpt:
}
static TAutoConsoleVariable<int32> CVarLightFunctionAtlasFormat(
TEXT("r.LightFunctionAtlas.Format"),
0,
TEXT("0: grey scale in [0,1]. 1: colored in [0,1]"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSingleLayerWaterUsesLightFunctionAtlas(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1697
Scope (from outer to inner):
file
function int32 GetLightFunctionAtlasFormat
Source code excerpt:
int32 GetLightFunctionAtlasFormat()
{
return CVarLightFunctionAtlasFormat.GetValueOnAnyThread();
}
bool GetSingleLayerWaterUsesLightFunctionAtlas()
{
return CVarSingleLayerWaterUsesLightFunctionAtlas.GetValueOnAnyThread() > 0;
}