r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase

r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase

#Overview

name: r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase

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.ClipmapDistributionBase is to control the size distribution of successive clipmaps in the Lumen Translucency Volume Radiance Cache system. This setting variable 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 Translucency Volume Lighting module, which is part of the Renderer subsystem in Unreal Engine 5. It’s utilized in the LumenTranslucencyVolumeLighting.cpp file.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. Its default value is 2.0f.

This variable interacts closely with GLumenTranslucencyVolumeRadianceCacheClipmapWorldExtent to determine the extent of each clipmap in the radiance cache. It’s used in calculations to determine the number of clipmaps needed and to set up radiance cache inputs.

Developers should be aware that this variable affects the distribution of clipmap sizes in the radiance cache. A higher value will result in a more rapid increase in clipmap sizes, while a lower value will lead to a more gradual increase. This can impact both performance and visual quality of translucent object lighting.

Best practices when using this variable include:

  1. Adjusting it in conjunction with other related variables to find the optimal balance between performance and visual quality.
  2. Testing different values in various scenes to understand its impact on your specific use case.
  3. Being cautious about setting extremely high or low values, as they might lead to undesirable results.

Regarding the associated variable GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase:

The purpose of GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase is to store the value of the r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase console variable in the C++ code.

This variable is used directly in the Lumen Translucency Volume Lighting module’s calculations. It’s referenced when determining the extent of each clipmap and when setting up radiance cache inputs.

The value of this variable is set by the FAutoConsoleVariableRef, which binds it to the console variable r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase.

This variable interacts with other variables in the module, particularly in calculations involving clipmap extents and radiance cache setup.

Developers should be aware that modifying this variable directly in the code (rather than through the console variable) could lead to inconsistencies. It’s best to treat it as read-only in most cases and modify the value through the console variable instead.

Best practices for this variable are similar to those for the console variable it’s associated with. Developers should primarily interact with the console variable rather than this C++ variable directly, unless they have a specific reason to modify the engine’s behavior at a lower level.

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

Scope: file

Source code excerpt:

float GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase = 2.0f;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase"),
	GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase,
	TEXT("Base of the Pow() that controls the size of each successive clipmap relative to the first."),
	ECVF_RenderThreadSafe
);

int32 GTranslucencyVolumeRadianceCacheNumProbesToTraceBudget = 200;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase = 2.0f;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache.ClipmapDistributionBase"),
	GLumenTranslucencyVolumeRadianceCacheClipmapDistributionBase,
	TEXT("Base of the Pow() that controls the size of each successive clipmap relative to the first."),
	ECVF_RenderThreadSafe
);

int32 GTranslucencyVolumeRadianceCacheNumProbesToTraceBudget = 200;
FAutoConsoleVariableRef CVarTranslucencyVolumeRadianceCacheNumProbesToTraceBudget(

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

Scope (from outer to inner):

file
namespace    LumenTranslucencyVolumeRadianceCache
function     LumenRadianceCache::FRadianceCacheInputs SetupRadianceCacheInputs

Source code excerpt:

		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();
		Parameters.FinalRadianceAtlasMaxMip = GetNumMipmaps() - 1;