r.Lumen.TranslucencyVolume.RadianceCache.ClipmapWorldExtent

r.Lumen.TranslucencyVolume.RadianceCache.ClipmapWorldExtent

#Overview

name: r.Lumen.TranslucencyVolume.RadianceCache.ClipmapWorldExtent

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.TranslucencyVolume.RadianceCache.ClipmapWorldExtent is to define the world space extent of the first clipmap in Lumen’s Translucency Volume Radiance Cache system. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for handling translucent objects.

This setting variable is primarily used in the Lumen subsystem within the rendering module of Unreal Engine 5. It’s referenced in the LumenTranslucencyVolumeLighting.cpp file, which is part of the Renderer module.

The value of this variable is set through an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. Its default value is 2500.0f units.

This variable interacts closely with GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase. Together, they determine the extent and distribution of clipmaps in the Radiance Cache system.

Developers should be aware that this variable directly affects the coverage and detail of the first clipmap in the Translucency Volume Radiance Cache. A larger value will cover a greater world space extent but may reduce detail for nearby objects, while a smaller value will provide more detail for nearby objects but may require more clipmaps to cover the same total distance.

Best practices when using this variable include:

  1. Adjusting it based on the scale of your scene and the importance of translucent object lighting at different distances.
  2. Balancing it with the GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase for optimal coverage and performance.
  3. Testing different values to find the best trade-off between lighting quality and performance for your specific scene.

Regarding the associated variable GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent:

This is the actual float variable that stores the value set by the console variable. It’s used directly in the code to calculate clipmap extents and set up radiance cache inputs. The purpose and considerations are the same as for the console variable. It’s important to note that modifying this variable directly in code won’t persist changes across sessions or allow for runtime adjustment like the console variable does. For most use cases, developers should interact with the console variable rather than this internal variable.

#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:164

Scope: file

Source code excerpt:

float GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent = 2500.0f;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache.ClipmapWorldExtent"),
	GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent,
	TEXT("World space extent of the first clipmap"),
	ECVF_RenderThreadSafe
);

float GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase = 2.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent = 2500.0f;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache.ClipmapWorldExtent"),
	GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent,
	TEXT("World space extent of the first clipmap"),
	ECVF_RenderThreadSafe
);

float GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase = 2.0f;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase(

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

Scope (from outer to inner):

file
namespace    LumenTranslucencyVolumeRadianceCache
function     int32 GetNumClipmaps

Source code excerpt:

		for (; ClipmapIndex < LumenRadianceCache::MaxClipmaps; ++ClipmapIndex)
		{
			const float ClipmapExtent = GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent * FMath::Pow(GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase, ClipmapIndex);

			if (ClipmapExtent > DistanceToCover)
			{
				break;
			}
		}

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

Scope (from outer to inner):

file
namespace    LumenTranslucencyVolumeRadianceCache
function     LumenRadianceCache::FRadianceCacheInputs SetupRadianceCacheInputs

Source code excerpt:

		LumenRadianceCache::FRadianceCacheInputs Parameters = LumenRadianceCache::GetDefaultRadianceCacheInputs();
		Parameters.ReprojectionRadiusScale = GTranslucencyVolumeRadianceCacheReprojectionRadiusScale;
		Parameters.ClipmapWorldExtent = GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent;
		Parameters.ClipmapDistributionBase = GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase;
		Parameters.RadianceProbeClipmapResolution = GetClipmapGridResolution();
		Parameters.ProbeAtlasResolutionInProbes = FIntPoint(GTranslucencyVolumeRadianceCacheProbeAtlasResolutionInProbes, GTranslucencyVolumeRadianceCacheProbeAtlasResolutionInProbes);
		Parameters.NumRadianceProbeClipmaps = GetNumClipmaps(LumenTranslucencyVolume::GetEndDistanceFromCamera(View));
		Parameters.RadianceProbeResolution = FMath::Max(GetProbeResolution(), LumenRadianceCache::MinRadianceProbeResolution);
		Parameters.FinalProbeResolution = GetFinalProbeResolution();