r.PathTracing.VolumeMISMode

r.PathTracing.VolumeMISMode

#Overview

name: r.PathTracing.VolumeMISMode

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.VolumeMISMode is to control the sampling technique used for volumetric integration of local lighting in path tracing.

This setting variable is primarily used by the rendering system, specifically the path tracing subsystem within Unreal Engine 5. It is part of the Renderer module, as evidenced by its location in the PathTracing.cpp file within the Runtime/Renderer directory.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, which corresponds to light sampling. The variable allows two possible values: 0: Density sampling 1: Light sampling (default)

The associated variable CVarPathTracingVolumeMISMode interacts directly with r.PathTracing.VolumeMISMode. They share the same value and purpose.

Developers must be aware that this variable affects the performance and quality of volumetric lighting in path-traced scenes. Changing this value can impact both rendering speed and the visual appearance of volumetric effects.

Best practices when using this variable include:

  1. Understanding the trade-offs between density sampling and light sampling for your specific scene.
  2. Testing both modes to determine which provides the best balance of quality and performance for your project.
  3. Considering the complexity of your volumetric lighting setup when choosing between the two modes.

Regarding the associated variable CVarPathTracingVolumeMISMode:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarPathTracingVolumeMISMode(
	TEXT("r.PathTracing.VolumeMISMode"),
	1,
	TEXT("Selects the sampling technique for volumetric integration of local lighting (default = 1)\n")
	TEXT("0: Density sampling\n")
	TEXT("1: Light sampling (default)\n"),
	ECVF_RenderThreadSafe
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

TAutoConsoleVariable<int32> CVarPathTracingVolumeMISMode(
	TEXT("r.PathTracing.VolumeMISMode"),
	1,
	TEXT("Selects the sampling technique for volumetric integration of local lighting (default = 1)\n")
	TEXT("0: Density sampling\n")
	TEXT("1: Light sampling (default)\n"),
	ECVF_RenderThreadSafe

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

Scope (from outer to inner):

file
function     static void PreparePathTracingData

Source code excerpt:

	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);
	}