r.VRS.SSAO
r.VRS.SSAO
#Overview
name: r.VRS.SSAO
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable VRS with SSAO rendering.\n0: Disabled1: Full2: Conservative (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VRS.SSAO is to control Variable Rate Shading (VRS) for Screen Space Ambient Occlusion (SSAO) rendering in Unreal Engine 5. This setting variable is part of the rendering system, specifically the Variable Rate Shading feature.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the VariableRateShadingImageManager component. This can be seen from the file path where the variable is defined and used: “Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp”.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with three possible values: 0: Disabled 1: Full 2: Conservative (default)
The associated variable that interacts with r.VRS.SSAO is CVarVRS_SSAO. They share the same value and are used interchangeably in the code.
Developers must be aware that changing this variable will affect the performance and visual quality of SSAO rendering. Variable Rate Shading can improve performance by reducing the shading rate in areas of the screen where full detail is less noticeable, but it may also impact visual quality if not used carefully.
Best practices when using this variable include:
- Testing different settings to find the right balance between performance and visual quality for your specific game or application.
- Using the conservative setting (2) as a starting point, as it’s the default and likely provides a good balance.
- Be cautious when enabling full VRS for SSAO (setting 1), as it may cause noticeable visual artifacts in some scenes.
- Consider the target hardware when adjusting this setting, as VRS support and performance impact can vary across different GPUs.
Regarding the associated variable CVarVRS_SSAO: This is the actual console variable object that stores the setting value. It’s used internally by the engine to query the current state of the VRS SSAO setting. Developers typically don’t need to interact with this variable directly, as they can use the r.VRS.SSAO console command to change the setting. However, it’s important to note that this variable is used in the VariableRateShadingImageManager to determine the VRS behavior for SSAO passes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:114
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarVRS_SSAO(
TEXT("r.VRS.SSAO"),
0,
TEXT("Enable VRS with SSAO rendering.\n")
TEXT("0: Disabled")
TEXT("1: Full")
TEXT("2: Conservative (default)"),
FConsoleVariableDelegate::CreateStatic(&CVarVRSImagePassTypeCallback),
#Associated Variable and Callsites
This variable is associated with another variable named CVarVRS_SSAO
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:113
Scope: file
Source code excerpt:
FConsoleVariableDelegate::CreateStatic(&CVarVRSImagePassTypeCallback),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarVRS_SSAO(
TEXT("r.VRS.SSAO"),
0,
TEXT("Enable VRS with SSAO rendering.\n")
TEXT("0: Disabled")
TEXT("1: Full")
TEXT("2: Conservative (default)"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:771
Scope: file
Source code excerpt:
CVarByPassType[EVRSPassType::TranslucencyAll] = &CVarVRSTranslucency;
CVarByPassType[EVRSPassType::NaniteEmitGBufferPass] = &CVarVRSNaniteEmitGBuffer;
CVarByPassType[EVRSPassType::SSAO] = &CVarVRS_SSAO;
CVarByPassType[EVRSPassType::SSR] = &CVarVRS_SSR;
CVarByPassType[EVRSPassType::ReflectionEnvironmentAndSky] = &CVarVRSReflectionEnvironmentSky;
CVarByPassType[EVRSPassType::LightFunctions] = &CVarVRSLightFunctions;
CVarByPassType[EVRSPassType::Decals] = &CVarVRSDecals;
}
} StaticData;