r.MotionBlur.Amount

r.MotionBlur.Amount

#Overview

name: r.MotionBlur.Amount

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.MotionBlur.Amount is to control the intensity of motion blur in the rendering system. This variable allows developers to override the post-process settings for motion blur scaling.

The Unreal Engine rendering subsystem relies on this setting variable, specifically within the post-processing pipeline. It is used in the FSceneView class, which is a core component of the rendering system.

The value of this variable is set through a console variable (CVar) named CVarMotionBlurAmount. It is initialized with a default value of -1.0f, which means it does not override the post-process setting by default.

The r.MotionBlur.Amount variable interacts with the FinalPostProcessSettings.MotionBlurAmount property. When the value of r.MotionBlur.Amount is greater than or equal to 0, it overrides the MotionBlurAmount in the final post-process settings.

Developers must be aware that this variable allows for runtime adjustment of motion blur intensity. A value of -1 means the engine will use the default post-process settings, while any value greater than or equal to 0 will override those settings.

Best practices when using this variable include:

  1. Use it for fine-tuning motion blur intensity during development or for performance optimization.
  2. Consider exposing it as a user-configurable setting for players who may want to adjust motion blur intensity.
  3. Be cautious when setting extreme values, as they may negatively impact visual quality or performance.

Regarding the associated variable CVarMotionBlurAmount:

The purpose of CVarMotionBlurAmount is to serve as the console variable representation of r.MotionBlur.Amount. It provides the interface for querying and modifying the motion blur amount setting at runtime.

This variable is part of the Unreal Engine’s console variable system, which allows for runtime configuration of various engine parameters.

The value of CVarMotionBlurAmount is set when the engine initializes the console variables, but it can be changed at runtime through console commands or programmatically.

CVarMotionBlurAmount directly interacts with the r.MotionBlur.Amount setting. When the game thread needs to access the motion blur amount, it uses CVarMotionBlurAmount.GetValueOnGameThread().

Developers should be aware that changes to CVarMotionBlurAmount will affect the motion blur rendering in real-time. It’s tagged with ECVF_Scalability | ECVF_RenderThreadSafe, indicating that it’s safe to modify from the render thread and can be used for scalability purposes.

Best practices for using CVarMotionBlurAmount include:

  1. Use it when you need programmatic control over the motion blur amount.
  2. Remember that it’s thread-safe for the render thread, so it can be modified in rendering code if necessary.
  3. Consider using it in conjunction with scalability settings to adjust motion blur based on performance requirements.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:238

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarMotionBlurAmount(
	TEXT("r.MotionBlur.Amount"),
	-1.0f,
	TEXT("Allows to override the postprocess setting (scale of motion blur)\n")
	TEXT("-1: override (default)"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarMotionBlurMax(

#Associated Variable and Callsites

This variable is associated with another variable named CVarMotionBlurAmount. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:237

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarMotionBlurAmount(
	TEXT("r.MotionBlur.Amount"),
	-1.0f,
	TEXT("Allows to override the postprocess setting (scale of motion blur)\n")
	TEXT("-1: override (default)"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:2227

Scope (from outer to inner):

file
function     void FSceneView::EndFinalPostprocessSettings

Source code excerpt:


	{
		float Value = CVarMotionBlurAmount.GetValueOnGameThread();

		if(Value >= 0.0f)
		{
			FinalPostProcessSettings.MotionBlurAmount = Value;
		}
	}