r.VRS.SSR

r.VRS.SSR

#Overview

name: r.VRS.SSR

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VRS.SSR is to control Variable Rate Shading (VRS) for Screen Space Reflections (SSR) in the rendering system. This setting variable is specifically designed to manage the application of VRS techniques to the SSR pass, which is a part of the post-processing pipeline in Unreal Engine’s rendering system.

This setting variable is primarily used by Unreal Engine’s Renderer module, specifically within the Variable Rate Shading subsystem. Based on the callsites, it’s evident that this variable is integrated into the VariableRateShadingImageManager, which is responsible for managing VRS across different rendering passes.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 2, which corresponds to the “Conservative” mode. The variable can take three possible values: 0: Disabled 1: Full 2: Conservative (default)

The associated variable CVarVRS_SSR interacts directly with r.VRS.SSR. They share the same value and are used interchangeably within the engine code.

Developers must be aware that changing this variable will affect the performance and visual quality of screen space reflections. The “Conservative” mode (2) is set as default, likely offering a balance between performance gains and visual quality. The “Full” mode (1) might offer more aggressive performance optimization but could potentially impact visual fidelity, while “Disabled” (0) would not apply VRS to SSR, potentially improving quality at the cost of performance.

Best practices when using this variable include:

  1. Testing different modes to find the optimal balance between performance and visual quality for your specific project.
  2. Consider the target hardware capabilities when adjusting this setting, as VRS performance gains can vary across different GPUs.
  3. Use in conjunction with other VRS settings for a cohesive approach to performance optimization.
  4. Monitor the impact on overall frame rate and visual quality when adjusting this setting.

Regarding the associated variable CVarVRS_SSR, it serves as the internal representation of the r.VRS.SSR console variable within the engine’s code. It’s used in the same way as r.VRS.SSR, particularly in the VariableRateShadingImageManager to determine the VRS mode for the SSR pass. Developers should treat CVarVRS_SSR and r.VRS.SSR as equivalent when reading or modifying the VRS settings for SSR in code.

#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:123

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarVRS_SSR(
	TEXT("r.VRS.SSR"),
	2,
	TEXT("Enable VRS with SSR (PS) 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_SSR. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:122

Scope: file

Source code excerpt:

	FConsoleVariableDelegate::CreateStatic(&CVarVRSImagePassTypeCallback),
	ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarVRS_SSR(
	TEXT("r.VRS.SSR"),
	2,
	TEXT("Enable VRS with SSR (PS) rendering.\n")
	TEXT("0: Disabled")
	TEXT("1: Full")
	TEXT("2: Conservative (default)"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:772

Scope: file

Source code excerpt:

			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;