r.VRS.NaniteEmitGBuffer

r.VRS.NaniteEmitGBuffer

#Overview

name: r.VRS.NaniteEmitGBuffer

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.NaniteEmitGBuffer is to control the Variable Rate Shading (VRS) functionality for Nanite EmitGBuffer rendering in Unreal Engine 5. It is part of the rendering system, specifically the Variable Rate Shading feature.

This setting variable is primarily used by the Renderer module of Unreal Engine 5, particularly in the Variable Rate Shading subsystem. It’s referenced in the VariableRateShadingImageManager.cpp file, which suggests it’s an integral part of managing VRS images and their application to different rendering passes.

The value of this variable is set through a console command, with three possible options: 0: Disabled 1: Full 2: Conservative (default)

This variable interacts directly with its associated variable CVarVRSNaniteEmitGBuffer. They share the same value and purpose. Additionally, it’s part of a larger system of VRS settings for different pass types, as seen in the array CVarByPassType.

Developers must be aware that changing this setting will affect the performance and quality of Nanite EmitGBuffer rendering. The conservative setting (2) is the default, likely providing a balance between performance gain and visual quality.

Best practices when using this variable include:

  1. Understand the impact of each setting on performance and visual quality.
  2. Test thoroughly when changing from the default setting.
  3. Consider the target hardware capabilities when adjusting this setting.
  4. Use in conjunction with other VRS settings for optimal results.

Regarding the associated variable CVarVRSNaniteEmitGBuffer: This is an internal representation of the r.VRS.NaniteEmitGBuffer console variable. It’s used within the C++ code to access and modify the setting. The purpose and usage are identical to r.VRS.NaniteEmitGBuffer. Developers working directly with the engine’s C++ code should use this variable name when referencing the setting programmatically.

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

Scope: file

Source code excerpt:

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

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

Scope: file

Source code excerpt:

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

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

Scope: file

Source code excerpt:

			CVarByPassType[EVRSPassType::BasePass] = &CVarVRSBasePass;
			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;
		}