r.MotionBlur.TargetFPS

r.MotionBlur.TargetFPS

#Overview

name: r.MotionBlur.TargetFPS

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.TargetFPS is to control the target frame rate for motion blur velocity length scaling in the post-processing system of Unreal Engine 5. This setting allows developers to fine-tune the motion blur effect based on the desired frame rate.

This setting variable is primarily used by the rendering system, specifically the post-processing subsystem responsible for motion blur effects. It is part of the Engine module, as evidenced by its location in the SceneView.cpp file within the Engine source directory.

The value of this variable is set through a console variable (CVarMotionBlurTargetFPS) defined in the SceneView.cpp file. It can be modified at runtime using console commands or through engine configuration files.

The associated variable CVarMotionBlurTargetFPS directly interacts with r.MotionBlur.TargetFPS. They share the same value and purpose.

Developers must be aware of the following when using this variable:

  1. The default value is -1, which means the setting is overridden by the post-process settings.
  2. A value of 0 targets the current frame rate with a moving average.
  3. Values between 1 and 120 set a specific target FPS for motion blur velocity scaling.

Best practices when using this variable include:

  1. Use -1 (default) to rely on post-process settings for most cases.
  2. Set to 0 for adaptive motion blur based on current performance.
  3. Use specific values (1-120) when you want consistent motion blur regardless of actual frame rate.
  4. Consider performance implications when setting higher target FPS values.

Regarding the associated variable CVarMotionBlurTargetFPS: This is a console variable that directly controls the r.MotionBlur.TargetFPS setting. It is defined using TAutoConsoleVariable, which allows it to be modified at runtime. The variable is used in the FSceneView::EndFinalPostprocessSettings function to override the FinalPostProcessSettings.MotionBlurTargetFPS value when set to a non-negative value.

Developers should be aware that changes to CVarMotionBlurTargetFPS will immediately affect the motion blur behavior in the engine. It’s important to use this variable consistently with the desired motion blur effect and overall performance goals of the project.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarMotionBlurTargetFPS(
	TEXT("r.MotionBlur.TargetFPS"),
	-1,
	TEXT("Allows to override the postprocess setting (target FPS for motion blur velocity length scaling).\n")
	TEXT("-1: override (default)")
	TEXT(" 0: target current frame rate with moving average\n")
	TEXT("[1,120]: target FPS for motion blur velocity scaling"),
	ECVF_Scalability | ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarMotionBlurTargetFPS(
	TEXT("r.MotionBlur.TargetFPS"),
	-1,
	TEXT("Allows to override the postprocess setting (target FPS for motion blur velocity length scaling).\n")
	TEXT("-1: override (default)")
	TEXT(" 0: target current frame rate with moving average\n")
	TEXT("[1,120]: target FPS for motion blur velocity scaling"),

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

Scope (from outer to inner):

file
function     void FSceneView::EndFinalPostprocessSettings

Source code excerpt:


	{
		int32 TargetFPS = CVarMotionBlurTargetFPS.GetValueOnGameThread();

		if (TargetFPS >= 0)
		{
			FinalPostProcessSettings.MotionBlurTargetFPS = TargetFPS;
		}
	}