r.Translucent.UsesLightFunctionAtlas
r.Translucent.UsesLightFunctionAtlas
#Overview
name: r.Translucent.UsesLightFunctionAtlas
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable sampling of the light function atlas on translucent materials using forward shading.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Translucent.UsesLightFunctionAtlas is to enable or disable sampling of the light function atlas on translucent materials using forward shading in Unreal Engine’s rendering system.
This setting variable is primarily used by Unreal Engine’s rendering subsystem, specifically for handling translucent materials and light functions. It’s part of the RenderCore module, as evidenced by its location in the RenderCore/Private/RenderUtils.cpp file.
The value of this variable is set through a console variable (CVar) system. It’s 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 CVarTranslucentUsesLightFunctionAtlas directly interacts with r.Translucent.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 it can’t be changed during gameplay and is safe to read from the render thread.
Best practices when using this variable include:
- Only enable it when you specifically need light function atlas sampling for translucent materials.
- Be aware of potential performance implications, as enabling this feature may increase rendering overhead.
- Test thoroughly with both enabled and disabled states to ensure your game performs well in both scenarios.
Regarding the associated variable CVarTranslucentUsesLightFunctionAtlas:
Its purpose is identical to r.Translucent.UsesLightFunctionAtlas - it controls the sampling of the light function atlas on translucent materials using forward shading.
This variable is used in the GetTranslucentUsesLightFunctionAtlas() function, which likely serves as a convenient way for other parts of the engine to check if this feature is enabled.
The value of CVarTranslucentUsesLightFunctionAtlas is set through the same CVar system as r.Translucent.UsesLightFunctionAtlas.
Developers should be aware that this variable is accessed using GetValueOnAnyThread(), which suggests it’s designed to be safely read from any thread.
Best practices for CVarTranslucentUsesLightFunctionAtlas are the same as for r.Translucent.UsesLightFunctionAtlas, given they serve the same purpose and share the same 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:1666
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTranslucentUsesLightFunctionAtlas(
TEXT("r.Translucent.UsesLightFunctionAtlas"),
0,
TEXT("Enable sampling of the light function atlas on translucent materials using forward shading."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighTranslucent(
TEXT("r.Translucent.UsesRectLights"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarTranslucentUsesLightFunctionAtlas
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1665
Scope: file
Source code excerpt:
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarTranslucentUsesLightFunctionAtlas(
TEXT("r.Translucent.UsesLightFunctionAtlas"),
0,
TEXT("Enable sampling of the light function atlas on translucent materials using forward shading."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighTranslucent(
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1707
Scope (from outer to inner):
file
function bool GetTranslucentUsesLightFunctionAtlas
Source code excerpt:
bool GetTranslucentUsesLightFunctionAtlas()
{
return CVarTranslucentUsesLightFunctionAtlas.GetValueOnAnyThread() > 0;
}
bool GetTranslucentUsesLightRectLights()
{
return CVarRectLighTranslucent.GetValueOnAnyThread() > 0;
}