r.DepthOfField.DepthBlur.Scale
r.DepthOfField.DepthBlur.Scale
#Overview
name: r.DepthOfField.DepthBlur.Scale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This scale multiplier only affects the CircleDOF DepthBlur feature. This is applied after r.DepthOfField.DepthBlur.ResolutionScale.\n 0: Disable Depth Blur\n x: Multiply the existing Depth Blur Radius with x\n-x: Override the existing Depth Blur Radius with x\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.Scale is to control the scale of the depth blur effect in the Depth of Field (DOF) rendering system. This setting variable is part of Unreal Engine’s post-processing pipeline, specifically targeting the Depth of Field effect.
This setting variable is primarily used in the rendering system, particularly in the post-processing stage. Based on the callsites, it appears to be utilized within the Engine module, specifically in the SceneView component.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1.0f, but can be changed at runtime using console commands or through code.
The variable interacts directly with the associated variable CVarDepthOfFieldDepthBlurScale. They share the same value and are used interchangeably in the code.
Developers must be aware of several things when using this variable:
- It only affects the CircleDOF DepthBlur feature.
- The scale is applied after r.DepthOfField.DepthBlur.ResolutionScale.
- A value of 0 disables the Depth Blur effect.
- Positive values multiply the existing Depth Blur Radius.
- Negative values override the existing Depth Blur Radius with their absolute value.
Best practices when using this variable include:
- Use it to fine-tune the Depth of Field effect for optimal visual quality.
- Be cautious when using negative values, as they override rather than scale the existing blur radius.
- Consider the performance impact of increasing the blur radius, especially on lower-end hardware.
Regarding the associated variable CVarDepthOfFieldDepthBlurScale:
The purpose of CVarDepthOfFieldDepthBlurScale is identical to r.DepthOfField.DepthBlur.Scale. It’s the actual console variable implementation that controls the depth blur scale in the Depth of Field effect.
This variable is used in the Engine module, specifically in the SceneView component of the rendering system.
The value is set when the console variable is created, with a default of 1.0f. It can be modified at runtime through console commands or programmatically.
CVarDepthOfFieldDepthBlurScale interacts directly with the DepthBlurRadius variable in the FSceneView::EndFinalPostprocessSettings function. The value from this console variable is used to either scale or override the DepthBlurRadius.
Developers should be aware that changes to this variable will immediately affect the Depth of Field rendering. They should also note the different behaviors for positive and negative values.
Best practices include using this variable for real-time adjustment of the Depth of Field effect during development and fine-tuning, and potentially exposing it as a user-adjustable setting if desired.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:100
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDepthOfFieldDepthBlurScale(
TEXT("r.DepthOfField.DepthBlur.Scale"),
1.0f,
TEXT("This scale multiplier only affects the CircleDOF DepthBlur feature. This is applied after r.DepthOfField.DepthBlur.ResolutionScale.\n")
TEXT(" 0: Disable Depth Blur\n")
TEXT(" x: Multiply the existing Depth Blur Radius with x\n")
TEXT("-x: Override the existing Depth Blur Radius with x\n")
TEXT(" 1: No adjustments (default)"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarDepthOfFieldDepthBlurScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:99
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Cheat);
static TAutoConsoleVariable<float> CVarDepthOfFieldDepthBlurScale(
TEXT("r.DepthOfField.DepthBlur.Scale"),
1.0f,
TEXT("This scale multiplier only affects the CircleDOF DepthBlur feature. This is applied after r.DepthOfField.DepthBlur.ResolutionScale.\n")
TEXT(" 0: Disable Depth Blur\n")
TEXT(" x: Multiply the existing Depth Blur Radius with x\n")
TEXT("-x: Override the existing Depth Blur Radius with x\n")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:2167
Scope (from outer to inner):
file
function void FSceneView::EndFinalPostprocessSettings
Source code excerpt:
}
{
float CVarScale = CVarDepthOfFieldDepthBlurScale.GetValueOnGameThread();
DepthBlurRadius = (CVarScale > 0.0f) ? (DepthBlurRadius * CVarScale) : -CVarScale;
}
}
#endif