r.DepthOfField.DepthBlur.Amount
r.DepthOfField.DepthBlur.Amount
#Overview
name: r.DepthOfField.DepthBlur.Amount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This scale multiplier only affects the CircleDOF DepthBlur feature (value defines in how many km the radius goes to 50%).\n x: Multiply the existing Depth Blur Amount with x\n-x: Override the existing Depth Blur Amount with x (in km)\n 1: No adjustments (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DepthOfField.DepthBlur.Amount is to control the depth blur amount in the Depth of Field (DOF) effect, specifically for the CircleDOF DepthBlur feature in Unreal Engine’s rendering system.
This setting variable is primarily used by the rendering system, particularly in the post-processing pipeline for Depth of Field effects. Based on the callsites, it’s utilized in the Engine module, specifically within the SceneView component.
The value of this variable is set through a console variable (CVar) named CVarDepthOfFieldDepthBlurAmount. It’s initialized with a default value of 1.0f, which means no adjustment to the existing Depth Blur Amount.
The associated variable CVarDepthOfFieldDepthBlurAmount directly interacts with r.DepthOfField.DepthBlur.Amount. They share the same value and are used together to modify the DepthOfFieldDepthBlurAmount in the FinalPostProcessSettings.
Developers must be aware of the following when using this variable:
- The value defines how many kilometers the radius goes to 50% for the CircleDOF DepthBlur feature.
- Positive values multiply the existing Depth Blur Amount, while negative values override it.
- A value of 1 means no adjustments (default behavior).
Best practices when using this variable include:
- Use positive values to fine-tune the existing Depth Blur Amount.
- Use negative values when you want to set a specific, consistent Depth Blur Amount across different scenarios.
- Be cautious when adjusting this value, as it can significantly impact the visual quality and performance of the Depth of Field effect.
Regarding the associated variable CVarDepthOfFieldDepthBlurAmount:
- It’s a TAutoConsoleVariable
that allows runtime modification of the Depth Blur Amount. - It’s used in the EndFinalPostprocessSettings function of FSceneView to apply the depth blur amount to the final post-process settings.
- The value is retrieved using GetValueOnGameThread(), indicating it’s safe to access from the game thread.
- The actual application of this value depends on whether it’s positive or negative, as explained earlier.
When working with CVarDepthOfFieldDepthBlurAmount, developers should consider the performance implications of frequent changes and ensure that modifications are made appropriately based on the desired visual outcome and performance requirements of their game.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:91
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDepthOfFieldDepthBlurAmount(
TEXT("r.DepthOfField.DepthBlur.Amount"),
1.0f,
TEXT("This scale multiplier only affects the CircleDOF DepthBlur feature (value defines in how many km the radius goes to 50%).\n")
TEXT(" x: Multiply the existing Depth Blur Amount with x\n")
TEXT("-x: Override the existing Depth Blur Amount with x (in km)\n")
TEXT(" 1: No adjustments (default)"),
ECVF_RenderThreadSafe | ECVF_Cheat);
#Associated Variable and Callsites
This variable is associated with another variable named CVarDepthOfFieldDepthBlurAmount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:90
Scope: file
Source code excerpt:
ECVF_Cheat);
static TAutoConsoleVariable<float> CVarDepthOfFieldDepthBlurAmount(
TEXT("r.DepthOfField.DepthBlur.Amount"),
1.0f,
TEXT("This scale multiplier only affects the CircleDOF DepthBlur feature (value defines in how many km the radius goes to 50%).\n")
TEXT(" x: Multiply the existing Depth Blur Amount with x\n")
TEXT("-x: Override the existing Depth Blur Amount with x (in km)\n")
TEXT(" 1: No adjustments (default)"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:2152
Scope (from outer to inner):
file
function void FSceneView::EndFinalPostprocessSettings
Source code excerpt:
float& DepthBlurAmount = FinalPostProcessSettings.DepthOfFieldDepthBlurAmount;
float CVarAmount = CVarDepthOfFieldDepthBlurAmount.GetValueOnGameThread();
DepthBlurAmount = (CVarAmount > 0.0f) ? (DepthBlurAmount * CVarAmount) : -CVarAmount;
}
{
float& DepthBlurRadius = FinalPostProcessSettings.DepthOfFieldDepthBlurRadius;