r.ManyLights.LightFunctions
r.ManyLights.LightFunctions
#Overview
name: r.ManyLights.LightFunctions
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to support light functions.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ManyLights.LightFunctions is to control whether light functions are supported in the Many Lights rendering system within Unreal Engine 5. Light functions allow for more complex lighting effects by applying textures or materials to modify the light’s output.
This setting variable is primarily used in the rendering system, specifically within the Many Lights module. The Many Lights system is an optimization technique for handling a large number of dynamic lights efficiently.
Based on the callsites, this variable is utilized in the Renderer module, specifically in the ManyLights.cpp file. The Unreal Engine’s rendering subsystem relies on this setting variable to determine whether to enable light function support in the Many Lights system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, meaning light functions are disabled by default in the Many Lights system.
The associated variable CVarManyLightsLightFunctions directly interacts with r.ManyLights.LightFunctions. They share the same value and purpose.
Developers must be aware that enabling light functions in the Many Lights system may have performance implications. Light functions add complexity to the rendering process, so enabling this feature should be done with consideration for the target hardware and performance requirements.
Best practices when using this variable include:
- Only enable it when light functions are necessary for your scene’s lighting requirements.
- Consider the performance impact, especially on lower-end hardware.
- Use it in conjunction with other Many Lights settings for optimal performance and visual quality.
Regarding the associated variable CVarManyLightsLightFunctions:
The purpose of CVarManyLightsLightFunctions is to provide programmatic access to the r.ManyLights.LightFunctions setting within the C++ code of Unreal Engine.
This variable is used in the Renderer module, specifically in the ManyLights system. It’s used to query the current state of light function support in the IsUsingLightFunctions() function.
The value of CVarManyLightsLightFunctions is set when the r.ManyLights.LightFunctions console variable is modified.
CVarManyLightsLightFunctions interacts directly with the r.ManyLights.LightFunctions console variable, effectively serving as its C++ representation.
Developers should be aware that changes to r.ManyLights.LightFunctions will be reflected in CVarManyLightsLightFunctions, and vice versa.
Best practices for using CVarManyLightsLightFunctions include:
- Use it for runtime checks of light function support in the Many Lights system.
- Be aware that it’s accessed on the render thread, so ensure thread-safe access when necessary.
- Consider caching its value if queried frequently to avoid potential performance overhead from repeated CVar lookups.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:129
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int> CVarManyLightsLightFunctions(
TEXT("r.ManyLights.LightFunctions"),
0,
TEXT("Whether to support light functions."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int> CVarManyLightsIESProfiles(
#Associated Variable and Callsites
This variable is associated with another variable named CVarManyLightsLightFunctions
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:128
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int> CVarManyLightsLightFunctions(
TEXT("r.ManyLights.LightFunctions"),
0,
TEXT("Whether to support light functions."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:157
Scope (from outer to inner):
file
namespace ManyLights
function bool IsUsingLightFunctions
Source code excerpt:
bool IsUsingLightFunctions()
{
return IsEnabled() && CVarManyLightsLightFunctions.GetValueOnRenderThread() != 0;
}
bool IsLightSupported(uint8 LightType, ECastRayTracedShadow::Type CastRayTracedShadow)
{
if (ManyLights::IsEnabled() && LightType != LightType_Directional)
{