r.Lumen.Supported

r.Lumen.Supported

#Overview

name: r.Lumen.Supported

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.Supported is to control whether Lumen, a global illumination and reflections system, is supported for the project, regardless of the platform. This setting variable is primarily used in the rendering system of Unreal Engine 5.

Based on the callsites, the Renderer, ShaderCompiler, Landscape, and RenderCore subsystems rely on this setting variable. It’s particularly important for the Lumen global illumination system and affects shader compilation and landscape rendering.

The value of this variable is set as a console variable, which means it can be changed at runtime or set in configuration files. It’s initialized with a default value of 1 (enabled) in the Lumen.cpp file.

This variable interacts with other Lumen-related variables, such as r.Lumen.DiffuseIndirect.Allow, and affects the behavior of functions like DoesPlatformSupportLumenGI.

Developers must be aware that changing this variable can have significant impacts on rendering performance and visual quality. Setting it to 0 will disable Lumen for the entire project, which can affect load times and shader compilation.

Best practices when using this variable include:

  1. Only disable it if you’re certain you don’t want to use Lumen in your project at all, as it can help reduce compile times and load overhead.
  2. Be consistent with its usage across different configuration files and runtime settings to avoid unexpected behavior.
  3. Consider the implications on other systems that depend on Lumen when modifying this variable.
  4. Use it in conjunction with platform-specific checks to ensure proper functionality across different hardware configurations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:11

Scope: file

Source code excerpt:

int32 GLumenSupported = 1;
FAutoConsoleVariableRef CVarLumenSupported(
	TEXT("r.Lumen.Supported"),
	GLumenSupported,
	TEXT("Whether Lumen is supported at all for the project, regardless of platform.  This can be used to avoid compiling shaders and other load time overhead."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenAsyncCompute(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8559

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Lumen.Supported"));
		const bool bLumenSupported = CVar->GetInt() != 0;
		SET_SHADER_DEFINE(Input.Environment, PROJECT_SUPPORTS_LUMEN, bLumenSupported ? 1 : 0);
	}

	{
		const bool bSupportOIT = FDataDrivenShaderPlatformInfo::GetSupportsOIT(EShaderPlatform(Target.Platform));

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeCulling.cpp:158

Scope (from outer to inner):

file
namespace    UE::Landscape::Culling
function     FLumenCVarsState

Source code excerpt:

	FLumenCVarsState()
	{
		IConsoleVariable* SupportedCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Lumen.Supported"));
		bLumenSupported = (SupportedCVar && SupportedCVar->GetInt() != 0);
		
		IConsoleVariable* DiffuseIndirectCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Lumen.DiffuseIndirect.Allow"));
		if (bLumenSupported && DiffuseIndirectCVar)
		{
			DiffuseIndirectCVar->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&LandscapeComponentsRecreateRenderState));

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:2010

Scope (from outer to inner):

file
function     bool DoesPlatformSupportLumenGI

Source code excerpt:

bool DoesPlatformSupportLumenGI(EShaderPlatform Platform, bool bSkipProjectCheck)
{
	static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Lumen.Supported"));
	const bool bLumenSupported = CVar->GetInt() != 0;

	return (bSkipProjectCheck || bLumenSupported)
		&& FDataDrivenShaderPlatformInfo::GetSupportsLumenGI(Platform)
		&& !IsForwardShadingEnabled(Platform);
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:3981

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

						if (bLumenEnabledButDisabledForTheProject)
						{
							static const FText Message = NSLOCTEXT("Renderer", "LumenDisabledForProject", "Lumen is enabled but cannot render, because the project has Lumen disabled in an ini (r.Lumen.Supported = 0)");
							Writer.DrawLine(Message);
						}

						if (bNaniteEnabledButNoAtomics)
						{
							FString NaniteError = TEXT("Nanite is used in the scene but not supported by your graphics hardware and/or driver. Meshes will not render using Nanite.");