r.DOF.Kernel.MaxForegroundRadius

r.DOF.Kernel.MaxForegroundRadius

#Overview

name: r.DOF.Kernel.MaxForegroundRadius

The value of this variable can be defined or overridden in .ini config files. 4 .ini config files referencing this setting variable.

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.DOF.Kernel.MaxForegroundRadius is to control the maximum size of the foreground blurring radius in screen space for the Depth of Field (DOF) effect in Unreal Engine’s rendering system.

This setting variable is primarily used by the rendering system, specifically in the post-processing stage for Depth of Field calculations.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its location in the “Runtime/Renderer/Private/PostProcess” directory.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0.025f, but can be changed at runtime or through configuration files.

This variable interacts with another variable called CVarMaxForegroundRadius. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the visual quality and performance of the Depth of Field effect. A larger value will result in a more pronounced foreground blur but may impact performance.

Best practices when using this variable include:

  1. Adjusting it in small increments to find the right balance between visual quality and performance.
  2. Testing the effect on various hardware configurations to ensure consistent results across different platforms.
  3. Considering the overall scene composition and artistic direction when setting this value.

Regarding the associated variable CVarMaxForegroundRadius:

The purpose of CVarMaxForegroundRadius is the same as r.DOF.Kernel.MaxForegroundRadius, as they are essentially the same variable implemented through the console variable system.

It’s used in the DiaphragmDOF::FPhysicalCocModel::Compile function to set the MinForegroundCocRadius. The value is negated because foreground CoC (Circle of Confusion) values are negative in this implementation.

Developers should be aware that changes to either r.DOF.Kernel.MaxForegroundRadius or CVarMaxForegroundRadius will affect the same aspect of the Depth of Field effect. They should use whichever is more convenient for their specific use case, typically r.DOF.Kernel.MaxForegroundRadius for console commands or configuration files, and CVarMaxForegroundRadius for C++ code modifications.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:438, section: [PostProcessQuality@1]

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

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

Location: <Workspace>/Engine/Config/BaseScalability.ini:547, section: [PostProcessQuality@Cine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOFUtils.cpp:11

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<float> CVarMaxForegroundRadius(
	TEXT("r.DOF.Kernel.MaxForegroundRadius"),
	0.025f,
	TEXT("Maximum size of the foreground bluring radius in screen space (default=0.025)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<float> CVarMaxBackgroundRadius(
	TEXT("r.DOF.Kernel.MaxBackgroundRadius"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOFUtils.cpp:10

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

{

TAutoConsoleVariable<float> CVarMaxForegroundRadius(
	TEXT("r.DOF.Kernel.MaxForegroundRadius"),
	0.025f,
	TEXT("Maximum size of the foreground bluring radius in screen space (default=0.025)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<float> CVarMaxBackgroundRadius(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOFUtils.cpp:123

Scope (from outer to inner):

file
function     void DiaphragmDOF::FPhysicalCocModel::Compile

Source code excerpt:

	{
		// -because foreground Coc are negative.
		MinForegroundCocRadius = -CVarMaxForegroundRadius.GetValueOnRenderThread();
		MaxBackgroundCocRadius = CVarMaxBackgroundRadius.GetValueOnRenderThread();
	}

	// Fetch the depth blur.
	{
		MaxDepthBlurRadius = View.FinalPostProcessSettings.DepthOfFieldDepthBlurRadius / 1920.0f;