r.FastVRam.CircleDOF

r.FastVRam.CircleDOF

#Overview

name: r.FastVRam.CircleDOF

This variable is created as a Console Variable (cvar).

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.FastVRam.CircleDOF is to control the allocation of fast VRAM for the Circle Depth of Field (DOF) effect in Unreal Engine’s rendering system. This setting is part of the engine’s optimization strategy for managing video memory usage and performance.

The Unreal Engine subsystem that primarily relies on this setting variable is the Renderer module, specifically the post-processing pipeline for depth of field effects. This can be seen from the references in the SceneRendering.cpp and SceneRendering.h files.

The value of this variable is set using the FASTVRAM_CVAR macro, which likely creates a console variable (CVar) that can be adjusted at runtime or set in configuration files.

This variable interacts with the associated variable CircleDOF, which is part of the FFastVramConfig struct. The r.FastVRam.CircleDOF CVar is used to update the CircleDOF flag in this struct, which determines the texture creation flags for Circle DOF-related textures.

Developers must be aware that changing this variable affects memory allocation for the Circle DOF effect. Setting it to 1 (default) enables the use of fast VRAM for Circle DOF textures, which can improve performance but may increase memory usage on the GPU.

Best practices when using this variable include:

  1. Only modify it if you’re experiencing performance issues related to DOF or memory constraints.
  2. Monitor GPU memory usage when adjusting this setting.
  3. Consider the target hardware capabilities when deciding whether to use fast VRAM for this effect.

Regarding the associated variable CircleDOF:

The purpose of CircleDOF is to store the texture creation flags for Circle Depth of Field textures within the FFastVramConfig struct. This variable is used by the rendering system to determine how to allocate memory for Circle DOF-related textures.

It is part of the Renderer module and is used in conjunction with other post-processing effect flags to manage texture creation.

The value of this variable is set in the FFastVramConfig::Update function, based on the value of the r.FastVRam.CircleDOF console variable.

CircleDOF interacts with the r.FastVRam.CircleDOF CVar and other FastVRam settings within the FFastVramConfig struct.

Developers should be aware that this variable directly affects how Circle DOF textures are created and stored in memory. Changing its value may impact rendering performance and memory usage.

Best practices for using CircleDOF include:

  1. Understand the memory implications of enabling or disabling fast VRAM for Circle DOF.
  2. Consider the performance trade-offs on different hardware configurations.
  3. Use in conjunction with other FastVRam settings to optimize overall rendering performance.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:471

Scope: file

Source code excerpt:

FASTVRAM_CVAR(Bloom, 1);
FASTVRAM_CVAR(BokehDOF, 1);
FASTVRAM_CVAR(CircleDOF, 1);
FASTVRAM_CVAR(CombineLUTs, 1);
FASTVRAM_CVAR(Downsample, 1);
FASTVRAM_CVAR(EyeAdaptation, 1);
FASTVRAM_CVAR(Histogram, 1);
FASTVRAM_CVAR(HistogramReduce, 1);
FASTVRAM_CVAR(VelocityFlat, 1);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Scene.h:2085

Scope: file

Source code excerpt:

	float DepthOfFieldFocalDistance;

	/** CircleDOF only: Depth blur km for 50% */
	UPROPERTY(interp, EditAnywhere, BlueprintReadWrite, Category="Lens|Depth of Field", meta=(ClampMin = "0.000001", ClampMax = "100.0", editcondition = "bOverride_DepthOfFieldDepthBlurAmount", DisplayName = "Depth Blur km for 50%"))
	float DepthOfFieldDepthBlurAmount;

	/** CircleDOF only: Depth blur radius in pixels at 1920x */
	UPROPERTY(interp, EditAnywhere, BlueprintReadWrite, Category="Lens|Depth of Field", meta=(ClampMin = "0.0", UIMax = "4.0", editcondition = "bOverride_DepthOfFieldDepthBlurRadius", DisplayName = "Depth Blur Radius"))
	float DepthOfFieldDepthBlurRadius;

	/** For depth of field to use the hair depth for computing circle of confusion size. Otherwise use an interpolated distance between the hair depth and the scene depth based on the hair coverage (default). */
	UPROPERTY(interp, EditAnywhere, BlueprintReadWrite, Category="Lens|Depth of Field", AdvancedDisplay, meta=(editcondition = "bOverride_DepthOfFieldUseHairDepth", DisplayName = "Use Hair Depth"))
	uint32 DepthOfFieldUseHairDepth:1;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Materials/MaterialExpressionDepthOfFieldFunction.h:19

Scope: file

Source code excerpt:

	/** 0:in Focus or Near .. 1:Far. */
	TDOF_FarMask,
	/** in pixels, only works for CircleDOF, use Abs for the actual radius as the sign of the value indicates near out of focus, positive indicates far out of focus */
	TDOF_CircleOfConfusionRadius,
	TDOF_MAX,
};

UCLASS()
class UMaterialExpressionDepthOfFieldFunction : public UMaterialExpression

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Scene.cpp:781

Scope (from outer to inner):

file
function     void FPostProcessSettings::PostSerialize

Source code excerpt:

			else if (DepthOfFieldMethod_DEPRECATED != DOFM_CircleDOF)
			{
				// Aggressively force disable DOF by setting default value on the focal distance to be invalid if the method was not CircleDOF, in case.
				// it focal distance was modified if even if DOF was in the end disabled.
				DepthOfFieldFocalDistance = 0.0f;
			}

			// Make sure gaussian DOF is disabled on mobile if the DOF method was set to something else.
			if (DepthOfFieldMethod_DEPRECATED != DOFM_Gaussian)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:471

Scope: file

Source code excerpt:

FASTVRAM_CVAR(Bloom, 1);
FASTVRAM_CVAR(BokehDOF, 1);
FASTVRAM_CVAR(CircleDOF, 1);
FASTVRAM_CVAR(CombineLUTs, 1);
FASTVRAM_CVAR(Downsample, 1);
FASTVRAM_CVAR(EyeAdaptation, 1);
FASTVRAM_CVAR(Histogram, 1);
FASTVRAM_CVAR(HistogramReduce, 1);
FASTVRAM_CVAR(VelocityFlat, 1);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:671

Scope (from outer to inner):

file
function     void FFastVramConfig::Update

Source code excerpt:

	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Bloom, Bloom);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_BokehDOF, BokehDOF);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CircleDOF, CircleDOF);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CombineLUTs, CombineLUTs);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Downsample, Downsample);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_EyeAdaptation, EyeAdaptation);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Histogram, Histogram);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_HistogramReduce, HistogramReduce);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_VelocityFlat, VelocityFlat);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2820

Scope: file

Source code excerpt:

	ETextureCreateFlags Bloom;
	ETextureCreateFlags BokehDOF;
	ETextureCreateFlags CircleDOF;
	ETextureCreateFlags CombineLUTs;
	ETextureCreateFlags Downsample;
	ETextureCreateFlags EyeAdaptation;
	ETextureCreateFlags Histogram;
	ETextureCreateFlags HistogramReduce;
	ETextureCreateFlags VelocityFlat;