r.MotionBlur.HalfResInput
r.MotionBlur.HalfResInput
#Overview
name: r.MotionBlur.HalfResInput
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether motion blur also blur with a half resolution input.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.MotionBlur.HalfResInput is to control whether the motion blur effect in Unreal Engine 5 uses a half-resolution input for processing. This setting is part of the rendering system, specifically the post-processing pipeline for motion blur effects.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly in the post-processing subsystem responsible for motion blur effects. It’s defined and used in the PostProcessMotionBlur.cpp file, which is part of the core rendering functionality.
The value of this variable is set as a console variable (CVar) with a default value of 1 (enabled). It can be changed at runtime through the console or configuration files.
The associated variable CVarMotionBlurHalfResInput directly interacts with r.MotionBlur.HalfResInput. They share the same value and purpose, with CVarMotionBlurHalfResInput being the actual C++ variable used in the code to access the setting.
Developers must be aware that enabling this setting (which is the default) will cause the motion blur effect to use a half-resolution input. This can improve performance but may slightly reduce the quality of the motion blur effect. The trade-off between performance and quality should be considered based on the specific requirements of the project.
Best practices when using this variable include:
- Testing the visual impact of enabling/disabling this setting in various scenarios to ensure it meets the desired visual quality.
- Considering the performance implications, especially on lower-end hardware.
- Using it in conjunction with other motion blur settings (like r.MotionBlur.HalfResGather) to fine-tune the balance between quality and performance.
Regarding the associated variable CVarMotionBlurHalfResInput:
The purpose of CVarMotionBlurHalfResInput is to provide programmatic access to the r.MotionBlur.HalfResInput setting within the C++ code of Unreal Engine.
This variable is used directly in the Renderer module, specifically in the motion blur post-processing code. It’s defined and used in the same file as r.MotionBlur.HalfResInput (PostProcessMotionBlur.cpp).
The value of CVarMotionBlurHalfResInput is set when the r.MotionBlur.HalfResInput console variable is initialized or changed.
CVarMotionBlurHalfResInput interacts directly with the r.MotionBlur.HalfResInput setting, effectively serving as its in-code representation.
Developers should be aware that this variable is used to check the current state of the half-resolution input setting for motion blur. It’s accessed using the GetValueOnRenderThread() method, which ensures thread-safe access to the value.
Best practices for using CVarMotionBlurHalfResInput include:
- Always accessing it using the GetValueOnRenderThread() method to ensure thread safety.
- Using it in render thread operations only, as indicated by its ECVF_RenderThreadSafe flag.
- Considering caching its value if it’s accessed frequently in performance-critical sections of code, to avoid repeated calls to GetValueOnRenderThread().
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.cpp:48
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarMotionBlurHalfResInput(
TEXT("r.MotionBlur.HalfResInput"), 1,
TEXT("Whether motion blur also blur with a half resolution input."),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarMotionBlurHalfResGather(
TEXT("r.MotionBlur.HalfResGather"), 1,
TEXT("Whether to do motion blur filter dynamically at half res under heavy motion."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarMotionBlurHalfResInput
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.cpp:47
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarMotionBlurHalfResInput(
TEXT("r.MotionBlur.HalfResInput"), 1,
TEXT("Whether motion blur also blur with a half resolution input."),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarMotionBlurHalfResGather(
TEXT("r.MotionBlur.HalfResGather"), 1,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.cpp:162
Scope (from outer to inner):
file
function bool DoesMotionBlurNeedsHalfResInput
Source code excerpt:
bool DoesMotionBlurNeedsHalfResInput()
{
return CVarMotionBlurHalfResInput.GetValueOnRenderThread() != 0;
}
EMotionBlurQuality GetMotionBlurQuality()
{
// Quality levels begin at 1. 0 is reserved for 'off'.
const int32 Quality = FMath::Clamp(GetMotionBlurQualityFromCVar(), 1, static_cast<int32>(EMotionBlurQuality::MAX));