r.Lumen.ScreenProbeGather.ShortRangeAO.ScreenSpace.FoliageOcclusionStrength

r.Lumen.ScreenProbeGather.ShortRangeAO.ScreenSpace.FoliageOcclusionStrength

#Overview

name: r.Lumen.ScreenProbeGather.ShortRangeAO.ScreenSpace.FoliageOcclusionStrength

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.ScreenSpace.FoliageOcclusionStrength is to control the maximum strength of Screen Space Bent Normal occlusion on foliage and subsurface pixels in the Lumen global illumination system. It is specifically designed to simulate subsurface scattering effects by reducing the maximum occlusion on these types of surfaces.

This setting variable is primarily used in the rendering system, specifically within the Lumen global illumination subsystem of Unreal Engine 5. Based on the callsites, it is utilized in the Renderer module, particularly in the indirect light rendering and screen space bent normal calculations.

The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 0.7f and can be modified at runtime using console commands or through project settings.

The associated variable GLumenShortRangeAOFoliageOcclusionStrength directly interacts with this setting. They share the same value, and GLumenShortRangeAOFoliageOcclusionStrength is used in the C++ code to apply the effect.

Developers must be aware that this variable specifically targets foliage and subsurface pixels. Adjusting this value will affect the appearance of these types of surfaces in the scene, particularly in how they interact with ambient occlusion and global illumination.

Best practices when using this variable include:

  1. Fine-tuning the value to achieve the desired balance between realistic occlusion and the subsurface scattering effect for foliage and other translucent materials.
  2. Testing the variable’s impact across different lighting conditions and scenes to ensure consistent visual quality.
  3. Considering performance implications when adjusting this value, as it may affect the overall rendering workload.

Regarding the associated variable GLumenShortRangeAOFoliageOcclusionStrength:

The purpose of GLumenShortRangeAOFoliageOcclusionStrength is to store and provide access to the foliage occlusion strength value within the C++ code of the rendering system.

This variable is used in the Renderer module, specifically in the indirect light rendering process and the Lumen screen space bent normal calculations.

The value of GLumenShortRangeAOFoliageOcclusionStrength is set by the console variable system, mirroring the value of r.Lumen.ScreenProbeGather.ShortRangeAO.ScreenSpace.FoliageOcclusionStrength.

It interacts directly with the console variable and is used in shader parameter assignments for the Lumen rendering process.

Developers should be aware that modifying this variable directly in C++ code is not recommended, as it should be controlled through the console variable system for consistency and proper engine integration.

Best practices for using GLumenShortRangeAOFoliageOcclusionStrength include accessing it only for reading within rendering code and relying on the console variable system for any value modifications.

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

Scope: file

Source code excerpt:

float GLumenShortRangeAOFoliageOcclusionStrength = .7f;
FAutoConsoleVariableRef CVarLumenShortRangeAOFoliageOcclusionStrength(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.ScreenSpace.FoliageOcclusionStrength"),
	GLumenShortRangeAOFoliageOcclusionStrength,
	TEXT("Maximum strength of ScreenSpaceBentNormal occlusion on foliage and subsurface pixels.  Useful for reducing max occlusion to simulate subsurface scattering."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenMaxShortRangeAOMultibounceAlbedo = .5f;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:1298

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDiffuseIndirectAndAmbientOcclusion
lambda-function

Source code excerpt:

			PassParameters->bLumenSupportBackfaceDiffuse = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen && DenoiserOutputs.Textures[1] != SystemTextures.Black;
			PassParameters->bLumenReflectionInputIsSSR = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen && ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR;
			extern float GLumenShortRangeAOFoliageOcclusionStrength;
			PassParameters->LumenFoliageOcclusionStrength = GLumenShortRangeAOFoliageOcclusionStrength;
			extern float GLumenMaxShortRangeAOMultibounceAlbedo;
			PassParameters->LumenMaxAOMultibounceAlbedo = GLumenMaxShortRangeAOMultibounceAlbedo;
			PassParameters->LumenReflectionSpecularScale = GetLumenReflectionSpecularScale();
			PassParameters->LumenReflectionContrast = GetLumenReflectionContrast();

			PassParameters->bVisualizeDiffuseIndirect = bIsVisualizePass;

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

Scope: file

Source code excerpt:

);

float GLumenShortRangeAOFoliageOcclusionStrength = .7f;
FAutoConsoleVariableRef CVarLumenShortRangeAOFoliageOcclusionStrength(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.ScreenSpace.FoliageOcclusionStrength"),
	GLumenShortRangeAOFoliageOcclusionStrength,
	TEXT("Maximum strength of ScreenSpaceBentNormal occlusion on foliage and subsurface pixels.  Useful for reducing max occlusion to simulate subsurface scattering."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenMaxShortRangeAOMultibounceAlbedo = .5f;
FAutoConsoleVariableRef CVarLumenMaxShortRangeAOMultibounceAlbedo(