r.Lumen.TranslucencyVolume.RadianceCache.Visualize

r.Lumen.TranslucencyVolume.RadianceCache.Visualize

#Overview

name: r.Lumen.TranslucencyVolume.RadianceCache.Visualize

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.Visualize is to enable visualization of the Translucency Volume Radiance Cache in Unreal Engine 5’s Lumen global illumination system. This setting variable is primarily used for debugging and development purposes within the rendering system.

This setting variable is relied upon by the Lumen subsystem, specifically the Translucency Volume and Radiance Cache components. It is part of the Renderer module in Unreal Engine 5.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be modified at runtime using console commands or through configuration files.

The associated variable GLumenVisualizeTranslucencyVolumeRadianceCache interacts directly with this setting. They share the same value, and GLumenVisualizeTranslucencyVolumeRadianceCache is used in the actual code logic to control the visualization.

Developers must be aware that enabling this visualization may impact performance, as it adds additional rendering passes. It should primarily be used for debugging and development purposes, not in production builds.

Best practices when using this variable include:

  1. Only enable it when needed for debugging or inspecting the Translucency Volume Radiance Cache.
  2. Disable it in production builds to avoid unnecessary performance overhead.
  3. Use it in conjunction with other Lumen debugging tools for a comprehensive understanding of the global illumination system.

Regarding the associated variable GLumenVisualizeTranslucencyVolumeRadianceCache:

The purpose of GLumenVisualizeTranslucencyVolumeRadianceCache is to serve as the internal representation of the r.Lumen.TranslucencyVolume.RadianceCache.Visualize console variable within the engine’s code.

This variable is used directly in the rendering code to determine whether to visualize the Translucency Volume Radiance Cache. It’s referenced in the Lumen subsystem, specifically in the LumenVisualizeRadianceCache.cpp file.

The value of this variable is set by the console variable system, mirroring the value of r.Lumen.TranslucencyVolume.RadianceCache.Visualize.

It interacts with other Lumen-related variables, such as GLumenTranslucencyVolume, to determine when and how to render the visualization.

Developers should be aware that this variable directly controls the visualization logic in the rendering code. Modifying it directly (rather than through the console variable) could lead to inconsistent behavior.

Best practices for this variable include:

  1. Avoid modifying it directly in code; instead, use the console variable system to ensure consistency.
  2. When debugging, check its value to confirm whether the visualization is enabled as expected.
  3. Use it in conditional statements to add or remove visualization-related code paths efficiently.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeRadianceCache.cpp:21

Scope: file

Source code excerpt:

int32 GLumenVisualizeTranslucencyVolumeRadianceCache = 0;
FAutoConsoleVariableRef CVarLumenRadianceCacheVisualizeTranslucencyVolume(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache.Visualize"),
	GLumenVisualizeTranslucencyVolumeRadianceCache,
	TEXT(""),
	ECVF_RenderThreadSafe
);

float GLumenRadianceCacheVisualizeRadiusScale = .05f;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeRadianceCache.cpp:19

Scope: file

Source code excerpt:

);

int32 GLumenVisualizeTranslucencyVolumeRadianceCache = 0;
FAutoConsoleVariableRef CVarLumenRadianceCacheVisualizeTranslucencyVolume(
	TEXT("r.Lumen.TranslucencyVolume.RadianceCache.Visualize"),
	GLumenVisualizeTranslucencyVolumeRadianceCache,
	TEXT(""),
	ECVF_RenderThreadSafe
);

float GLumenRadianceCacheVisualizeRadiusScale = .05f;
FAutoConsoleVariableRef CVarLumenRadianceCacheVisualizeRadiusScale(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeRadianceCache.cpp:109

Scope: file

Source code excerpt:

LumenRadianceCache::FRadianceCacheInputs GetFinalGatherRadianceCacheInputs(const FViewInfo& View)
{
	if (GLumenVisualizeTranslucencyVolumeRadianceCache)
	{
		return LumenTranslucencyVolumeRadianceCache::SetupRadianceCacheInputs(View);
	}
	else
	{
		if (GLumenIrradianceFieldGather)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeRadianceCache.cpp:127

Scope: file

Source code excerpt:


extern int32 GLumenTranslucencyVolume;
extern int32 GLumenVisualizeTranslucencyVolumeRadianceCache;

void FDeferredShadingSceneRenderer::RenderLumenRadianceCacheVisualization(FRDGBuilder& GraphBuilder, const FMinimalSceneTextures& SceneTextures)
{
	const FViewInfo& View = Views[0];
	const FPerViewPipelineState& ViewPipelineState = GetViewPipelineState(View);
	const bool bAnyLumenActive = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualizeRadianceCache.cpp:138

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderLumenRadianceCacheVisualization

Source code excerpt:

		&& View.ViewState
		&& bAnyLumenActive
		&& (LumenScreenProbeGather::UseRadianceCache(Views[0]) || (GLumenVisualizeTranslucencyVolumeRadianceCache && GLumenTranslucencyVolume))
		&& GLumenRadianceCacheVisualize != 0)
	{
		RDG_EVENT_SCOPE(GraphBuilder, "VisualizeLumenRadianceCache");

		const FRadianceCacheState& RadianceCacheState = GLumenVisualizeTranslucencyVolumeRadianceCache != 0 ? Views[0].ViewState->Lumen.TranslucencyVolumeRadianceCacheState : Views[0].ViewState->Lumen.RadianceCacheState;

		FRDGTextureRef SceneColor = SceneTextures.Color.Resolve;
		FRDGTextureRef SceneDepth = SceneTextures.Depth.Resolve;

		const LumenRadianceCache::FRadianceCacheInputs RadianceCacheInputs = GetFinalGatherRadianceCacheInputs(View);