ShowFlag.VisualizeMotionBlur

ShowFlag.VisualizeMotionBlur

#Overview

name: ShowFlag.VisualizeMotionBlur

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.VisualizeMotionBlur is to provide a visual debugging tool for the motion blur effect in Unreal Engine 5’s rendering system. It allows developers to visualize and tweak motion blur settings during development.

This setting variable is primarily used by the Renderer module of Unreal Engine 5. Based on the callsites, we can see that it’s referenced in various rendering-related files such as LightShaftRendering.cpp, PostProcessMotionBlur.cpp, and VelocityRendering.cpp.

The value of this variable is set using the SHOWFLAG_FIXED_IN_SHIPPING macro, which suggests that it’s only available in non-shipping builds. This is typical for debug visualization flags.

There are several other variables that interact with VisualizeMotionBlur:

  1. It’s used in conjunction with other visualization flags like VisualizeBuffer, VisualizeHDR, and VisualizeTemporalUpscaler.
  2. It’s checked alongside the ERHIFeatureLevel to determine if motion blur visualization should be enabled.
  3. It’s used in the context of other rendering features like temporal anti-aliasing, screen space reflections, and distance field ambient occlusion.

Developers should be aware that:

  1. This flag is only available in non-shipping builds.
  2. It’s part of the EngineShowFlags, which means it can be toggled in the editor or through console commands.
  3. It may impact performance when enabled, as it’s adding additional visualization on top of the normal rendering.

Best practices when using this variable include:

  1. Only enable it when specifically debugging motion blur issues.
  2. Be aware that it may interact with other visualization flags and rendering features.
  3. Remember to disable it before final builds or performance testing.

Regarding the associated variable VisualizeMotionBlur, it appears to be the same variable, just referenced in different contexts. The ShowFlag prefix is likely used when it’s part of the EngineShowFlags structure, while VisualizeMotionBlur is used directly in some code paths. The usage and considerations for both are the same.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:119

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(ScreenPercentage, SFG_Hidden, NSLOCTEXT("UnrealEd", "ScreenPercentageSF", "Screen Percentage"))
/** Helper to tweak motion blur settings */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMotionBlur, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeMotionBlurSF", "Motion Blur"))
/** DEPRECATED in 5.2: Use VisualizeReprojection instead. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMotionVectors, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeMotionVectorsSF", "Motion Vectors"))
/** Helper to ensure previous frame's temporal history reprojections using motion vectors are working correctly. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeReprojection, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeReprojectionSF", "Previous frame's reprojection"))
/** Helper to diagnose temporal upscaler's inputs and outputs. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeTemporalUpscaler, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeTemporalUpscalerSF", "Temporal Upscaler I/O (TSR, TAAU or third party plugins)"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:119

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(ScreenPercentage, SFG_Hidden, NSLOCTEXT("UnrealEd", "ScreenPercentageSF", "Screen Percentage"))
/** Helper to tweak motion blur settings */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMotionBlur, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeMotionBlurSF", "Motion Blur"))
/** DEPRECATED in 5.2: Use VisualizeReprojection instead. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeMotionVectors, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeMotionVectorsSF", "Motion Vectors"))
/** Helper to ensure previous frame's temporal history reprojections using motion vectors are working correctly. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeReprojection, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeReprojectionSF", "Previous frame's reprojection"))
/** Helper to diagnose temporal upscaler's inputs and outputs. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeTemporalUpscaler, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeTemporalUpscalerSF", "Temporal Upscaler I/O (TSR, TAAU or third party plugins)"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightShaftRendering.cpp:114

Scope (from outer to inner):

file
function     bool ShouldRenderLightShafts

Source code excerpt:

		&& !ViewFamily.EngineShowFlags.VisualizeBuffer
		&& !ViewFamily.EngineShowFlags.VisualizeHDR
		&& !ViewFamily.EngineShowFlags.VisualizeMotionBlur;
}

bool ShouldRenderLightShaftsForLight(const FViewInfo& View, const FLightSceneProxy& LightSceneProxy)
{
	if (LightSceneProxy.GetLightType() == LightType_Directional)
	{

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

Scope (from outer to inner):

file
function     bool IsVisualizeMotionBlurEnabled

Source code excerpt:

bool IsVisualizeMotionBlurEnabled(const FViewInfo& View)
{
	return View.Family->EngineShowFlags.VisualizeMotionBlur && View.GetFeatureLevel() >= ERHIFeatureLevel::SM5;
}

bool IsMotionBlurScatterRequired(const FViewInfo& View, const FScreenPassTextureViewport& SceneViewport)
{
	const FSceneViewState* ViewState = View.ViewState;
	const float ViewportWidth = SceneViewport.Rect.Width();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VelocityRendering.cpp:198

Scope (from outer to inner):

file
function     bool FDeferredShadingSceneRenderer::ShouldRenderVelocities

Source code excerpt:

		bool bTemporalAA = IsTemporalAccumulationBasedMethod(View.AntiAliasingMethod) && !View.bCameraCut;
		bool bMotionBlur = IsMotionBlurEnabled(View);
		bool bVisualizeMotionblur = View.Family->EngineShowFlags.VisualizeMotionBlur || View.Family->EngineShowFlags.VisualizeTemporalUpscaler;
		bool bDistanceFieldAO = ShouldPrepareForDistanceFieldAO();

		bool bSceneSSREnabled = ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR && ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflections(View);
		bool bWaterSSREnabled = ViewPipelineState.ReflectionsMethodWater == EReflectionsMethod::SSR && ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflectionsWater(View);
		bool bSSRTemporal = (bSceneSSREnabled || bWaterSSREnabled) && ScreenSpaceRayTracing::IsSSRTemporalPassRequired(View);