r.FastVRam.DistanceFieldAOHistory
r.FastVRam.DistanceFieldAOHistory
#Overview
name: r.FastVRam.DistanceFieldAOHistory
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FastVRam.DistanceFieldAOHistory is to control the texture creation flags for the Distance Field Ambient Occlusion (DFAO) history buffer in Unreal Engine 5’s rendering system. This setting is part of the Fast VRAM configuration, which allows developers to optimize memory usage and performance for specific rendering features.
- The r.FastVRam.DistanceFieldAOHistory variable is primarily used by the rendering system, specifically in the Distance Field Ambient Occlusion feature.
- It is part of the FFastVramConfig struct, which is used to manage Fast VRAM settings for various rendering features.
- The value of this variable is set through a console variable (CVar) named CVarFastVRam_DistanceFieldAOHistory.
- This variable interacts with other Distance Field-related variables in the Fast VRAM configuration, such as DistanceFieldNormal, DistanceFieldAOBentNormal, and DistanceFieldAODownsampledBentNormal.
Developers should be aware of the following when using this variable:
- Changing this setting can affect memory usage and performance, especially on platforms with limited or shared video memory.
- The impact of this setting may vary depending on the hardware and the specific use case of Distance Field Ambient Occlusion in the project.
- Adjusting this setting might require balancing with other Fast VRAM settings to achieve optimal performance.
Best practices when using this variable include:
- Profiling the application’s performance and memory usage with different values for this setting.
- Considering the target hardware specifications when adjusting this setting.
- Testing the visual quality of DFAO with different Fast VRAM configurations to ensure no significant degradation occurs.
- Coordinating changes to this setting with other Distance Field-related settings for consistent performance and quality.
The associated variable DistanceFieldAOHistory is used in various parts of the rendering code, particularly in the UpdateHistory function and when allocating render targets for DFAO. It determines the texture creation flags for the DFAO history buffer, which can affect how the texture is stored and accessed in memory.
When using DistanceFieldAOHistory, developers should:
- Understand that it directly affects the memory allocation and possibly the performance of the DFAO feature.
- Be aware that changes to this variable may require adjustments to related Distance Field settings for optimal results.
- Consider the implications on different hardware, especially those with limited or shared video memory.
- Test thoroughly after making changes to ensure that DFAO quality and performance meet the project’s requirements.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:483
Scope: file
Source code excerpt:
FASTVRAM_CVAR(Upscale, 1);
FASTVRAM_CVAR(DistanceFieldNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOHistory, 1);
FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0);
FASTVRAM_CVAR(DistanceFieldIrradiance, 0);
FASTVRAM_CVAR(DistanceFieldShadows, 1);
FASTVRAM_CVAR(Distortion, 1);
FASTVRAM_CVAR(ScreenSpaceShadowMask, 1);
#Associated Variable and Callsites
This variable is associated with another variable named DistanceFieldAOHistory
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldLightingPost.cpp:335
Scope (from outer to inner):
file
function void UpdateHistory
Source code excerpt:
FRDGTextureRef BentNormalHistoryTexture = GraphBuilder.RegisterExternalTexture(*BentNormalHistoryState);
ETextureCreateFlags HistoryPassOutputFlags = ETextureCreateFlags(UseAOHistoryStabilityPass() ? GFastVRamConfig.DistanceFieldAOHistory : TexCreate_None);
// Reuse a render target from the pool with a consistent name, for vis purposes
FRDGTextureRef NewBentNormalHistory = nullptr;
AllocateOrReuseAORenderTarget(GraphBuilder, View, NewBentNormalHistory, BentNormalHistoryRTName, PF_FloatRGBA, HistoryPassOutputFlags);
{
FIntRect PrevHistoryViewRect = *DistanceFieldAOHistoryViewRect;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldLightingPost.cpp:504
Scope (from outer to inner):
file
function void UpdateHistory
Source code excerpt:
// Use the current frame's upscaled mask for next frame's history
FRDGTextureRef DistanceFieldAOBentNormal = nullptr;
AllocateOrReuseAORenderTarget(GraphBuilder, View, DistanceFieldAOBentNormal, TEXT("PerViewDistanceFieldBentNormalAO"), PF_FloatRGBA, GFastVRamConfig.DistanceFieldAOHistory);
GeometryAwareUpsample(GraphBuilder, View, DistanceFieldAOBentNormal, DistanceFieldNormal, BentNormalInterpolation, Parameters);
GraphBuilder.QueueTextureExtraction(DistanceFieldAOBentNormal, BentNormalHistoryState);
BentNormalHistoryOutput = DistanceFieldAOBentNormal;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldLightingPost.cpp:519
Scope (from outer to inner):
file
function void UpdateHistory
Source code excerpt:
// Temporal reprojection is disabled or there is no view state - just upscale
FRDGTextureRef DistanceFieldAOBentNormal = nullptr;
AllocateOrReuseAORenderTarget(GraphBuilder, View, DistanceFieldAOBentNormal, TEXT("PerViewDistanceFieldBentNormalAO"), PF_FloatRGBA, GFastVRamConfig.DistanceFieldAOHistory);
GeometryAwareUpsample(GraphBuilder, View, DistanceFieldAOBentNormal, DistanceFieldNormal, BentNormalInterpolation, Parameters);
BentNormalHistoryOutput = DistanceFieldAOBentNormal;
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldScreenGridLighting.cpp:277
Scope (from outer to inner):
file
function void PostProcessBentNormalAOScreenGrid
Source code excerpt:
GraphBuilder,
View,
TEXT("DistanceFieldAOHistory"),
SceneTexturesUniformBuffer,
VelocityTexture,
DistanceFieldNormal,
BentNormalInterpolation,
DistanceFieldAOHistoryViewRect,
BentNormalHistoryState,
BentNormalOutput,
Parameters);
}
void FDeferredShadingSceneRenderer::RenderDistanceFieldAOScreenGrid(
FRDGBuilder& GraphBuilder,
const FSceneTextures& SceneTextures,
const FViewInfo& View,
const FDistanceFieldCulledObjectBufferParameters& CulledObjectBufferParameters,
FRDGBufferRef ObjectTilesIndirectArguments,
const FTileIntersectionParameters& TileIntersectionParameters,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:483
Scope: file
Source code excerpt:
FASTVRAM_CVAR(Upscale, 1);
FASTVRAM_CVAR(DistanceFieldNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOHistory, 1);
FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0);
FASTVRAM_CVAR(DistanceFieldIrradiance, 0);
FASTVRAM_CVAR(DistanceFieldShadows, 1);
FASTVRAM_CVAR(Distortion, 1);
FASTVRAM_CVAR(ScreenSpaceShadowMask, 1);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:683
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Upscale, Upscale);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldNormal, DistanceFieldNormal);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOHistory, DistanceFieldAOHistory);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAODownsampledBentNormal, DistanceFieldAODownsampledBentNormal);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOBentNormal, DistanceFieldAOBentNormal);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldIrradiance, DistanceFieldIrradiance);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldShadows, DistanceFieldShadows);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Distortion, Distortion);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ScreenSpaceShadowMask, ScreenSpaceShadowMask);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2832
Scope: file
Source code excerpt:
ETextureCreateFlags Upscale;
ETextureCreateFlags DistanceFieldNormal;
ETextureCreateFlags DistanceFieldAOHistory;
ETextureCreateFlags DistanceFieldAOBentNormal;
ETextureCreateFlags DistanceFieldAODownsampledBentNormal;
ETextureCreateFlags DistanceFieldShadows;
ETextureCreateFlags DistanceFieldIrradiance;
ETextureCreateFlags DistanceFieldAOConfidence;
ETextureCreateFlags Distortion;