r.Lumen.TranslucencyVolume.TraceFromVolume

r.Lumen.TranslucencyVolume.TraceFromVolume

#Overview

name: r.Lumen.TranslucencyVolume.TraceFromVolume

The value of this variable can be defined or overridden in .ini config files. 3 .ini config files referencing this setting variable.

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

Certainly! I’ll walk you through the r.Lumen.TranslucencyVolume.TraceFromVolume setting variable and its associated variable GLumenTranslucencyVolumeTraceFromVolume.

r.Lumen.TranslucencyVolume.TraceFromVolume

  1. Purpose: This setting variable is used to control whether ray tracing should be performed from the translucency volume’s voxels to gather indirect lighting in Unreal Engine 5’s Lumen global illumination system.

  2. Subsystem: This variable is part of the Lumen rendering system, specifically the translucency volume lighting module.

  3. Value setting: The value is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through the console. It’s initialized with a default value of 1 (enabled).

  4. Interacting variables: It directly interacts with GLumenTranslucencyVolumeTraceFromVolume, which is the C++ variable that holds the actual value.

  5. Special considerations:

    • This setting only makes sense to disable if TranslucencyVolume.RadianceCache is enabled.
    • It affects shader permutations and can impact performance and visual quality.
  6. Best practices:

    • Keep this enabled unless you’re specifically using the Radiance Cache for translucency volume lighting.
    • Monitor performance impact when toggling this setting, as ray tracing can be computationally expensive.

GLumenTranslucencyVolumeTraceFromVolume

  1. Purpose: This is the C++ variable that actually holds the value controlled by the r.Lumen.TranslucencyVolume.TraceFromVolume console variable.

  2. Subsystem: Same as the console variable, it’s part of the Lumen rendering system’s translucency volume lighting module.

  3. Value setting: Its value is set by the console variable system when r.Lumen.TranslucencyVolume.TraceFromVolume is modified.

  4. Usage in code:

    • It’s used to determine whether to perform ray tracing from the translucency volume’s voxels.
    • It affects shader permutations in the TraceVoxelsTranslucencyVolume function.
    • It’s also used as a condition for hardware ray tracing in the ComputeLumenTranslucencyGIVolume function.
  5. Special considerations:

    • The variable is checked using != 0, so any non-zero value will enable the feature.
    • It affects multiple parts of the rendering pipeline, including both software and hardware ray tracing paths.
  6. Best practices:

    • When modifying this variable directly in C++ code (which should be rare), ensure you understand the implications on the entire rendering pipeline.
    • Use the console variable r.Lumen.TranslucencyVolume.TraceFromVolume to modify this value during runtime for testing and debugging.

In summary, these variables control an important aspect of Lumen’s translucency lighting system. They determine whether ray tracing should be performed from the translucency volume’s voxels, which can significantly impact both visual quality and performance. Developers should be cautious when modifying these settings and always consider the performance implications, especially on lower-end hardware.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:288, section: [GlobalIlluminationQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:311, section: [GlobalIlluminationQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:335, section: [GlobalIlluminationQuality@Cine]

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

Scope: file

Source code excerpt:

int32 GLumenTranslucencyVolumeTraceFromVolume = 1;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeTraceFromVolume(
	TEXT("r.Lumen.TranslucencyVolume.TraceFromVolume"),
	GLumenTranslucencyVolumeTraceFromVolume,
	TEXT("Whether to ray trace from the translucency volume's voxels to gather indirect lighting.  Only makes sense to disable if TranslucencyVolume.RadianceCache is enabled."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GTranslucencyFroxelGridPixelSize = 32;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenTranslucencyVolumeTraceFromVolume = 1;
FAutoConsoleVariableRef CVarLumenTranslucencyVolumeTraceFromVolume(
	TEXT("r.Lumen.TranslucencyVolume.TraceFromVolume"),
	GLumenTranslucencyVolumeTraceFromVolume,
	TEXT("Whether to ray trace from the translucency volume's voxels to gather indirect lighting.  Only makes sense to disable if TranslucencyVolume.RadianceCache is enabled."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GTranslucencyFroxelGridPixelSize = 32;
FAutoConsoleVariableRef CVarTranslucencyFroxelGridPixelSize(

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

Scope (from outer to inner):

file
function     void TraceVoxelsTranslucencyVolume

Source code excerpt:

	PassParameters->TraceSetupParameters = TraceSetupParameters;

	const bool bTraceFromVolume = GLumenTranslucencyVolumeTraceFromVolume != 0;

	FTranslucencyVolumeTraceVoxelsCS::FPermutationDomain PermutationVector;
	PermutationVector.Set<FTranslucencyVolumeTraceVoxelsCS::FDynamicSkyLight>(bDynamicSkyLight);
	PermutationVector.Set<FTranslucencyVolumeTraceVoxelsCS::FRadianceCache>(RadianceCacheParameters.RadianceProbeIndirectionTexture != nullptr);
	PermutationVector.Set<FTranslucencyVolumeTraceVoxelsCS::FTraceFromVolume>(bTraceFromVolume);
	PermutationVector.Set<FTranslucencyVolumeTraceVoxelsCS::FSimpleCoverageBasedExpand>(bTraceFromVolume && Lumen::UseGlobalSDFSimpleCoverageBasedExpand());

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::ComputeLumenTranslucencyGIVolume

Source code excerpt:

			FRDGTextureRef VolumeTraceHitDistance = GraphBuilder.CreateTexture(VolumeTraceHitDistanceDesc, TEXT("Lumen.TranslucencyVolume.VolumeTraceHitDistance"));

			if (Lumen::UseHardwareRayTracedTranslucencyVolume(ViewFamily) && GLumenTranslucencyVolumeTraceFromVolume != 0)
			{
				HardwareRayTraceTranslucencyVolume(
					GraphBuilder,
					View,
					TracingParameters,
					RadianceCacheParameters,