r.DOF.Recombine.EnableBokehSettings
r.DOF.Recombine.EnableBokehSettings
#Overview
name: r.DOF.Recombine.EnableBokehSettings
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to applies bokeh settings on slight out of focus done in recombine pass.\n 0: Disable;\n 1: Enable (default).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DOF.Recombine.EnableBokehSettings is to control the application of bokeh settings on slightly out-of-focus areas during the recombine pass of the Depth of Field (DOF) effect in Unreal Engine’s rendering pipeline.
This setting variable is primarily used in the rendering system, specifically in the post-processing stage for Depth of Field effects. It is part of the Renderer module of Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the post-processing pipeline, particularly the Depth of Field implementation. It is used in the DiaphragmDOF (Diaphragm Depth of Field) system, which is an advanced DOF technique that simulates the behavior of a camera’s aperture.
The value of this variable is set using a console variable (CVar) system. It is initialized with a default value of 1 (enabled) but can be changed at runtime through console commands or project settings.
This variable interacts with other DOF-related variables, such as those controlling gather and scatter bokeh settings. It is specifically used in conjunction with the recombine pass of the DOF effect.
Developers must be aware that this setting affects the visual quality and performance of the DOF effect. Enabling it (value 1) will apply bokeh settings to slightly out-of-focus areas, potentially improving visual quality but at a performance cost.
Best practices when using this variable include:
- Consider the performance implications of enabling this feature, especially on lower-end hardware.
- Use it in conjunction with other DOF settings for a cohesive look.
- Test the visual impact with and without this setting enabled to determine if the quality improvement justifies any performance cost.
Regarding the associated variable CVarEnableRecombineBokehSettings:
The purpose of CVarEnableRecombineBokehSettings is to provide a programmatic way to access and modify the r.DOF.Recombine.EnableBokehSettings console variable within the C++ code of the engine.
This associated variable is used directly in the rendering code to determine whether to apply the bokeh settings during the recombine pass. It’s accessed using the GetValueOnRenderThread() method, which ensures thread-safe access to the current value.
The value of CVarEnableRecombineBokehSettings is set when the console variable is initialized, but it can be changed at runtime through the console variable system.
Developers should be aware that changes to this variable will take effect on the render thread, which may not be immediate depending on the current state of rendering.
Best practices for using CVarEnableRecombineBokehSettings include:
- Access its value using GetValueOnRenderThread() when in render thread code.
- Consider exposing this setting in user-facing graphics options if fine-tuning of DOF is desired.
- Use it in conditional statements to enable or disable specific DOF processing steps for performance optimization.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:507, section: [PostProcessQuality@3]
- INI Section:
PostProcessQuality@3
- Raw value:
0 ; no bokeh simulation on slight out of focus
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:545, section: [PostProcessQuality@Cine]
- INI Section:
PostProcessQuality@Cine
- Raw value:
1 ; bokeh simulation on slight out of focus
- Is Array:
False
#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:105
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarEnableRecombineBokehSettings(
TEXT("r.DOF.Recombine.EnableBokehSettings"),
1,
TEXT("Whether to applies bokeh settings on slight out of focus done in recombine pass.\n")
TEXT(" 0: Disable;\n 1: Enable (default)."),
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarRecombineQuality(
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableRecombineBokehSettings
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:104
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarEnableRecombineBokehSettings(
TEXT("r.DOF.Recombine.EnableBokehSettings"),
1,
TEXT("Whether to applies bokeh settings on slight out of focus done in recombine pass.\n")
TEXT(" 0: Disable;\n 1: Enable (default)."),
ECVF_Scalability | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:1538
Scope (from outer to inner):
file
function bool DiaphragmDOF::AddPasses
Source code excerpt:
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;