r.Lumen.TranslucencyVolume.RadianceCache

r.Lumen.TranslucencyVolume.RadianceCache

#Overview

name: r.Lumen.TranslucencyVolume.RadianceCache

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.TranslucencyVolume.RadianceCache is to control whether the Radiance Cache is used for translucency in Lumen, Unreal Engine 5’s global illumination system. This setting is specifically related to the rendering of translucent objects within the Lumen lighting system.

The Lumen subsystem within Unreal Engine’s rendering module relies on this setting variable. It is primarily used in the translucency volume lighting calculations, which are part of the global illumination solution.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime.

The associated variable GLumenTranslucencyVolumeRadianceCache interacts directly with this setting. They share the same value, with GLumenTranslucencyVolumeRadianceCache being the actual variable used in the C++ code to control the behavior.

Developers should be aware that:

  1. This setting affects the performance and quality of translucency rendering in scenes using Lumen.
  2. Enabling this (value 1) uses the Radiance Cache for translucency, which can improve performance but might have some quality trade-offs.
  3. Disabling this (value 0) might provide higher quality results but at the cost of performance.

Best practices when using this variable include:

  1. Test your scenes with this setting both enabled and disabled to find the best balance between performance and visual quality.
  2. Consider disabling it for scenes where translucency quality is critical and performance allows.
  3. Keep it enabled for most scenarios to benefit from the performance optimization of the Radiance Cache.

Regarding the associated variable GLumenTranslucencyVolumeRadianceCache:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GLumenTranslucencyVolumeRadianceCache = 1;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCache(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache"),
	GLumenTranslucencyVolumeRadianceCache,
	TEXT("Whether to use the Radiance Cache for Translucency"),
	ECVF_RenderThreadSafe
	);

int32 GTranslucencyVolumeRadianceCacheNumMipmaps = 3;

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::PrepareLumenHardwareRayTracingTranslucencyVolumeLumenMaterial

Source code excerpt:

	if (Lumen::UseHardwareRayTracedTranslucencyVolume(*View.Family))
	{
		extern int32 GLumenTranslucencyVolumeRadianceCache;

		FLumenTranslucencyVolumeHardwareRayTracingRGS::FPermutationDomain PermutationVector;
		PermutationVector.Set<FLumenTranslucencyVolumeHardwareRayTracingRGS::FRadianceCache>(GLumenTranslucencyVolumeRadianceCache != 0);
		TShaderRef<FLumenTranslucencyVolumeHardwareRayTracingRGS> RayGenerationShader = View.ShaderMap->GetShader<FLumenTranslucencyVolumeHardwareRayTracingRGS>(PermutationVector);

		OutRayGenShaders.Add(RayGenerationShader.GetRayTracingShader());
	}
}

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

Scope: file

Source code excerpt:

	);

int32 GLumenTranslucencyVolumeRadianceCache = 1;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCache(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache"),
	GLumenTranslucencyVolumeRadianceCache,
	TEXT("Whether to use the Radiance Cache for Translucency"),
	ECVF_RenderThreadSafe
	);

int32 GTranslucencyVolumeRadianceCacheNumMipmaps = 3;
FAutoConsoleVariableRef CVarTranslucencyVolumeRadianceCacheNumMipmaps(

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

Scope (from outer to inner):

file
function     LumenRadianceCache::FUpdateInputs FDeferredShadingSceneRenderer::GetLumenTranslucencyGIVolumeRadianceCacheInputs

Source code excerpt:

	FMarkUsedRadianceCacheProbes MarkUsedRadianceCacheProbesCallbacks;

	if (GLumenTranslucencyVolume && GLumenTranslucencyVolumeRadianceCache)
	{
		MarkUsedRadianceCacheProbesCallbacks.AddLambda([VolumeParameters, ComputePassFlags](
			FRDGBuilder& GraphBuilder, 
			const FViewInfo& View, 
			const LumenRadianceCache::FRadianceCacheMarkParameters& RadianceCacheMarkParameters)
			{

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::ComputeLumenTranslucencyGIVolume

Source code excerpt:

		RDG_EVENT_SCOPE(GraphBuilder, "TranslucencyVolumeLighting");

		if (GLumenTranslucencyVolumeRadianceCache && !RadianceCacheParameters.RadianceProbeIndirectionTexture)
		{
			LumenRadianceCache::TInlineArray<LumenRadianceCache::FUpdateInputs> InputArray;
			LumenRadianceCache::TInlineArray<LumenRadianceCache::FUpdateOutputs> OutputArray;

			LumenRadianceCache::FUpdateInputs TranslucencyVolumeRadianceCacheUpdateInputs = GetLumenTranslucencyGIVolumeRadianceCacheInputs(
				GraphBuilder,