r.Lumen.ReSTIRGather.Upsample.KernelSize

r.Lumen.ReSTIRGather.Upsample.KernelSize

#Overview

name: r.Lumen.ReSTIRGather.Upsample.KernelSize

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.ReSTIRGather.Upsample.KernelSize is to control the upsample kernel size for the Lumen ReSTIR (Reservoir Spatio-Temporal Importance Resampling) gather process in Unreal Engine 5’s rendering system. This setting is specifically used in the Lumen global illumination system, which is part of UE5’s advanced rendering capabilities.

This setting variable is primarily used in the Renderer module, specifically within the Lumen subsystem. It’s part of the ReSTIR implementation, which is an advanced technique for improving the quality and performance of global illumination.

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

The associated variable GLumenReSTIRUpsampleKernelSize directly interacts with r.Lumen.ReSTIRGather.Upsample.KernelSize. They share the same value, with GLumenReSTIRUpsampleKernelSize being the C++ variable that’s used in the actual rendering code.

Developers should be aware that this variable affects the quality and performance of the Lumen global illumination system. A larger kernel size may provide better quality upsampling but at the cost of increased computational overhead.

Best practices when using this variable include:

  1. Balancing quality and performance by adjusting the kernel size.
  2. Testing different values to find the optimal setting for your specific scene and target hardware.
  3. Considering the interaction with other Lumen settings, as they may influence the optimal value for this parameter.

Regarding the associated variable GLumenReSTIRUpsampleKernelSize:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:157

Scope: file

Source code excerpt:

float GLumenReSTIRUpsampleKernelSize = 3.0f;
FAutoConsoleVariableRef CVarLumenReSTIRUpsampleKernelSize(
	TEXT("r.Lumen.ReSTIRGather.Upsample.KernelSize"),
	GLumenReSTIRUpsampleKernelSize,
	TEXT("Upsample kernel size, in reservoir texels"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenReSTIRUpsampleNumSamples = 16;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenReSTIRUpsampleKernelSize = 3.0f;
FAutoConsoleVariableRef CVarLumenReSTIRUpsampleKernelSize(
	TEXT("r.Lumen.ReSTIRGather.Upsample.KernelSize"),
	GLumenReSTIRUpsampleKernelSize,
	TEXT("Upsample kernel size, in reservoir texels"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GLumenReSTIRUpsampleNumSamples = 16;
FAutoConsoleVariableRef CVarLumenReSTIRNumSamples(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReSTIRGather.cpp:1223

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenReSTIRGather

Source code excerpt:

		PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);
		LumenReflections::SetupCompositeParameters(View, PassParameters->ReflectionsCompositeParameters);
		PassParameters->UpsampleKernelSize = GLumenReSTIRUpsampleKernelSize;
		PassParameters->UpsampleNumSamples = GLumenReSTIRUpsampleNumSamples;

		FUpsampleAndIntegrateCS::FPermutationDomain PermutationVector;
		PermutationVector.Set< FUpsampleAndIntegrateCS::FUpsampleMethod >((EReSTIRUpsampleMethod)GLumenReSTIRUpsampleMethod);
		PermutationVector.Set< FUpsampleAndIntegrateCS::FBilateralFilter >(bBilateralFilter);
		auto ComputeShader = View.ShaderMap->GetShader<FUpsampleAndIntegrateCS>(PermutationVector);