r.PostProcessing.QuarterResolutionDownsample
r.PostProcessing.QuarterResolutionDownsample
#Overview
name: r.PostProcessing.QuarterResolutionDownsample
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Uses quarter resolution downsample instead of half resolution to feed into exposure / bloom.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PostProcessing.QuarterResolutionDownsample is to control the resolution of the downsampling process used in post-processing effects, specifically for exposure and bloom calculations.
This setting variable is primarily used in the rendering system of Unreal Engine 5, particularly in the post-processing module. Based on the callsites, it’s clear that this variable is utilized in the Renderer module, specifically in the PostProcessing.cpp file.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands or project settings.
The variable interacts with the post-processing pipeline, particularly affecting the downsampling resolution for exposure and bloom calculations. It has three possible states: 0: Uses half-resolution downsampling (default) 1: Uses quarter-resolution downsampling 2: Uses eighth-resolution downsampling
Developers must be aware that changing this variable will affect the quality and performance of certain post-processing effects. Lower resolution downsampling (quarter or eighth) may improve performance but could potentially reduce the quality of exposure and bloom effects.
Best practices when using this variable include:
- Consider the target hardware when adjusting this setting. Lower-end devices might benefit from lower resolution downsampling.
- Test thoroughly to ensure the visual quality remains acceptable when changing this setting.
- Be aware that this setting may interact with other post-processing settings, so it should be adjusted in context with other relevant variables.
Regarding the associated variable CVarPostProcessingQuarterResolutionDownsample:
This is the actual console variable object that corresponds to the r.PostProcessing.QuarterResolutionDownsample setting. It’s defined in the same file and serves as the programmatic interface for accessing and modifying the setting value.
The purpose of CVarPostProcessingQuarterResolutionDownsample is to provide a way for the engine to read and modify the r.PostProcessing.QuarterResolutionDownsample setting at runtime.
This variable is used directly in the rendering code to determine the downsampling resolution. For example, in the AddPostProcessingPasses function, the value of this variable is checked to determine whether to process at quarter or eighth resolution.
Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag used in its definition.
Best practices for using this variable include:
- Use the GetValueOnRenderThread() method when accessing its value in render thread code.
- Be cautious when modifying this value dynamically, as it can affect performance and visual quality in real-time.
- Consider exposing this setting in your game’s graphics options menu to allow users to balance between performance and quality.
#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:117
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarPostProcessingQuarterResolutionDownsample(
TEXT("r.PostProcessing.QuarterResolutionDownsample"),
0,
TEXT("Uses quarter resolution downsample instead of half resolution to feed into exposure / bloom."),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarDownsampleQuality(
TEXT("r.PostProcessing.DownsampleQuality"), 0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarPostProcessingQuarterResolutionDownsample
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:116
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarPostProcessingQuarterResolutionDownsample(
TEXT("r.PostProcessing.QuarterResolutionDownsample"),
0,
TEXT("Uses quarter resolution downsample instead of half resolution to feed into exposure / bloom."),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarDownsampleQuality(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:671
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
const bool bLocalExposureBlurredLum = bLocalExposureEnabled && View.FinalPostProcessSettings.LocalExposureBlurredLuminanceBlend > 0.0f;
const bool bProcessQuarterResolution = CVarPostProcessingQuarterResolutionDownsample.GetValueOnRenderThread() == 1;
const bool bProcessEighthResolution = CVarPostProcessingQuarterResolutionDownsample.GetValueOnRenderThread() == 2;
const bool bMotionBlurNeedsHalfResInput = PassSequence.IsEnabled(EPass::MotionBlur) && DoesMotionBlurNeedsHalfResInput() && !bVisualizeMotionBlur;
const float FFTBloomResolutionFraction = GetFFTBloomResolutionFraction(PostTAAViewSize);
const bool bProduceSceneColorChain = (
bBasicEyeAdaptationEnabled ||