r.PathTracing.MISMode

r.PathTracing.MISMode

#Overview

name: r.PathTracing.MISMode

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.PathTracing.MISMode is to control the sampling technique for light integration in the path tracing rendering system of Unreal Engine 5. This setting variable is specifically used in the path tracing module of the rendering system.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the path tracing component. This can be inferred from the file location “Engine/Source/Runtime/Renderer/Private/PathTracing.cpp”.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 2, which enables Multiple Importance Sampling (MIS) between material and light sampling.

The associated variable CVarPathTracingMISMode interacts directly with r.PathTracing.MISMode. They share the same value and purpose. CVarPathTracingMISMode is used to retrieve the current value of the setting in the render thread.

Developers must be aware that this variable affects the balance between material sampling and light sampling in the path tracing process. The three possible modes (0, 1, 2) offer different trade-offs between performance and image quality: 0: Material sampling only 1: Light sampling only 2: MIS between material and light sampling (default)

Best practices when using this variable include:

  1. Understanding the impact of each mode on render quality and performance.
  2. Testing different modes for specific scenes to find the optimal balance.
  3. Considering the complexity of materials and lights in the scene when choosing a mode.
  4. Being aware that changing this setting may require adjustments to other rendering parameters for optimal results.

Regarding the associated variable CVarPathTracingMISMode:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:98

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarPathTracingMISMode(
	TEXT("r.PathTracing.MISMode"),
	2,
	TEXT("Selects the sampling technique for light integration (default = 2 (MIS enabled))\n")
	TEXT("0: Material sampling\n")
	TEXT("1: Light sampling\n")
	TEXT("2: MIS betwen material and light sampling (default)\n"),
	ECVF_RenderThreadSafe

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:97

Scope: file

Source code excerpt:

);

TAutoConsoleVariable<int32> CVarPathTracingMISMode(
	TEXT("r.PathTracing.MISMode"),
	2,
	TEXT("Selects the sampling technique for light integration (default = 2 (MIS enabled))\n")
	TEXT("0: Material sampling\n")
	TEXT("1: Light sampling\n")
	TEXT("2: MIS betwen material and light sampling (default)\n"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:626

Scope (from outer to inner):

file
function     static void PreparePathTracingData

Source code excerpt:

	PathTracingData.SSSGuidingRatio = FMath::Clamp(CVarPathTracingSSSGuidingRatio.GetValueOnRenderThread(), 0.0f, 1.0f);
	PathTracingData.MaxNormalBias = GetRaytracingMaxNormalBias();
	PathTracingData.MISMode = CVarPathTracingMISMode.GetValueOnRenderThread();
	PathTracingData.VolumeMISMode = CVarPathTracingVolumeMISMode.GetValueOnRenderThread();
	PathTracingData.MaxPathIntensity = CVarPathTracingMaxPathIntensity.GetValueOnRenderThread();
	if (PathTracingData.MaxPathIntensity <= 0)
	{
		// cvar clamp disabled, use PPV exposure value instad
		PathTracingData.MaxPathIntensity = FMath::Pow(2.0f, PPV.PathTracingMaxPathExposure);