r.DOF.Gather.EnableBokehSettings

r.DOF.Gather.EnableBokehSettings

#Overview

name: r.DOF.Gather.EnableBokehSettings

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.Gather.EnableBokehSettings is to control whether bokeh settings are applied during the foreground and background gathering process in the Depth of Field (DOF) rendering system. This setting is part of Unreal Engine’s post-processing and rendering subsystem, specifically the Diaphragm Depth of Field implementation.

This setting variable is used within the Renderer module of Unreal Engine, particularly in the DiaphragmDOF.cpp file, which handles the implementation of the Diaphragm Depth of Field effect.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime through console commands or programmatically.

The associated variable CVarEnableGatherBokehSettings directly interacts with r.DOF.Gather.EnableBokehSettings. They share the same value and purpose.

Developers must be aware that this variable affects the visual quality and performance of the Depth of Field effect. Enabling it (value 1) applies bokeh settings during gathering, which can enhance the visual quality of out-of-focus areas but may have a performance impact.

Best practices when using this variable include:

  1. Consider the performance implications when enabling this feature, especially on lower-end hardware.
  2. Use it in conjunction with other DOF settings for optimal visual results.
  3. Test the visual impact and performance with both enabled and disabled states to determine the best setting for your specific use case.

Regarding the associated variable CVarEnableGatherBokehSettings:

Its purpose is identical to r.DOF.Gather.EnableBokehSettings, serving as the internal representation of the console variable.

It’s used in the Renderer module, specifically in the Diaphragm DOF implementation.

The value is set through the CVar system and can be accessed using GetValueOnRenderThread() method.

It directly controls whether the bokeh settings are applied during the gathering phase of the DOF effect.

Developers should be aware that this variable is accessed on the render thread, so any changes to it should be thread-safe.

Best practices include using the appropriate ECVF flags (ECVF_Scalability | ECVF_RenderThreadSafe) when declaring the variable to ensure proper behavior across different quality settings and render thread safety.

#Setting Variables

#References In INI files

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

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

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

Location: <Workspace>/Engine/Config/BaseScalability.ini:538, 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/DiaphragmDOF.cpp:45

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarEnableGatherBokehSettings(
	TEXT("r.DOF.Gather.EnableBokehSettings"),
	1,
	TEXT("Whether to applies bokeh settings on foreground and background gathering.\n")
	TEXT(" 0: Disable;\n 1: Enable (default)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarPostFilteringMethod(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:44

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarEnableGatherBokehSettings(
	TEXT("r.DOF.Gather.EnableBokehSettings"),
	1,
	TEXT("Whether to applies bokeh settings on foreground and background gathering.\n")
	TEXT(" 0: Disable;\n 1: Enable (default)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:1536

Scope (from outer to inner):

file
function     bool DiaphragmDOF::AddPasses

Source code excerpt:

	const bool bEnableGatherBokehSettings = (
		bSupportGatheringBokehSimulation &&
		CVarEnableGatherBokehSettings.GetValueOnRenderThread() == 1);
	const bool bEnableScatterBokehSettings = CVarEnableScatterBokehSettings.GetValueOnRenderThread() == 1;
	const bool bEnableSlightOutOfFocusBokeh = bSupportGatheringBokehSimulation && bRecombineDoesSlightOutOfFocus && CVarEnableRecombineBokehSettings.GetValueOnRenderThread();
		
	// Setup all the descriptors.
	FRDGTextureDesc FullResDesc;
	{