r.MotionBlur.Max

r.MotionBlur.Max

#Overview

name: r.MotionBlur.Max

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.Max is to control the maximum length of motion blur in the rendering system, specifically for post-processing effects. This setting variable is part of Unreal Engine’s rendering subsystem and is used to override the post-process settings for motion blur.

The Unreal Engine subsystem that relies on this setting variable is the rendering system, particularly the post-processing module. It’s used in the SceneView component, which is responsible for managing the view of the scene to be rendered.

The value of this variable is set through the console variable system. It’s defined with a default value of -1.0f, which means it doesn’t override the post-process setting by default. The value can be changed at runtime through console commands or programmatically.

This variable interacts with the FinalPostProcessSettings.MotionBlurMax property. When the r.MotionBlur.Max value is set to a non-negative number, it overrides the MotionBlurMax value in the final post-process settings.

Developers must be aware that:

  1. The value is in percent of the screen width.
  2. A value of -1 means no override is applied.
  3. This setting can impact performance and visual quality, so it should be used judiciously.

Best practices when using this variable include:

  1. Use it for fine-tuning motion blur effects in specific scenarios.
  2. Consider the performance implications of increasing motion blur.
  3. Test thoroughly with different values to find the right balance between visual quality and performance.

Regarding the associated variable CVarMotionBlurMax:

The purpose of CVarMotionBlurMax is to provide a programmatic interface to the r.MotionBlur.Max console variable. It’s an instance of TAutoConsoleVariable, which allows C++ code to interact with the console variable system.

This variable is part of the rendering system and is used in the same context as r.MotionBlur.Max.

The value of CVarMotionBlurMax is set when the r.MotionBlur.Max console variable is set, either through console commands or programmatically.

CVarMotionBlurMax interacts directly with the FinalPostProcessSettings.MotionBlurMax property. It’s used to retrieve the current value of the console variable and apply it to the post-process settings.

Developers should be aware that:

  1. Changes to CVarMotionBlurMax will affect the motion blur rendering in real-time.
  2. It’s thread-safe and can be accessed from the render thread.

Best practices for using CVarMotionBlurMax include:

  1. Use GetValueOnGameThread() to retrieve the current value safely.
  2. Consider using this variable for dynamic adjustments to motion blur during gameplay or in response to performance metrics.
  3. Be cautious when modifying this value frequently, as it can impact frame-to-frame consistency in rendering.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarMotionBlurMax(
	TEXT("r.MotionBlur.Max"),
	-1.0f,
	TEXT("Allows to override the postprocess setting (max length of motion blur, in percent of the screen width)\n")
	TEXT("-1: override (default)"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarMotionBlurTargetFPS(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<float> CVarMotionBlurMax(
	TEXT("r.MotionBlur.Max"),
	-1.0f,
	TEXT("Allows to override the postprocess setting (max length of motion blur, in percent of the screen width)\n")
	TEXT("-1: override (default)"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

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

Scope (from outer to inner):

file
function     void FSceneView::EndFinalPostprocessSettings

Source code excerpt:


	{
		float Value = CVarMotionBlurMax.GetValueOnGameThread();

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