r.PostProcessing.DownsampleQuality
r.PostProcessing.DownsampleQuality
#Overview
name: r.PostProcessing.DownsampleQuality
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Defines the quality used for downsampling to half or quarter res the scene color in post processing chain.\n 0: low quality (default)\n 1: high quality\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PostProcessing.DownsampleQuality is to define the quality used for downsampling the scene color to half or quarter resolution in the post-processing chain. This setting variable is part of Unreal Engine’s rendering system, specifically affecting the post-processing pipeline.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its location in the “Runtime/Renderer/Private/PostProcess/PostProcessing.cpp” file.
The value of this variable is set through a console variable (CVarDownsampleQuality) with an initial default value of 0 (low quality). It can be changed at runtime using console commands or through code.
This variable interacts with another variable named CVarDownsampleQuality, which is the actual TAutoConsoleVariable instance that stores and manages the value. They share the same value and purpose.
Developers must be aware that this variable affects the visual quality and performance of the post-processing effects. A higher quality setting (1) will result in better visual fidelity but may impact performance, while the default lower quality setting (0) prioritizes performance.
Best practices when using this variable include:
- Consider the target hardware and performance requirements when choosing the quality setting.
- Test the visual impact and performance implications of both settings in various scenarios.
- Allow this setting to be configurable by end-users in graphics options if appropriate for your project.
Regarding the associated variable CVarDownsampleQuality:
The purpose of CVarDownsampleQuality is to provide a programmatic interface for the r.PostProcessing.DownsampleQuality setting. It is an instance of TAutoConsoleVariable
This variable is used within the Renderer module to determine the downsampling quality during the post-processing pass. It’s referenced in the AddPostProcessingPasses function, where its value is retrieved using the GetDownsampleQuality function.
The value of CVarDownsampleQuality is set when it’s initialized, but can be changed at runtime through console commands or programmatically.
CVarDownsampleQuality interacts directly with the r.PostProcessing.DownsampleQuality console variable, effectively serving as its backend.
Developers should be aware that changes to CVarDownsampleQuality will immediately affect the rendering pipeline. It’s important to use the appropriate ECVF flags (ECVF_Scalability | ECVF_RenderThreadSafe) when modifying this variable to ensure thread safety and proper scalability behavior.
Best practices for using CVarDownsampleQuality include:
- Access the value using the appropriate getter methods rather than directly accessing the variable.
- Consider exposing the ability to modify this setting through a user interface for graphics options.
- Be mindful of performance implications when changing this value, especially on lower-end hardware.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:123
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarDownsampleQuality(
TEXT("r.PostProcessing.DownsampleQuality"), 0,
TEXT("Defines the quality used for downsampling to half or quarter res the scene color in post processing chain.\n")
TEXT(" 0: low quality (default)\n")
TEXT(" 1: high quality\n"),
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarDownsampleChainQuality(
#Associated Variable and Callsites
This variable is associated with another variable named CVarDownsampleQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:122
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarDownsampleQuality(
TEXT("r.PostProcessing.DownsampleQuality"), 0,
TEXT("Defines the quality used for downsampling to half or quarter res the scene color in post processing chain.\n")
TEXT(" 0: low quality (default)\n")
TEXT(" 1: high quality\n"),
ECVF_Scalability | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:590
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
const EAutoExposureMethod AutoExposureMethod = GetAutoExposureMethod(View);
const EAntiAliasingMethod AntiAliasingMethod = !bVisualizeDepthOfField ? View.AntiAliasingMethod : AAM_None;
const EDownsampleQuality DownsampleQuality = GetDownsampleQuality(CVarDownsampleQuality);
const EDownsampleQuality DownsampleChainQuality = GetDownsampleQuality(CVarDownsampleChainQuality);
const EPixelFormat DownsampleOverrideFormat = PF_FloatRGB;
// Previous transforms are nonsensical on camera cuts, unless motion vector simulation is enabled (providing FrameN+1 transforms to FrameN+0)
const bool bMotionBlurValid = FMotionVectorSimulation::IsEnabled() || (!View.bCameraCut && !View.bPrevTransformsReset);