r.DistanceFieldAO.MultiView
r.DistanceFieldAO.MultiView
#Overview
name: r.DistanceFieldAO.MultiView
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether the distance field AO feature is allowed when rendering multiple views.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DistanceFieldAO.MultiView is to control whether the Distance Field Ambient Occlusion (DFAO) feature is allowed when rendering multiple views in Unreal Engine 5. This setting variable is primarily related to the rendering system, specifically the ambient occlusion aspect of lighting.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its location in the DistanceFieldAmbientOcclusion.cpp file within the Runtime/Renderer/Private directory.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) and can be modified at runtime using console commands.
The associated variable GDistanceFieldAOMultiView directly interacts with r.DistanceFieldAO.MultiView. They share the same value, with GDistanceFieldAOMultiView being the C++ variable that the engine code uses internally.
Developers must be aware that this variable affects performance and visual quality when rendering multiple views. If disabled (set to 0), it will prevent DFAO from being rendered in multi-view scenarios, which could be beneficial for performance but at the cost of visual quality.
Best practices when using this variable include:
- Enabling it (set to 1) for highest visual quality in multi-view scenarios.
- Disabling it (set to 0) if performance is a concern and the visual impact is acceptable.
- Testing both enabled and disabled states to find the right balance between performance and visual quality for your specific project.
Regarding the associated variable GDistanceFieldAOMultiView:
The purpose of GDistanceFieldAOMultiView is to serve as the internal C++ representation of the r.DistanceFieldAO.MultiView console variable. It’s used directly in the engine code to determine whether to render distance field ambient occlusion in multi-view scenarios.
This variable is used in the Renderer module, specifically in the DistanceFieldAmbientOcclusion.cpp file.
Its value is set by the console variable system, mirroring the value of r.DistanceFieldAO.MultiView.
GDistanceFieldAOMultiView interacts directly with the ShouldRenderDistanceFieldLighting function, which uses it to determine whether to proceed with distance field lighting calculations in multi-view scenarios.
Developers should be aware that modifying GDistanceFieldAOMultiView directly in C++ code is not recommended. Instead, they should use the console variable r.DistanceFieldAO.MultiView to control this setting.
The best practice is to treat GDistanceFieldAOMultiView as a read-only variable in C++ code, using it for conditional logic related to distance field ambient occlusion in multi-view rendering scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:32
Scope: file
Source code excerpt:
int32 GDistanceFieldAOMultiView = 1;
FAutoConsoleVariableRef CVarDistanceFieldAOMultiView(
TEXT("r.DistanceFieldAO.MultiView"),
GDistanceFieldAOMultiView,
TEXT("Whether the distance field AO feature is allowed when rendering multiple views."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GDistanceFieldAOQuality = 2;
#Associated Variable and Callsites
This variable is associated with another variable named GDistanceFieldAOMultiView
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:30
Scope: file
Source code excerpt:
);
int32 GDistanceFieldAOMultiView = 1;
FAutoConsoleVariableRef CVarDistanceFieldAOMultiView(
TEXT("r.DistanceFieldAO.MultiView"),
GDistanceFieldAOMultiView,
TEXT("Whether the distance field AO feature is allowed when rendering multiple views."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GDistanceFieldAOQuality = 2;
FAutoConsoleVariableRef CVarDistanceFieldAOQuality(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:802
Scope (from outer to inner):
file
function bool FDeferredShadingSceneRenderer::ShouldRenderDistanceFieldLighting
Source code excerpt:
bool FDeferredShadingSceneRenderer::ShouldRenderDistanceFieldLighting() const
{
if (!GDistanceFieldAOMultiView && Views.Num() > 1)
{
return false;
}
bool bSupportsDistanceFieldAO = true;