r.DOF.Gather.PostfilterMethod
r.DOF.Gather.PostfilterMethod
#Overview
name: r.DOF.Gather.PostfilterMethod
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:
Method to use to post filter a gather pass.\n 0: None;\n 1: Per RGB channel median 3x3 (default);\n 2: Per RGB channel max 3x3.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DOF.Gather.PostfilterMethod is to control the post-filtering method used in the Depth of Field (DOF) gather pass of the rendering system. This setting variable is specifically related to the Diaphragm Depth of Field implementation in Unreal Engine 5.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the post-processing subsystem that handles Depth of Field effects. Based on the callsites, it’s clear that this variable is utilized in the DiaphragmDOF.cpp file, which is part of the post-processing pipeline.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 1, which corresponds to the default setting of “Per RGB channel median 3x3”.
The associated variable CVarPostFilteringMethod directly interacts with r.DOF.Gather.PostfilterMethod. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the quality and performance of the Depth of Field effect. The chosen method can impact both the visual result and the rendering performance. The available options are: 0: No post-filtering 1: Per RGB channel median 3x3 (default) 2: Per RGB channel max 3x3
When using this variable, best practices include:
- Consider the performance implications of each option, especially for lower-end hardware.
- Test the visual quality of each setting to ensure it meets the desired artistic direction.
- Be mindful of how changes to this setting might interact with other DOF-related settings.
- Use the console command system to experiment with different values during development.
Regarding the associated variable CVarPostFilteringMethod: This is the actual C++ variable that stores the value of the r.DOF.Gather.PostfilterMethod console variable. It’s used internally by the engine to retrieve the current setting value, as seen in the GetPostfilteringMethod() function.
When working with CVarPostFilteringMethod, developers should:
- Use GetValueOnRenderThread() to safely access its value from the render thread.
- Be aware that it returns an int32, which is then cast to the EDiaphragmDOFPostfilterMethod enum.
- Implement proper error checking when using the value, as demonstrated in the GetPostfilteringMethod() function, to handle potential out-of-range values.
By understanding both r.DOF.Gather.PostfilterMethod and its associated C++ variable CVarPostFilteringMethod, developers can effectively control and optimize the post-filtering method used in the Diaphragm Depth of Field effect in Unreal Engine 5.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:431, section: [PostProcessQuality@1]
- INI Section:
PostProcessQuality@1
- Raw value:
2 ; Max3x3 postfilering method
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:464, section: [PostProcessQuality@2]
- INI Section:
PostProcessQuality@2
- Raw value:
2 ; Max3x3 postfilering method
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:499, section: [PostProcessQuality@3]
- INI Section:
PostProcessQuality@3
- Raw value:
1 ; Median3x3 postfilering method
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:537, section: [PostProcessQuality@Cine]
- INI Section:
PostProcessQuality@Cine
- Raw value:
1 ; Median3x3 postfilering method
- 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:52
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarPostFilteringMethod(
TEXT("r.DOF.Gather.PostfilterMethod"),
1,
TEXT("Method to use to post filter a gather pass.\n")
TEXT(" 0: None;\n")
TEXT(" 1: Per RGB channel median 3x3 (default);\n")
TEXT(" 2: Per RGB channel max 3x3."),
ECVF_Scalability | ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named CVarPostFilteringMethod
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:51
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarPostFilteringMethod(
TEXT("r.DOF.Gather.PostfilterMethod"),
1,
TEXT("Method to use to post filter a gather pass.\n")
TEXT(" 0: None;\n")
TEXT(" 1: Per RGB channel median 3x3 (default);\n")
TEXT(" 2: Per RGB channel max 3x3."),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:316
Scope (from outer to inner):
file
namespace anonymous
function EDiaphragmDOFPostfilterMethod GetPostfilteringMethod
Source code excerpt:
EDiaphragmDOFPostfilterMethod GetPostfilteringMethod()
{
int32 i = CVarPostFilteringMethod.GetValueOnRenderThread();
if (i >= 0 && i < int32(EDiaphragmDOFPostfilterMethod::MAX))
{
return EDiaphragmDOFPostfilterMethod(i);
}
return EDiaphragmDOFPostfilterMethod::None;
}