r.DOF.Kernel.MaxBackgroundRadius
r.DOF.Kernel.MaxBackgroundRadius
#Overview
name: r.DOF.Kernel.MaxBackgroundRadius
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).
- type:
Var
- help:
Maximum size of the background bluring radius in screen space (default=0.025).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DOF.Kernel.MaxBackgroundRadius is to control the maximum size of the background 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 pipeline for the Depth of Field effect. Based on the callsites, it’s clear that this variable is part of the DiaphragmDOF (Diaphragm Depth of Field) implementation.
The value of this variable is set as a console variable with a default value of 0.025f. It can be modified at runtime through the console or configuration files.
The associated variable CVarMaxBackgroundRadius directly interacts with r.DOF.Kernel.MaxBackgroundRadius. 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.
- It’s marked with ECVF_Scalability, indicating it can be used for performance scaling.
- It’s also marked with ECVF_RenderThreadSafe, meaning it’s safe to modify from the render thread.
Best practices when using this variable include:
- Adjusting it carefully to balance visual quality and performance.
- Testing different values to find the optimal setting for your specific scene and target hardware.
- Considering its impact on different screen resolutions, as it’s a screen-space value.
Regarding the associated variable CVarMaxBackgroundRadius:
The purpose of CVarMaxBackgroundRadius is the same as r.DOF.Kernel.MaxBackgroundRadius – to control the maximum background blurring radius for the Depth of Field effect.
It’s used in the DiaphragmDOF::FPhysicalCocModel::Compile function to set the MaxBackgroundCocRadius value. This suggests it’s part of the circle of confusion model used in the DOF calculations.
The value is retrieved using GetValueOnRenderThread(), indicating it’s accessed during rendering.
Developers should be aware that changes to this variable will directly affect the DOF calculations and should be adjusted in conjunction with other DOF parameters for optimal results.
Best practices include monitoring performance impacts when adjusting this value and considering its interaction with other DOF settings to achieve the desired visual effect.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:439, section: [PostProcessQuality@1]
- INI Section:
PostProcessQuality@1
- Raw value:
0.006 ; required because low gathering and no scattering and not looking great at 1080p
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:474, section: [PostProcessQuality@2]
- INI Section:
PostProcessQuality@2
- Raw value:
0.012 ; required because of AccumulatorQuality=0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:510, section: [PostProcessQuality@3]
- INI Section:
PostProcessQuality@3
- Raw value:
0.025
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:548, section: [PostProcessQuality@Cine]
- INI Section:
PostProcessQuality@Cine
- Raw value:
0.025
- 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/DiaphragmDOFUtils.cpp:17
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<float> CVarMaxBackgroundRadius(
TEXT("r.DOF.Kernel.MaxBackgroundRadius"),
0.025f,
TEXT("Maximum size of the background bluring radius in screen space (default=0.025)."),
ECVF_Scalability | ECVF_RenderThreadSafe);
} // namespace
#Associated Variable and Callsites
This variable is associated with another variable named CVarMaxBackgroundRadius
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOFUtils.cpp:16
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<float> CVarMaxBackgroundRadius(
TEXT("r.DOF.Kernel.MaxBackgroundRadius"),
0.025f,
TEXT("Maximum size of the background bluring radius in screen space (default=0.025)."),
ECVF_Scalability | ECVF_RenderThreadSafe);
} // namespace
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOFUtils.cpp:124
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;