Files
UnrealEngineUWP/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMotionBlur.h
guillaume abadie 9027c3940c Fixes TSR breaking the ICVFX camera motion blur setting in ndisplay
#rb josie.yang
#jira UE-141841
#preflight 620e2df800661410e332c16e
#lockdown alejandro.arango

#ROBOMERGE-AUTHOR: guillaume.abadie
#ROBOMERGE-SOURCE: CL 19060901 in //UE5/Release-5.0/... via CL 19078625
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19122167 by guillaume abadie in ue5-main branch]
2022-02-24 14:50:42 -05:00

111 lines
3.4 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
PostProcessMotionBlur.h: Post process MotionBlur implementation.
=============================================================================*/
#pragma once
#include "ScreenPass.h"
#include "TranslucentRendering.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(const FViewInfo& View);
};
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
FTranslucencyPassResources 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);