r.DOF.Gather.ResolutionDivisor

r.DOF.Gather.ResolutionDivisor

#Overview

name: r.DOF.Gather.ResolutionDivisor

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).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.DOF.Gather.ResolutionDivisor is to control the resolution of the gathering pass in the Depth of Field (DOF) effect within Unreal Engine’s rendering system. This setting variable allows developers to adjust the performance and quality trade-off for the DOF effect.

This setting variable is primarily used by the rendering system, specifically in the post-processing pipeline for Depth of Field effects. It is part of the DiaphragmDOF module within the Renderer subsystem.

The value of this variable is set through the console variable system in Unreal Engine. It is defined as a TAutoConsoleVariable with a default value of 2, which means the gathering pass is performed at half resolution by default.

The associated variable CVarDOFGatherResDivisor directly interacts with r.DOF.Gather.ResolutionDivisor. They share the same value and purpose.

Developers must be aware that this variable affects both performance and visual quality. Setting it to 1 will perform the gathering pass at full resolution, potentially increasing quality but at a higher performance cost. Setting it to 2 (the default) performs the pass at half resolution, which is a balance between quality and performance.

Best practices when using this variable include:

  1. Use the default value (2) for most scenarios as it provides a good balance.
  2. Consider setting it to 1 for high-end systems or when prioritizing visual quality.
  3. Test the visual impact and performance implications when changing this value.
  4. Be aware that changing this value at runtime may affect the consistency of the DOF effect.

Regarding the associated variable CVarDOFGatherResDivisor:

The purpose of CVarDOFGatherResDivisor is identical to r.DOF.Gather.ResolutionDivisor. It’s the actual console variable implementation that controls the DOF gather resolution divisor.

This variable is used directly in the DiaphragmDOF module of the rendering system. It’s accessed in the AddPasses function to determine the PrefilteringResolutionDivisor.

The value of CVarDOFGatherResDivisor is set when the console variable is defined, with a default value of 2. It can be changed at runtime through console commands.

CVarDOFGatherResDivisor interacts directly with the rendering code that implements the Depth of Field effect. It’s used to determine whether to perform the gathering pass at full or half resolution.

Developers should be aware that this variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, meaning it can be safely changed for scalability purposes and is safe to modify from the render thread.

Best practices for CVarDOFGatherResDivisor are the same as for r.DOF.Gather.ResolutionDivisor, as they represent the same setting. Developers should use the console variable system to modify this value when needed, and consider the performance-quality trade-offs when doing so.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:429, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:462, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:497, section: [PostProcessQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:535, section: [PostProcessQuality@Cine]

#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:32

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarDOFGatherResDivisor(
	TEXT("r.DOF.Gather.ResolutionDivisor"), 2,
	TEXT("Selects the resolution divisor of the gather pass.\n")
	TEXT(" 1: Do gathering pass at full resolution;\n")
	TEXT(" 2: Do gathering pass at half resolution (default)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarAccumulatorQuality(

#Associated Variable and Callsites

This variable is associated with another variable named CVarDOFGatherResDivisor. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:31

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

DECLARE_GPU_STAT(DepthOfField)

TAutoConsoleVariable<int32> CVarDOFGatherResDivisor(
	TEXT("r.DOF.Gather.ResolutionDivisor"), 2,
	TEXT("Selects the resolution divisor of the gather pass.\n")
	TEXT(" 1: Do gathering pass at full resolution;\n")
	TEXT(" 2: Do gathering pass at half resolution (default)."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:1419

Scope (from outer to inner):

file
function     bool DiaphragmDOF::AddPasses

Source code excerpt:


	// Resolution divisor.
	const int32 PrefilteringResolutionDivisor = CVarDOFGatherResDivisor.GetValueOnRenderThread() >= 2 ? 2 : 1;

	// Minimal absolute Coc radius to spawn a gather pass. Blurring radius under this are considered not great looking.
	// This is assuming the pass is opacity blending with a ramp from 1 to 2. This can not be exposed as a cvar,
	// because the slight out focus's lower res pass uses for full res convolution stability depends on this.
	const float kMinimalAbsGatherPassCocRadius = 1;