r.Lumen.ScreenProbeGather.ShortRangeAO.HairVoxelTrace

r.Lumen.ScreenProbeGather.ShortRangeAO.HairVoxelTrace

#Overview

name: r.Lumen.ScreenProbeGather.ShortRangeAO.HairVoxelTrace

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.ShortRangeAO.HairVoxelTrace is to control whether to trace against hair voxel structure for hair casting shadow onto opaque objects in Unreal Engine’s Lumen lighting system. This setting is specifically related to the rendering system, particularly the screen space ambient occlusion (AO) and hair rendering features.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in files related to screen space bent normal calculations and short-range ambient occlusion.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. Its default value is 1 (enabled).

The associated variable GLumenShortRangeAOHairStrandsVoxelTrace directly interacts with this setting. They share the same value and purpose.

Developers should be aware that:

  1. This setting only takes effect when hair strand voxel data is available in the view.
  2. It’s part of the scalability options and is render thread safe, meaning it can be changed dynamically without causing thread safety issues.
  3. It works in conjunction with another variable GLumenShortRangeAOHairStrandsScreenTrace, which controls screen-space tracing for hair strands.

Best practices when using this variable include:

  1. Consider the performance impact of enabling this feature, especially on lower-end hardware.
  2. Use it in combination with other hair rendering and AO settings for optimal visual results.
  3. Test the visual impact and performance with different values (0 for off, 1 for on) in various scenarios.

Regarding the associated variable GLumenShortRangeAOHairStrandsVoxelTrace:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenSpaceBentNormal.cpp:38

Scope: file

Source code excerpt:

int32 GLumenShortRangeAOHairStrandsVoxelTrace = 1;
FAutoConsoleVariableRef GVarLumenShortRangeAOHairStrandsVoxelTrace(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.HairVoxelTrace"),
	GLumenShortRangeAOHairStrandsVoxelTrace,
	TEXT("Whether to trace against hair voxel structure for hair casting shadow onto opaques."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenShortRangeAOHairStrandsScreenTrace = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenSpaceBentNormal.cpp:36

Scope: file

Source code excerpt:

);

int32 GLumenShortRangeAOHairStrandsVoxelTrace = 1;
FAutoConsoleVariableRef GVarLumenShortRangeAOHairStrandsVoxelTrace(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.HairVoxelTrace"),
	GLumenShortRangeAOHairStrandsVoxelTrace,
	TEXT("Whether to trace against hair voxel structure for hair casting shadow onto opaques."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenShortRangeAOHairStrandsScreenTrace = 0;
FAutoConsoleVariableRef GVarShortRangeAOHairStrandsScreenTrace(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenSpaceBentNormal.cpp:155

Scope (from outer to inner):

file
function     FLumenScreenSpaceBentNormalParameters ComputeScreenSpaceShortRangeAO

Source code excerpt:

	else
	{
		const bool bNeedTraceHairVoxel = HairStrands::HasViewHairStrandsVoxelData(View) && GLumenShortRangeAOHairStrandsVoxelTrace > 0;
		const bool bNeedTraceHairScreen = HairStrands::HasViewHairStrandsData(View) && GLumenShortRangeAOHairStrandsScreenTrace > 0;
		
		auto ScreenSpaceShortRangeAO = [&](bool bOverflow)
		{
			FScreenSpaceShortRangeAOCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FScreenSpaceShortRangeAOCS::FParameters>();
			PassParameters->RWScreenBentNormal = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ScreenBentNormal));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenShortRangeAOHardwareRayTracing.cpp:121

Scope: file

Source code excerpt:

#if RHI_RAYTRACING
{
	extern int32 GLumenShortRangeAOHairStrandsVoxelTrace;
	const bool bNeedTraceHairVoxel = HairStrands::HasViewHairStrandsVoxelData(View) && GLumenShortRangeAOHairStrandsVoxelTrace > 0;

	{
		FLumenShortRangeAOHardwareRayTracing::FParameters* PassParameters = GraphBuilder.AllocParameters<FLumenShortRangeAOHardwareRayTracing::FParameters>();
		PassParameters->RWScreenBentNormal = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(ScreenBentNormal));
		PassParameters->TLAS = View.GetRayTracingSceneLayerViewChecked(ERayTracingSceneLayer::Base);
		PassParameters->ViewUniformBuffer = View.ViewUniformBuffer;