r.LensFlareQuality

r.LensFlareQuality

#Overview

name: r.LensFlareQuality

The value of this variable can be defined or overridden in .ini config files. 13 .ini config files referencing this setting variable.

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.LensFlareQuality is to control the quality of lens flare effects in the rendering system of Unreal Engine 5. It allows developers to adjust the trade-off between visual quality and performance for lens flare rendering.

This setting variable is primarily used by the rendering subsystem, specifically in the post-processing stage for lens flare effects. It is referenced in the PostProcessLensFlares.cpp file, which is part of the Renderer module.

The value of this variable is set through a console variable (CVarLensFlareQuality) with a default value of 2. It can be changed at runtime or through configuration files.

The associated variable CVarLensFlareQuality directly interacts with r.LensFlareQuality. They share the same value and purpose.

Developers should be aware that this variable offers four quality levels: 0: Disabled (best performance) 1: Low quality (good performance) 2: Good quality (default) 3: Very good quality (worst performance)

When using this variable, developers should consider the following best practices:

  1. Balance quality and performance based on target hardware and project requirements.
  2. Use lower quality settings for less powerful devices or when performance is critical.
  3. Consider exposing this setting to end-users for customization, especially in PC games.
  4. Test the visual impact and performance implications of different quality levels in various scenarios.

Regarding the associated variable CVarLensFlareQuality:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:397, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:417, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:450, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:485, section: [PostProcessQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:523, section: [PostProcessQuality@Cine]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:96, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:106, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:116, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:126, section: [PostProcessQuality@3]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:96, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:106, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:116, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:126, section: [PostProcessQuality@3]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessLensFlares.cpp:17

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarLensFlareQuality(
	TEXT("r.LensFlareQuality"),
	2,
	TEXT(" 0: off but best for performance\n")
	TEXT(" 1: low quality with good performance\n")
	TEXT(" 2: good quality (default)\n")
	TEXT(" 3: very good quality but bad performance"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

#Associated Variable and Callsites

This variable is associated with another variable named CVarLensFlareQuality. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessLensFlares.cpp:16

Scope: file

Source code excerpt:

const int32 GLensFlareQuadsPerInstance = 4;

TAutoConsoleVariable<int32> CVarLensFlareQuality(
	TEXT("r.LensFlareQuality"),
	2,
	TEXT(" 0: off but best for performance\n")
	TEXT(" 1: low quality with good performance\n")
	TEXT(" 2: good quality (default)\n")
	TEXT(" 3: very good quality but bad performance"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessLensFlares.cpp:122

Scope (from outer to inner):

file
function     GetLensFlareQuality

Source code excerpt:

{
	return static_cast<ELensFlareQuality>(FMath::Clamp(
		CVarLensFlareQuality.GetValueOnRenderThread(),
		static_cast<int32>(ELensFlareQuality::Disabled),
		static_cast<int32>(ELensFlareQuality::MAX) - 1));
}

FScreenPassTexture AddLensFlaresPass(
	FRDGBuilder& GraphBuilder,