r.SSR.Quality

r.SSR.Quality

#Overview

name: r.SSR.Quality

The value of this variable can be defined or overridden in .ini config files. 6 .ini config files referencing this setting variable.

This variable is created as a Console Variable (cvar).

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.SSR.Quality is to control the quality of screen space reflections (SSR) in Unreal Engine 5’s rendering system. This setting variable determines whether to use screen space reflections and at what quality level.

The Unreal Engine subsystem that primarily relies on this setting variable is the Renderer module, specifically the screen space ray tracing and translucent rendering components.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 3, but can be changed at runtime through console commands or programmatically.

The associated variable CVarSSRQuality interacts directly with r.SSR.Quality. They share the same value and are used interchangeably in the code.

Developers must be aware that:

  1. This variable affects performance and visual quality. Higher values provide more realistic reflections but at a higher performance cost.
  2. The quality levels range from 0 (off) to 3 (high), with additional special values for different quality settings.
  3. This setting can limit the post-process settings, which use a different scale.
  4. It affects both general screen space reflections and water-specific reflections.

Best practices when using this variable include:

  1. Consider the target hardware when setting the quality level.
  2. Balance between visual quality and performance based on the specific needs of your game or application.
  3. Test different quality levels to find the optimal setting for your specific use case.
  4. Be aware that turning off SSR (setting to 0) can significantly impact visual quality but may be necessary for performance on lower-end hardware.

Regarding the associated variable CVarSSRQuality: The purpose of CVarSSRQuality is to provide a programmatic interface to control the SSR quality setting. It’s used internally by the engine to access and modify the r.SSR.Quality value.

CVarSSRQuality is defined and used within the Renderer module, specifically in the screen space ray tracing implementation.

The value of CVarSSRQuality is set when r.SSR.Quality is modified, as they share the same underlying value.

Developers should be aware that CVarSSRQuality is the internal representation of r.SSR.Quality and is used in the actual rendering code to determine SSR behavior.

Best practices for CVarSSRQuality include using it for runtime modifications of SSR quality and for retrieving the current SSR quality setting in C++ code.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:909, section: [Android_Vulkan_SM5 DeviceProfile]

Location: <Workspace>/Engine/Config/BaseScalability.ini:345, section: [ReflectionQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:350, section: [ReflectionQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:355, section: [ReflectionQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:365, section: [ReflectionQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:375, section: [ReflectionQuality@Cine]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:12

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSSRQuality(
	TEXT("r.SSR.Quality"),
	3,
	TEXT("Whether to use screen space reflections and at what quality setting.\n")
	TEXT("(limits the setting in the post process settings which has a different scale)\n")
	TEXT("(costs performance, adds more visual realism but the technique has limits)\n")
	TEXT(" 0: off (default)\n")
	TEXT(" 1: low (no glossy)\n")

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:243

Scope (from outer to inner):

file
function     FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup

Source code excerpt:

	, DefaultFeature_MotionBlur(TEXT("r.DefaultFeature.MotionBlur"))
	, MotionBlurQuality(TEXT("r.MotionBlurQuality"))
	, ScreenSpaceReflectionQuality(TEXT("r.SSR.Quality"))
	, EyeAdaptationQuality(TEXT("r.EyeAdaptationQuality"))
	, ContactShadows(TEXT("r.ContactShadows"))
	, TonemapperGamma(TEXT("r.TonemapperGamma"))
	, TonemapperSharpen(TEXT("r.Tonemapper.Sharpen"))
	, ScreenPercentage(TEXT("r.ScreenPercentage"))
	, DynamicResTestScreenPercentage(TEXT("r.DynamicRes.TestScreenPercentage"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SingleLayerWaterRendering.cpp:191

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     bool ShouldRenderScreenSpaceReflectionsWater

Source code excerpt:

	}

	static const auto SSRQualityCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SSR.Quality"));
	int SSRQuality = SSRQualityCVar ? SSRQualityCVar->GetValueOnRenderThread() : 0;
	if (SSRQuality <= 0 
		|| View.FinalPostProcessSettings.ScreenSpaceReflectionIntensity < 1.0f 
		|| IsForwardShadingEnabled(View.GetShaderPlatform()))
	{
		return false;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:242

Scope (from outer to inner):

file
function     static int GetSSRQuality

Source code excerpt:

static int GetSSRQuality()
{
	static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SSR.Quality"));
	int SSRQuality = CVar ? (CVar->GetInt()) : 0;
	return SSRQuality;
}

static bool ShouldRenderTranslucencyScreenSpaceReflections(const FViewInfo& View)
{

#Associated Variable and Callsites

This variable is associated with another variable named CVarSSRQuality. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:11

Scope: file

Source code excerpt:

#include "VariableRateShadingImageManager.h"

static TAutoConsoleVariable<int32> CVarSSRQuality(
	TEXT("r.SSR.Quality"),
	3,
	TEXT("Whether to use screen space reflections and at what quality setting.\n")
	TEXT("(limits the setting in the post process settings which has a different scale)\n")
	TEXT("(costs performance, adds more visual realism but the technique has limits)\n")
	TEXT(" 0: off (default)\n")

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:138

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     bool ShouldRenderScreenSpaceReflections

Source code excerpt:

	}

	int SSRQuality = CVarSSRQuality.GetValueOnRenderThread();

	if(SSRQuality <= 0)
	{
		return false;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:699

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     void GetSSRQualityForView

Source code excerpt:

	check(ShouldRenderScreenSpaceReflections(View) || ShouldRenderScreenSpaceReflectionsWater(View));
	
	int32 SSRQualityCVar = FMath::Clamp(CVarSSRQuality.GetValueOnRenderThread(), 0, int32(ESSRQuality::MAX) - 1);
	
	if (View.Family->EngineShowFlags.VisualizeSSR)
	{
		*OutQuality = ESSRQuality::VisualizeSSR;
		return;
	}