r.MotionBlur.AllowExternalVelocityFlatten

r.MotionBlur.AllowExternalVelocityFlatten

#Overview

name: r.MotionBlur.AllowExternalVelocityFlatten

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.AllowExternalVelocityFlatten is to control whether motion blur’s velocity flattening can be integrated into other rendering passes. This setting is part of Unreal Engine’s rendering system, specifically related to the post-processing and motion blur effects.

This setting variable is primarily used in the Renderer module of Unreal Engine, as evidenced by its location in the PostProcessMotionBlur.cpp file within the Runtime/Renderer directory.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It is initialized with a default value of 1 (enabled) in the C++ code.

The associated variable CVarMotionBlurAllowExternalVelocityFlatten is directly linked to this setting. It’s an instance of TAutoConsoleVariable<int32> that represents the console variable in the C++ code.

Developers should be aware that this setting affects the performance and visual quality of motion blur. Enabling external velocity flattening (by setting the value to 1) may improve performance by allowing the motion blur calculations to be combined with other rendering passes, but it might have subtle effects on the final image quality.

Best practices when using this variable include:

  1. Testing the visual impact of enabling/disabling this feature in different scenarios.
  2. Considering performance implications, especially on lower-end hardware.
  3. Ensuring that the motion blur effect still meets the artistic vision when this optimization is enabled.

Regarding the associated variable CVarMotionBlurAllowExternalVelocityFlatten:

When working with this variable, developers should ensure they’re accessing it in a thread-safe manner, especially when used in render thread operations.

#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:58

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	TAutoConsoleVariable<int32> CVarMotionBlurAllowExternalVelocityFlatten(
		TEXT("r.MotionBlur.AllowExternalVelocityFlatten"), 1,
		TEXT("Whether to allow motion blur's velocity flatten into other pass."),
		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<int32> CVarAllowMotionBlurInVR(
		TEXT("vr.AllowMotionBlurInVR"),
		0,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.cpp:57

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

		ECVF_Scalability | ECVF_RenderThreadSafe);

	TAutoConsoleVariable<int32> CVarMotionBlurAllowExternalVelocityFlatten(
		TEXT("r.MotionBlur.AllowExternalVelocityFlatten"), 1,
		TEXT("Whether to allow motion blur's velocity flatten into other pass."),
		ECVF_RenderThreadSafe);

	TAutoConsoleVariable<int32> CVarAllowMotionBlurInVR(
		TEXT("vr.AllowMotionBlurInVR"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.cpp:195

Scope (from outer to inner):

file
function     bool FVelocityFlattenTextures::AllowExternal

Source code excerpt:

	}

	return CVarMotionBlurAllowExternalVelocityFlatten.GetValueOnRenderThread() != 0;
}

FRHISamplerState* GetMotionBlurColorSampler()
{
	bool bFiltered = false;