r.VRS.Decals
r.VRS.Decals
#Overview
name: r.VRS.Decals
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables Variable Rate Shading for decals\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.Decals is to control Variable Rate Shading (VRS) for decals in the rendering system of Unreal Engine 5. It is specifically designed to manage how VRS is applied to decal rendering, allowing developers to optimize performance and visual quality for decal elements in their game or application.
This setting variable is primarily used by the Renderer module, specifically within the Variable Rate Shading subsystem. It’s part of the engine’s advanced rendering features that allow for more efficient use of GPU resources.
The value of this variable is set through a console variable (CVar) system, which allows it to be changed at runtime. It’s initialized with a default value of 2, representing the “Conservative” mode.
The variable interacts closely with its associated variable CVarVRSDecals, which is an instance of TAutoConsoleVariable
Developers should be aware that this variable has three possible settings: 0: Disabled (VRS is not applied to decals) 1: Full (VRS is fully applied to decals) 2: Conservative (default, likely a balanced approach)
When using this variable, best practices include:
- Understanding the performance implications of each setting.
- Testing thoroughly with different settings to find the optimal balance between performance and visual quality for your specific use case.
- Being cautious when changing this value at runtime, as it may affect rendering performance and visual consistency.
Regarding the associated variable CVarVRSDecals: This is the actual ConsoleVariable object that stores the value of r.VRS.Decals. It’s used internally by the engine to query the current setting and apply the appropriate VRS behavior to decal rendering. The CVarVRSDecals variable is referenced in the FDebugVariableRateShadingCS class, suggesting it’s used in shader compilation or runtime shader parameter setting for VRS.
When working with CVarVRSDecals, developers should:
- Use the appropriate Unreal Engine API calls to read or modify this value if needed in C++ code.
- Be aware that changes to this variable will trigger a callback (CVarVRSImagePassTypeCallback), which likely updates the VRS system accordingly.
- Consider the threading implications, as the variable is marked as render thread safe (ECVF_RenderThreadSafe).
#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:150
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarVRSDecals(
TEXT("r.VRS.Decals"),
2,
TEXT("Enables Variable Rate Shading for decals\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 CVarVRSDecals
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:149
Scope: file
Source code excerpt:
FConsoleVariableDelegate::CreateStatic(&CVarVRSImagePassTypeCallback),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarVRSDecals(
TEXT("r.VRS.Decals"),
2,
TEXT("Enables Variable Rate Shading for decals\n")
TEXT("0: Disabled")
TEXT("1: Full")
TEXT("2: Conservative (default)"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:775
Scope (from outer to inner):
file
class class FDebugVariableRateShadingCS : public FGlobalShader
Source code excerpt:
CVarByPassType[EVRSPassType::ReflectionEnvironmentAndSky] = &CVarVRSReflectionEnvironmentSky;
CVarByPassType[EVRSPassType::LightFunctions] = &CVarVRSLightFunctions;
CVarByPassType[EVRSPassType::Decals] = &CVarVRSDecals;
}
} StaticData;
uint32 ImageTypeAsInt = StaticData.CVarByPassType[PassType]->GetValueOnRenderThread();
if (ImageTypeAsInt >= 0 && ImageTypeAsInt <= EVRSImageType::Conservative)
{