Files
UnrealEngineUWP/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.h
jon nabozny c5065a7160 Merge //UE5/Release-5.0 into //UE5/Private-Frosty-To-5.0-Staging
#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: jon.nabozny
#ROBOMERGE-SOURCE: CL 18134541 via CL 18371947 via CL 18371959
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18372011 by jon nabozny in ue5-release-engine-test branch]
2021-12-03 15:19:38 -05:00

109 lines
3.3 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
PostProcessMotionBlur.h: Post process MotionBlur implementation.
=============================================================================*/
#pragma once
#include "ScreenPass.h"
// Returns whether motion blur is enabled for the requested view.
bool IsMotionBlurEnabled(const FViewInfo& View);
// Returns whether visualization of motion blur is enabled for the requested view.
bool IsVisualizeMotionBlurEnabled(const FViewInfo& View);
// The quality level of the motion blur pass.
enum class EMotionBlurQuality : uint32
{
Low,
Medium,
High,
VeryHigh,
MAX
};
enum class EMotionBlurFilter : uint32
{
Unified,
Separable
};
// Returns whether motion blur also want half res input the scene color's MIP1.
bool DoesMotionBlurNeedsHalfResInput();
// Returns the global setting for motion blur quality.
EMotionBlurQuality GetMotionBlurQuality();
// Returns the global setting for motion blur filter.
EMotionBlurFilter GetMotionBlurFilter();
// Number of simultaneous direction motion blur can blur per tiles.
int32 GetMotionBlurDirections();
// Shader parameters for MotionBlurVelocityFlatten.ush when another pass can also generate the FVelocityFlattenTextures
BEGIN_SHADER_PARAMETER_STRUCT(FVelocityFlattenParameters, )
SHADER_PARAMETER(FVector2f, VelocityScale)
SHADER_PARAMETER(float, VelocityMax)
END_SHADER_PARAMETER_STRUCT()
FVelocityFlattenParameters GetVelocityFlattenParameters(const FViewInfo& View);
// Textures generated by the velocity flattening pass.
struct FVelocityFlattenTextures
{
static constexpr int32 kMaxVelocityTileTextureCount = 2;
static constexpr int32 kTileSize = 16;
FScreenPassTexture VelocityFlatten;
FScreenPassTexture VelocityTile[kMaxVelocityTileTextureCount];
bool IsValid() const
{
return VelocityFlatten.IsValid() && VelocityTile[0].IsValid();
}
// returns whether FVelocityFlattenTextures can be generated in external system.
static bool AllowExternal();
};
struct FMotionBlurInputs
{
bool bOutputHalfRes = false;
bool bOutputQuarterRes = false;
// [Optional] Render to the specified output. If invalid, a new texture is created and returned.
FScreenPassRenderTarget OverrideOutput;
// [Required] The input scene color and view rect.
FScreenPassTexture SceneColor;
// [Required] The input scene depth and view rect.
FScreenPassTexture SceneDepth;
// [Required] The input scene velocity and view rect.
FScreenPassTexture SceneVelocity;
// [Optional] The separate translucency buffer to be composited after motion blur
FScreenPassTexture PostMotionBlurTranslucency;
// [Required] Quality to use when processing motion blur.
EMotionBlurQuality Quality = EMotionBlurQuality::VeryHigh;
// [Required] Filter to use when processing motion blur.
EMotionBlurFilter Filter = EMotionBlurFilter::Separable;
// [Optional] the velocity flatten is can be generated by a earlier pass.
FVelocityFlattenTextures VelocityFlattenTextures;
};
struct FMotionBlurOutputs
{
FScreenPassTexture FullRes;
FScreenPassTexture HalfRes;
FScreenPassTexture QuarterRes;
};
FMotionBlurOutputs AddMotionBlurPass(FRDGBuilder& GraphBuilder, const FViewInfo& View, const FMotionBlurInputs& Inputs);
FScreenPassTexture AddVisualizeMotionBlurPass(FRDGBuilder& GraphBuilder, const FViewInfo& View, const FMotionBlurInputs& Inputs);