r.SSGI.Quality
r.SSGI.Quality
#Overview
name: r.SSGI.Quality
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Quality setting to control number of ray shot with SSGI, between 1 and 4 (defaults to 4).\n
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SSGI.Quality is to control the quality settings for Screen Space Global Illumination (SSGI) in Unreal Engine’s rendering system. Specifically, it determines the number of rays shot with SSGI, ranging from 1 to 4, with a default value of 4.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the Screen Space Ray Tracing subsystem. It directly impacts the performance and visual quality of global illumination calculations in screen space.
The value of this variable is set through a console variable (CVarSSGIQuality) in the ScreenSpaceRayTracing.cpp file. It can be modified at runtime using console commands or through engine configuration files.
The r.SSGI.Quality variable interacts closely with other SSGI-related variables and functions. For example, it’s used in conjunction with GetSSRTGIShaderOptionsForQuality to determine the number of rays per pixel for SSGI calculations.
Developers should be aware that:
- Higher quality settings (closer to 4) will provide better visual results but at the cost of performance.
- The value is clamped between 1 and 4 in actual usage to prevent invalid settings.
- This setting affects both the quality and performance of global illumination, so it should be balanced carefully based on the target hardware and desired visual fidelity.
Best practices when using this variable include:
- Adjusting it based on the performance requirements of the target platform.
- Using it in conjunction with other SSGI settings for optimal results.
- Testing different values to find the best balance between visual quality and performance for your specific scene.
The associated variable CVarSSGIQuality is the actual console variable that stores and manages the r.SSGI.Quality setting. It’s defined as a TAutoConsoleVariable
CVarSSGIQuality is used directly in the code to retrieve the current SSGI quality setting. It’s accessed using the GetValueOnRenderThread() method, ensuring thread-safe access in the render thread.
When working with CVarSSGIQuality, developers should:
- Use GetValueOnRenderThread() when accessing it from render thread code.
- Be aware that changes to this variable will immediately affect SSGI calculations.
- Consider exposing this setting in user-facing graphics options if allowing players to adjust SSGI quality is desired.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:623, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:650, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:677, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:704, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
3
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:732, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
4
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:52
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSSGIQuality(
TEXT("r.SSGI.Quality"), 4,
TEXT("Quality setting to control number of ray shot with SSGI, between 1 and 4 (defaults to 4).\n"),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarSSGIMinimumLuminance(
TEXT("r.SSGI.MinimumLuminance"), 0.5f,
TEXT(""),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSSGIQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:51
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSSGIQuality(
TEXT("r.SSGI.Quality"), 4,
TEXT("Quality setting to control number of ray shot with SSGI, between 1 and 4 (defaults to 4).\n"),
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarSSGIMinimumLuminance(
TEXT("r.SSGI.MinimumLuminance"), 0.5f,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:97
Scope (from outer to inner):
file
function static bool SupportScreenSpaceDiffuseIndirect
Source code excerpt:
}
int Quality = CVarSSGIQuality.GetValueOnRenderThread();
if (Quality <= 0)
{
return false;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:1313
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function int32 GetSSGIRayCountPerTracingPixel
Source code excerpt:
int32 GetSSGIRayCountPerTracingPixel()
{
const int32 Quality = FMath::Clamp(CVarSSGIQuality.GetValueOnRenderThread(), 1, 4);
int32 RayCountPerPixel;
GetSSRTGIShaderOptionsForQuality(Quality, /* out */ &RayCountPerPixel);
return RayCountPerPixel;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:1328
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function IScreenSpaceDenoiser::FDiffuseIndirectInputs CastStandaloneDiffuseIndirectRays
Source code excerpt:
const FViewInfo& View)
{
const int32 Quality = FMath::Clamp(CVarSSGIQuality.GetValueOnRenderThread(), 1, 4);
int32 RayCountPerPixel;
GetSSRTGIShaderOptionsForQuality(Quality, &RayCountPerPixel);
check(RayCountPerPixel == CommonParameters.RayCountPerPixel);
FIntPoint GroupSize = GetSSRTGroupSizeForSampleCount(CommonParameters.RayCountPerPixel);