r.DefaultFeature.LensFlare
r.DefaultFeature.LensFlare
#Overview
name: r.DefaultFeature.LensFlare
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Engine default (project setting) for LensFlare is (postprocess volume/camera/game setting still can override)\n 0: off, sets LensFlareIntensity to 0\n 1: on (default)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DefaultFeature.LensFlare is to control the default setting for lens flare effects in the Unreal Engine 5 rendering system. It serves as a global switch for enabling or disabling lens flare effects across the entire project.
This setting variable is primarily used by the Engine’s rendering subsystem, specifically in the post-processing pipeline. It’s referenced in the SceneView.cpp and Scene.cpp files, which are core components of the rendering system.
The value of this variable is set through a console variable (CVarDefaultLensFlare) with a default value of 0, meaning lens flare is off by default. This can be overridden in project settings, post-process volumes, camera settings, or game-specific code.
The r.DefaultFeature.LensFlare variable interacts directly with the LensFlareIntensity parameter in the FPostProcessSettings struct. When r.DefaultFeature.LensFlare is set to 0, it forces LensFlareIntensity to 0, effectively disabling lens flare effects.
Developers should be aware that this is a default setting and can be overridden in various ways. It’s important to note that lens flare effects can impact performance, so it’s turned off by default for better performance and fewer distractions.
Best practices when using this variable include:
- Consider performance implications when enabling lens flare effects.
- Use it as a project-wide default, but be prepared to override it in specific scenarios where needed.
- Be aware that post-process volumes, camera settings, or game-specific code can still enable lens flare even if this default is set to off.
Regarding the associated variable CVarDefaultLensFlare:
The purpose of CVarDefaultLensFlare is to provide a console-accessible way to control the r.DefaultFeature.LensFlare setting. It’s implemented as a TAutoConsoleVariable, which allows it to be changed at runtime through the console.
This variable is used in the Engine’s rendering subsystem, specifically in the post-processing stage of the rendering pipeline.
The value of CVarDefaultLensFlare is set to 0 by default, matching the r.DefaultFeature.LensFlare setting.
CVarDefaultLensFlare interacts directly with the FinalPostProcessSettings.LensFlareIntensity parameter. When CVarDefaultLensFlare is 0, LensFlareIntensity is set to 0 in the StartFinalPostprocessSettings function.
Developers should be aware that changes to CVarDefaultLensFlare will affect the entire project’s lens flare settings unless overridden elsewhere.
Best practices for using CVarDefaultLensFlare include:
- Use it for debugging or testing lens flare effects during development.
- Be cautious about changing it in shipping builds, as it could impact performance.
- Remember that it provides a project-wide default that can be overridden in more specific contexts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:203
Scope: file
Source code excerpt:
// off by default for better performance and less distractions
static TAutoConsoleVariable<int32> CVarDefaultLensFlare(
TEXT("r.DefaultFeature.LensFlare"),
0,
TEXT("Engine default (project setting) for LensFlare is (postprocess volume/camera/game setting still can override)\n")
TEXT(" 0: off, sets LensFlareIntensity to 0\n")
TEXT(" 1: on (default)"));
// see EAntiAliasingMethod
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:516
Scope (from outer to inner):
file
function FPostProcessSettings::FPostProcessSettings
Source code excerpt:
LocalExposureMiddleGreyBias = 0.0f;
// next value might get overwritten by r.DefaultFeature.LensFlare
LensFlareIntensity = 1.0f;
LensFlareTint = FLinearColor(1.0f, 1.0f, 1.0f);
LensFlareBokehSize = 3.0f;
LensFlareThreshold = 8.0f;
VignetteIntensity = 0.4f;
Sharpen = 0.0f;
#Associated Variable and Callsites
This variable is associated with another variable named CVarDefaultLensFlare
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:202
Scope: file
Source code excerpt:
// off by default for better performance and less distractions
static TAutoConsoleVariable<int32> CVarDefaultLensFlare(
TEXT("r.DefaultFeature.LensFlare"),
0,
TEXT("Engine default (project setting) for LensFlare is (postprocess volume/camera/game setting still can override)\n")
TEXT(" 0: off, sets LensFlareIntensity to 0\n")
TEXT(" 1: on (default)"));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:1984
Scope (from outer to inner):
file
function void FSceneView::StartFinalPostprocessSettings
Source code excerpt:
FinalPostProcessSettings.MotionBlurAmount = 0;
}
if (!CVarDefaultLensFlare.GetValueOnGameThread())
{
FinalPostProcessSettings.LensFlareIntensity = 0;
}
{
int32 Value = CVarDefaultAmbientOcclusionStaticFraction.GetValueOnGameThread();