r.VRS.BasePass
r.VRS.BasePass
#Overview
name: r.VRS.BasePass
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables Variable Rate Shading for the base pass\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.BasePass is to control the Variable Rate Shading (VRS) functionality for the base pass in Unreal Engine’s rendering pipeline. VRS is a technique that allows for varying shading rates across different parts of the screen, potentially improving performance by reducing shading work in less visually important areas.
This setting variable is primarily used by the Renderer subsystem, specifically within the Variable Rate Shading module. It’s defined and referenced in the VariableRateShadingImageManager.cpp file, which is part of the Renderer’s private implementation.
The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 2, which corresponds to the “Conservative” mode.
The variable interacts closely with its associated variable CVarVRSBasePass, which is the actual CVar object. They share the same value and purpose, with r.VRS.BasePass being the string identifier used to access the CVar through the console or configuration files.
Developers should be aware that this variable has three possible settings: 0: Disabled (VRS is turned off for the base pass) 1: Full (VRS is fully enabled for the base pass) 2: Conservative (default, likely a balanced approach)
When using this variable, best practices include:
- Understanding the performance implications of each setting in your specific use case.
- Testing thoroughly with different settings to ensure visual quality is not compromised.
- Considering the target hardware capabilities, as VRS support may vary across different GPUs.
- Using the Conservative setting as a starting point and adjusting based on performance needs and visual quality requirements.
Regarding the associated variable CVarVRSBasePass:
This is the actual console variable object that stores the VRS setting for the base pass. It’s created using the TAutoConsoleVariable template, which allows for easy integration with Unreal Engine’s console variable system.
CVarVRSBasePass is used internally by the engine to quickly access the current VRS setting for the base pass. It’s part of a larger system that manages VRS settings for various pass types in the rendering pipeline, as evidenced by its inclusion in the CVarByPassType array.
When working with CVarVRSBasePass, developers should:
- Use the r.VRS.BasePass console command for changing values rather than directly modifying the CVarVRSBasePass object.
- Be aware that changes to this variable may trigger a callback (CVarVRSImagePassTypeCallback) that could have wider effects on the rendering system.
- Consider the relationship between this variable and other VRS-related variables for different pass types when optimizing rendering performance.
#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:87
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarVRSBasePass(
TEXT("r.VRS.BasePass"),
2,
TEXT("Enables Variable Rate Shading for the base pass\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 CVarVRSBasePass
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:86
Scope: file
Source code excerpt:
}
TAutoConsoleVariable<int32> CVarVRSBasePass(
TEXT("r.VRS.BasePass"),
2,
TEXT("Enables Variable Rate Shading for the base pass\n")
TEXT("0: Disabled")
TEXT("1: Full")
TEXT("2: Conservative (default)"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:768
Scope: file
Source code excerpt:
FStaticPassToImageCVarData()
{
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;