r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps

r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps

#Overview

name: r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps

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.ScreenProbeGather.RadianceCache.NumClipmaps is to control the number of radiance cache clipmaps used in Unreal Engine 5’s Lumen global illumination system. This setting variable is specifically related to the Screen Probe Gather component of Lumen, which is part of the rendering system.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in the LumenScreenProbeGather.cpp file, which suggests it’s closely tied to the screen probe gathering process in Lumen.

The value of this variable is set through a console variable system. It’s initialized with a default value of 4 and can be changed at runtime using the console command system.

The variable interacts directly with its associated variable GRadianceCacheNumClipmaps. They share the same value, with GRadianceCacheNumClipmaps being the actual variable used in the code, while r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps is the console variable name used for external access and modification.

Developers should be aware that this variable affects the number of clipmaps used in the radiance cache, which can impact both rendering quality and performance. Increasing the number of clipmaps can potentially improve the quality of global illumination at the cost of increased memory usage and computational overhead.

Best practices when using this variable include:

  1. Balancing quality and performance needs when adjusting the value.
  2. Testing thoroughly after changes to ensure desired visual results and acceptable performance.
  3. Being mindful of the hardware capabilities of target platforms, as higher values may not be suitable for all systems.

Regarding the associated variable GRadianceCacheNumClipmaps:

The purpose of GRadianceCacheNumClipmaps is to store and provide access to the number of radiance cache clipmaps within the C++ code of the Lumen system.

This variable is used directly in the Lumen rendering subsystem, specifically in the Screen Probe Gather component.

Its value is set by the console variable r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps and is used in various functions within the LumenScreenProbeGatherRadianceCache namespace.

GRadianceCacheNumClipmaps interacts with other parts of the system, such as in the GetNumClipmaps() function where it’s clamped between 1 and LumenRadianceCache::MaxClipmaps, and in GetProbeIndirectionTextureSize() where it’s used to calculate texture dimensions.

Developers should be aware that this variable directly affects the behavior of the radiance cache system and should be handled with care when modifying or accessing it in custom code.

Best practices include using the provided functions like GetNumClipmaps() instead of accessing GRadianceCacheNumClipmaps directly, as these functions may include additional logic or clamping.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GRadianceCacheNumClipmaps = 4;
FAutoConsoleVariableRef CVarRadianceCacheNumClipmaps(
	TEXT("r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps"),
	GRadianceCacheNumClipmaps,
	TEXT("Number of radiance cache clipmaps."),
	ECVF_RenderThreadSafe
);

float GLumenRadianceCacheClipmapWorldExtent = 2500.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

}

int32 GRadianceCacheNumClipmaps = 4;
FAutoConsoleVariableRef CVarRadianceCacheNumClipmaps(
	TEXT("r.Lumen.ScreenProbeGather.RadianceCache.NumClipmaps"),
	GRadianceCacheNumClipmaps,
	TEXT("Number of radiance cache clipmaps."),
	ECVF_RenderThreadSafe
);

float GLumenRadianceCacheClipmapWorldExtent = 2500.0f;
FAutoConsoleVariableRef CVarLumenRadianceCacheClipmapWorldExtent(

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

Scope (from outer to inner):

file
namespace    LumenScreenProbeGatherRadianceCache
function     int32 GetNumClipmaps

Source code excerpt:

	int32 GetNumClipmaps()
	{
		return FMath::Clamp(GRadianceCacheNumClipmaps, 1, LumenRadianceCache::MaxClipmaps);
	}

	int32 GetClipmapGridResolution()
	{
		const int32 GridResolution = GRadianceCacheGridResolution / (GLumenFastCameraMode ? 2 : 1);
		return FMath::Clamp(GridResolution, 1, 256);

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

Scope (from outer to inner):

file
namespace    LumenScreenProbeGatherRadianceCache
function     FIntVector GetProbeIndirectionTextureSize

Source code excerpt:

	FIntVector GetProbeIndirectionTextureSize()
	{
		return FIntVector(GetClipmapGridResolution() * GRadianceCacheNumClipmaps, GetClipmapGridResolution(), GetClipmapGridResolution());
	}

	FIntPoint GetProbeAtlasTextureSize()
	{
		return FIntPoint(GRadianceCacheProbeAtlasResolutionInProbes * GetProbeResolution());
	}