r.Lumen.TranslucencyVolume.TracingOctahedronResolution

r.Lumen.TranslucencyVolume.TracingOctahedronResolution

#Overview

name: r.Lumen.TranslucencyVolume.TracingOctahedronResolution

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

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.TracingOctahedronResolution is to control the resolution of the tracing octahedron in Unreal Engine 5’s Lumen translucency volume lighting system. This setting determines how many traces are performed per voxel of the translucency lighting volume, affecting the quality and performance of volumetric lighting effects.

This setting variable is primarily used in the Lumen subsystem, specifically for translucency volume lighting. It’s part of the rendering module in Unreal Engine 5.

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

The associated variable GTranslucencyVolumeTracingOctahedronResolution directly interacts with r.Lumen.TranslucencyVolume.TracingOctahedronResolution. They share the same value, with GTranslucencyVolumeTracingOctahedronResolution being the internal representation used in the C++ code.

Developers should be aware that:

  1. This variable affects both quality and performance. Higher values will increase the quality of volumetric lighting but at the cost of performance.
  2. It’s marked with ECVF_Scalability, indicating it’s intended to be adjusted for different quality settings.
  3. It’s also marked as ECVF_RenderThreadSafe, meaning it can be changed safely from the render thread.

Best practices when using this variable include:

  1. Adjusting it based on the target hardware and desired quality level.
  2. Testing different values to find the optimal balance between visual quality and performance for your specific use case.
  3. Considering expose it as a user-configurable setting for end-users to adjust based on their hardware capabilities.

Regarding the associated variable GTranslucencyVolumeTracingOctahedronResolution:

#Setting Variables

#References In INI files

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

Location: <Workspace>/Engine/Config/BaseScalability.ini:336, 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:124

Scope: file

Source code excerpt:

int32 GTranslucencyVolumeTracingOctahedronResolution = 3;
FAutoConsoleVariableRef CVarTranslucencyVolumeTracingOctahedronResolution(
	TEXT("r.Lumen.TranslucencyVolume.TracingOctahedronResolution"),
	GTranslucencyVolumeTracingOctahedronResolution,
	TEXT("Resolution of the tracing octahedron.  Determines how many traces are done per voxel of the translucency lighting volume."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GTranslucencyVolumeVoxelTraceStartDistanceScale = 1.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

int32 GTranslucencyVolumeTracingOctahedronResolution = 3;
FAutoConsoleVariableRef CVarTranslucencyVolumeTracingOctahedronResolution(
	TEXT("r.Lumen.TranslucencyVolume.TracingOctahedronResolution"),
	GTranslucencyVolumeTracingOctahedronResolution,
	TEXT("Resolution of the tracing octahedron.  Determines how many traces are done per voxel of the translucency lighting volume."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GTranslucencyVolumeVoxelTraceStartDistanceScale = 1.0f;
FAutoConsoleVariableRef CVarTranslucencyVoxelTraceStartDistanceScale(

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

Scope (from outer to inner):

file
function     FLumenTranslucencyLightingVolumeParameters GetTranslucencyLightingVolumeParameters

Source code excerpt:

	Parameters.SceneTexturesStruct = View.GetSceneTextures().UniformBuffer;
		
	Parameters.TranslucencyVolumeTracingOctahedronResolution = GTranslucencyVolumeTracingOctahedronResolution;
	
	Parameters.FurthestHZBTexture = View.HZB;
	Parameters.HZBMipLevel = FMath::Max<float>((int32)FMath::FloorLog2(GTranslucencyFroxelGridPixelSize) - 1, 0.0f);
	Parameters.ViewportUVToHZBBufferUV = FVector2f(
		float(View.ViewRect.Width()) / float(2 * View.HZBMipmap0Size.X),
		float(View.ViewRect.Height()) / float(2 * View.HZBMipmap0Size.Y));

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

Scope (from outer to inner):

file
function     void TraceVoxelsTranslucencyVolume

Source code excerpt:

	FComputeShaderUtils::AddPass(
		GraphBuilder,
		RDG_EVENT_NAME("%s %ux%u", bTraceFromVolume ? TEXT("TraceVoxels") : TEXT("RadianceCacheInterpolate"), GTranslucencyVolumeTracingOctahedronResolution, GTranslucencyVolumeTracingOctahedronResolution),
		ComputePassFlags,
		ComputeShader,
		PassParameters,
		GroupSize);
}

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::ComputeLumenTranslucencyGIVolume

Source code excerpt:


			const FIntVector OctahedralAtlasSize(
				TranslucencyGridSize.X * GTranslucencyVolumeTracingOctahedronResolution, 
				TranslucencyGridSize.Y * GTranslucencyVolumeTracingOctahedronResolution,
				TranslucencyGridSize.Z);

			FRDGTextureDesc VolumeTraceRadianceDesc(FRDGTextureDesc::Create3D(OctahedralAtlasSize, PF_FloatRGB, FClearValueBinding::Black, TexCreate_ShaderResource | TexCreate_UAV));
			FRDGTextureDesc VolumeTraceHitDistanceDesc(FRDGTextureDesc::Create3D(OctahedralAtlasSize, PF_R16F, FClearValueBinding::Black, TexCreate_ShaderResource | TexCreate_UAV));
	
			FRDGTextureRef VolumeTraceRadiance = GraphBuilder.CreateTexture(VolumeTraceRadianceDesc, TEXT("Lumen.TranslucencyVolume.VolumeTraceRadiance"));