r.AmbientOcclusion.Compute.Smooth
r.AmbientOcclusion.Compute.Smooth
#Overview
name: r.AmbientOcclusion.Compute.Smooth
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to smooth SSAO output when TAA is disabled
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.AmbientOcclusion.Compute.Smooth is to control whether to smooth the Screen Space Ambient Occlusion (SSAO) output when Temporal Anti-Aliasing (TAA) is disabled. This setting variable is part of the rendering system in Unreal Engine 5, specifically related to post-processing and lighting effects.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the composition lighting component. This can be seen from the file path where the variable is defined: Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1, meaning the smoothing is enabled by default.
This variable interacts with the View.AntiAliasingMethod and is used in conjunction with other SSAO-related parameters. It’s specifically used when determining if a smoothing pass is needed for SSAO output.
Developers must be aware that this variable only has an effect when TAA is disabled and when using the compute shader version of SSAO (not the pixel shader version). It’s also important to note that this setting is marked as render thread safe and scalable, meaning it can be changed at runtime and might affect performance.
Best practices when using this variable include:
- Consider the performance impact of enabling the smoothing pass.
- Test the visual quality difference with and without smoothing when TAA is disabled.
- Be aware of how this setting interacts with other anti-aliasing methods.
Regarding the associated variable CVarSSAOSmoothPass:
The purpose of CVarSSAOSmoothPass is to serve as the actual console variable that controls the r.AmbientOcclusion.Compute.Smooth setting. It’s the programmatic representation of the setting that can be queried and modified at runtime.
This variable is defined in the same Renderer module and is used to determine whether to apply the SSAO smoothing pass.
The value of CVarSSAOSmoothPass is set when the engine initializes the console variables, and it can be changed at runtime through console commands.
CVarSSAOSmoothPass interacts directly with the SSAO computation logic, specifically in the GetSSAOCommonParameters function.
Developers should be aware that changes to CVarSSAOSmoothPass will immediately affect the SSAO rendering pipeline. It’s thread-safe for the render thread and can be adjusted for scalability purposes.
Best practices for using CVarSSAOSmoothPass include:
- Use it in conjunction with profiling tools to understand its performance impact.
- Consider exposing it as a user-configurable setting if SSAO quality is important for your game.
- Be cautious when changing its value dynamically, as it may cause visible changes in the rendering output.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:21
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSSAOSmoothPass(
TEXT("r.AmbientOcclusion.Compute.Smooth"),
1,
TEXT("Whether to smooth SSAO output when TAA is disabled"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarGTAODownsample(
TEXT("r.GTAO.Downsample"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSAOSmoothPass
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:20
Scope: file
Source code excerpt:
DECLARE_GPU_STAT_NAMED(CompositionPostLighting, TEXT("Composition PostLighting") );
static TAutoConsoleVariable<int32> CVarSSAOSmoothPass(
TEXT("r.AmbientOcclusion.Compute.Smooth"),
1,
TEXT("Whether to smooth SSAO output when TAA is disabled"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarGTAODownsample(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:143
Scope (from outer to inner):
file
function static FSSAOCommonParameters GetSSAOCommonParameters
Source code excerpt:
// If there is no temporal upsampling, we need a smooth pass to get rid of the grid pattern.
// Pixel shader version has relatively smooth result so no need to do extra work.
CommonParameters.bNeedSmoothingPass = CommonParameters.FullscreenType != ESSAOType::EPS && !IsTemporalAccumulationBasedMethod(View.AntiAliasingMethod) && CVarSSAOSmoothPass.GetValueOnRenderThread();
return CommonParameters;
}
FGTAOCommonParameters GetGTAOCommonParameters(
FRDGBuilder& GraphBuilder,