r.Lumen.ScreenProbeGather.StochasticInterpolation

r.Lumen.ScreenProbeGather.StochasticInterpolation

#Overview

name: r.Lumen.ScreenProbeGather.StochasticInterpolation

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

The purpose of r.Lumen.ScreenProbeGather.StochasticInterpolation is to control the interpolation method used for screen probes in the Lumen global illumination system. It determines whether to use stochastic interpolation (1 sample) or bilinear interpolation (4 samples) when gathering screen probe data.

This setting variable is primarily used in the Lumen rendering system, specifically in the screen probe gather and integration process. It’s part of Unreal Engine’s global illumination solution.

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

The associated variable GLumenScreenProbeStochasticInterpolation directly interacts with it. They share the same value, with the console variable controlling the global integer variable.

Developers should be aware that:

  1. This setting affects the quality and performance trade-off of the screen probe interpolation.
  2. Using stochastic interpolation (value 1) may introduce noise but is faster, while bilinear interpolation (value 0) is smoother but more expensive.
  3. The effect of this setting is most noticeable in scenes with complex lighting and reflections.

Best practices when using this variable:

  1. Use stochastic interpolation (1) for performance-critical scenarios or on lower-end hardware.
  2. Use bilinear interpolation (0) for higher quality renders or when artifact-free results are crucial.
  3. Consider exposing this setting to end-users as a quality option in graphics settings.
  4. Profile the performance impact in your specific scenes to determine the best default value.

Regarding GLumenScreenProbeStochasticInterpolation: This is the actual integer variable used in the rendering code. It’s set by the console variable and determines the interpolation method at runtime. The same considerations apply to this variable as to the console variable. Developers should use this variable in their C++ code when they need to check or use the current interpolation method in their rendering logic.

#Setting Variables

#References In INI files

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

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

Location: <Workspace>/Engine/Config/BaseScalability.ini:329, 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/LumenScreenProbeGather.cpp:298

Scope: file

Source code excerpt:

int32 GLumenScreenProbeStochasticInterpolation = 1;
FAutoConsoleVariableRef CVarLumenScreenProbeStochasticInterpolation(
	TEXT("r.Lumen.ScreenProbeGather.StochasticInterpolation"),
	GLumenScreenProbeStochasticInterpolation,
	TEXT("Where to interpolate screen probes stochastically (1 sample) or bilinearly (4 samples)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenScreenProbeMaxRoughnessToEvaluateRoughSpecular = .8f;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:296

Scope: file

Source code excerpt:

);

int32 GLumenScreenProbeStochasticInterpolation = 1;
FAutoConsoleVariableRef CVarLumenScreenProbeStochasticInterpolation(
	TEXT("r.Lumen.ScreenProbeGather.StochasticInterpolation"),
	GLumenScreenProbeStochasticInterpolation,
	TEXT("Where to interpolate screen probes stochastically (1 sample) or bilinearly (4 samples)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenScreenProbeMaxRoughnessToEvaluateRoughSpecular = .8f;
FAutoConsoleVariableRef GVarLumenScreenProbeMaxRoughnessToEvaluateRoughSpecular(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:1276

Scope (from outer to inner):

file
function     void InterpolateAndIntegrate
lambda-function

Source code excerpt:

				PermutationVector.Set< FScreenProbeIntegrateCS::FShortRangeAO >(bApplyShortRangeAO);
				PermutationVector.Set< FScreenProbeIntegrateCS::FProbeIrradianceFormat >(LumenScreenProbeGather::GetScreenProbeIrradianceFormat(View.Family->EngineShowFlags));
				PermutationVector.Set< FScreenProbeIntegrateCS::FStochasticProbeInterpolation >(GLumenScreenProbeStochasticInterpolation != 0);
				PermutationVector.Set< FScreenProbeIntegrateCS::FDirectLighting >(bRenderDirectLighting && !GLumenScreenProbeInjectLightsToProbes);
				PermutationVector.Set< FScreenProbeIntegrateCS::FSupportBackfaceDiffuse >(bSupportBackfaceDiffuse);
				PermutationVector.Set< FScreenProbeIntegrateCS::FRoughSpecularSamplingMode >(RoughSpecularSamplingMode);
				auto ComputeShader = View.ShaderMap->GetShader<FScreenProbeIntegrateCS>(PermutationVector);

				FComputeShaderUtils::AddPass(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:1343

Scope (from outer to inner):

file
function     void InterpolateAndIntegrate
lambda-function

Source code excerpt:

			PermutationVector.Set< FScreenProbeIntegrateCS::FShortRangeAO >(bApplyShortRangeAO);
			PermutationVector.Set< FScreenProbeIntegrateCS::FProbeIrradianceFormat >(LumenScreenProbeGather::GetScreenProbeIrradianceFormat(View.Family->EngineShowFlags));
			PermutationVector.Set< FScreenProbeIntegrateCS::FStochasticProbeInterpolation >(GLumenScreenProbeStochasticInterpolation != 0);
			PermutationVector.Set< FScreenProbeIntegrateCS::FDirectLighting >(bRenderDirectLighting && !GLumenScreenProbeInjectLightsToProbes);
			PermutationVector.Set< FScreenProbeIntegrateCS::FSupportBackfaceDiffuse >(bSupportBackfaceDiffuse);
			PermutationVector.Set< FScreenProbeIntegrateCS::FRoughSpecularSamplingMode >(RoughSpecularSamplingMode);
			auto ComputeShader = View.ShaderMap->GetShader<FScreenProbeIntegrateCS>(PermutationVector);

			const FIntPoint DispatchViewRect = View.ViewRect.Size();