r.Lumen.Reflections.RadianceCache

r.Lumen.Reflections.RadianceCache

#Overview

name: r.Lumen.Reflections.RadianceCache

The value of this variable can be defined or overridden in .ini config files. 3 .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.Lumen.Reflections.RadianceCache is to control whether Lumen’s ScreenProbeGather Radiance Cache is used for reflection calculations in the Unreal Engine 5 rendering system. This setting is specifically related to the Lumen global illumination and reflection system.

The Unreal Engine subsystem that relies on this setting variable is the Lumen Reflections system, which is part of the rendering module. This can be seen from the file location (LumenReflections.cpp) and the context of the code.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.

The associated variable that interacts with r.Lumen.Reflections.RadianceCache is GLumenReflectionsUseRadianceCache. This is an internal integer variable that directly reflects the state of the console variable.

Developers must be aware that enabling this variable can potentially improve performance by shortening reflection rays from rough surfaces and using interpolated distant lighting from the Radiance Cache. However, this may come at the cost of some accuracy in reflections.

Best practices when using this variable include:

  1. Testing the visual quality and performance impact in various scenes before enabling it globally.
  2. Considering the trade-off between performance and accuracy based on the specific needs of the project.
  3. Being aware that this setting might interact with other Lumen and reflection-related settings.

Regarding the associated variable GLumenReflectionsUseRadianceCache:

The purpose of GLumenReflectionsUseRadianceCache is to serve as an internal representation of the r.Lumen.Reflections.RadianceCache console variable. It’s used within the C++ code to quickly check whether the Radiance Cache should be used for reflections.

This variable is part of the Lumen Reflections system in the rendering module of Unreal Engine 5.

The value of GLumenReflectionsUseRadianceCache is set automatically by the console variable system when r.Lumen.Reflections.RadianceCache is modified.

It interacts directly with r.Lumen.Reflections.RadianceCache, effectively mirroring its value.

Developers should be aware that this is an internal variable and should not be modified directly. Instead, they should use the r.Lumen.Reflections.RadianceCache console variable to control this feature.

Best practices for GLumenReflectionsUseRadianceCache include:

  1. Using it for conditional logic in rendering code related to Lumen reflections.
  2. Avoiding direct modification of this variable, as it’s managed by the console variable system.
  3. Being aware of its usage in performance-critical sections of the rendering code.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultScalability.ini:57, section: [ReflectionQuality@2]

Location: <Workspace>/Projects/Lyra/Config/DefaultScalability.ini:62, section: [ReflectionQuality@3]

Location: <Workspace>/Projects/Lyra/Config/DefaultScalability.ini:67, section: [ReflectionQuality@Cine]

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GLumenReflectionsUseRadianceCache = 0;
FAutoConsoleVariableRef CVarLumenReflectionsUseRadianceCache(
	TEXT("r.Lumen.Reflections.RadianceCache"),
	GLumenReflectionsUseRadianceCache,
	TEXT("Whether to reuse Lumen's ScreenProbeGather Radiance Cache, when it is available.  When enabled, reflection rays from rough surfaces are shortened and distant lighting comes from interpolating from the Radiance Cache, speeding up traces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReflectionRadianceCacheAngleThresholdScale = 1.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenReflectionsUseRadianceCache = 0;
FAutoConsoleVariableRef CVarLumenReflectionsUseRadianceCache(
	TEXT("r.Lumen.Reflections.RadianceCache"),
	GLumenReflectionsUseRadianceCache,
	TEXT("Whether to reuse Lumen's ScreenProbeGather Radiance Cache, when it is available.  When enabled, reflection rays from rough surfaces are shortened and distant lighting comes from interpolating from the Radiance Cache, speeding up traces."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenReflectionRadianceCacheAngleThresholdScale = 1.0f;
FAutoConsoleVariableRef CVarLumenReflectionRadianceCacheAngleThresholdScale(

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

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:

	}

	const bool bUseRadianceCache = GLumenReflectionsUseRadianceCache != 0 && RadianceCacheParameters.RadianceProbeIndirectionTexture != nullptr;

	{
		FReflectionGenerateRaysCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FReflectionGenerateRaysCS::FParameters>();
		PassParameters->RWRayBuffer = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ReflectionTracingParameters.RayBuffer));
		PassParameters->RWDownsampledDepth = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ReflectionTracingParameters.DownsampledDepth));
		PassParameters->RWRayTraceDistance = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ReflectionTracingParameters.RayTraceDistance));