r.Lumen.ScreenProbeGather.ShortRangeAO.HairScreenTrace

r.Lumen.ScreenProbeGather.ShortRangeAO.HairScreenTrace

#Overview

name: r.Lumen.ScreenProbeGather.ShortRangeAO.HairScreenTrace

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.ScreenProbeGather.ShortRangeAO.HairScreenTrace is to control whether the Lumen lighting system should trace against hair depth for hair casting shadows onto opaque objects in screen space. This setting is part of the Lumen global illumination and reflections system in Unreal Engine 5, specifically focusing on the screen-space ambient occlusion (AO) calculations for hair rendering.

This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine’s rendering module. It’s specifically utilized in the screen-space bent normal calculations, which are crucial for accurate ambient occlusion and indirect lighting.

The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime.

The associated C++ variable GLumenShortRangeAOHairStrandsScreenTrace directly interacts with this setting. They share the same value, and GLumenShortRangeAOHairStrandsScreenTrace is used in the actual rendering code to determine whether to perform the hair screen trace.

Developers should be aware that:

  1. This setting affects performance and visual quality, especially in scenes with detailed hair rendering.
  2. It’s marked with ECVF_Scalability, indicating it can be adjusted for different quality settings.
  3. It’s also marked as ECVF_RenderThreadSafe, meaning it’s safe to modify from the render thread.

Best practices when using this variable include:

  1. Consider the performance impact, especially on lower-end hardware.
  2. Use in conjunction with other hair rendering settings for optimal results.
  3. Test thoroughly with different types of hair rendering to ensure desired visual outcomes.

Regarding the associated variable GLumenShortRangeAOHairStrandsScreenTrace:

When working with this variable, developers should consider the overall hair rendering pipeline and how this screen-space tracing interacts with other hair rendering techniques in Unreal Engine 5.

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

Scope: file

Source code excerpt:

int32 GLumenShortRangeAOHairStrandsScreenTrace = 0;
FAutoConsoleVariableRef GVarShortRangeAOHairStrandsScreenTrace(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.HairScreenTrace"),
	GLumenShortRangeAOHairStrandsScreenTrace,
	TEXT("Whether to trace against hair depth for hair casting shadow onto opaques."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

class FScreenSpaceShortRangeAOCS : public FGlobalShader

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

int32 GLumenShortRangeAOHairStrandsScreenTrace = 0;
FAutoConsoleVariableRef GVarShortRangeAOHairStrandsScreenTrace(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.HairScreenTrace"),
	GLumenShortRangeAOHairStrandsScreenTrace,
	TEXT("Whether to trace against hair depth for hair casting shadow onto opaques."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

class FScreenSpaceShortRangeAOCS : public FGlobalShader
{

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

Scope (from outer to inner):

file
function     FLumenScreenSpaceBentNormalParameters ComputeScreenSpaceShortRangeAO

Source code excerpt:

	{
		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));
			PassParameters->SceneTexturesStruct = SceneTextures.UniformBuffer;