r.DOF.Scatter.EnableBokehSettings

r.DOF.Scatter.EnableBokehSettings

#Overview

name: r.DOF.Scatter.EnableBokehSettings

The value of this variable can be defined or overridden in .ini config files. 3 .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.Scatter.EnableBokehSettings is to control whether bokeh settings are enabled for the scattering phase of the Depth of Field (DOF) effect in Unreal Engine’s rendering system.

This setting variable is primarily used by the Renderer module, specifically within the Depth of Field post-processing system. It is part of the DiaphragmDOF implementation, which is responsible for creating realistic depth of field effects in the engine.

The value of this variable is set through a console variable (CVarEnableScatterBokehSettings) with a default value of 1 (enabled). It can be changed at runtime using console commands or through code.

This variable interacts closely with other DOF-related variables, such as CVarEnableGatherBokehSettings and CVarEnableRecombineBokehSettings, which control bokeh settings for other phases of the DOF effect.

Developers should be aware that this variable affects the visual quality and performance of the DOF effect. Enabling bokeh settings for scattering can improve 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 bokeh settings for scattering.
  2. Test the visual impact of enabling/disabling this setting in different scenarios.
  3. Use in conjunction with other DOF settings for optimal results.

The associated variable CVarEnableScatterBokehSettings is an internal representation of the console variable. It is used within the rendering code to quickly access the current value of the setting. This variable is typically used in conditional statements to determine whether to apply bokeh settings during the scattering phase of the DOF effect.

When working with CVarEnableScatterBokehSettings, developers should:

  1. Use GetValueOnRenderThread() to safely access its value in render thread code.
  2. Be aware that changes to this variable will affect the DOF rendering pipeline.
  3. Consider exposing this setting in user-facing graphics options if fine-tuning of DOF quality is desired.

#Setting Variables

#References In INI files

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

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

Location: <Workspace>/Engine/Config/BaseScalability.ini:542, 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:85

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarEnableScatterBokehSettings(
	TEXT("r.DOF.Scatter.EnableBokehSettings"),
	1,
	TEXT("Whether to enable bokeh settings on scattering.\n")
	TEXT(" 0: Disable;\n 1: Enable (default)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<float> CVarScatterMinCocRadius(

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarEnableScatterBokehSettings(
	TEXT("r.DOF.Scatter.EnableBokehSettings"),
	1,
	TEXT("Whether to enable bokeh settings on scattering.\n")
	TEXT(" 0: Disable;\n 1: Enable (default)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

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

Scope (from outer to inner):

file
function     bool DiaphragmDOF::AddPasses

Source code excerpt:

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