Fix TAA corruption caused by hair velocity mask.

#rb none
#jira none
[FYI] guillaume.abadie, zach.bethel
#lockdown kevin.ortegren

#ROBOMERGE-SOURCE: CL 15966441 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v787-15839533)

[CL 15981482 by charles derousiers in ue5-main branch]
This commit is contained in:
charles derousiers
2021-04-12 15:25:33 -04:00
parent 8b0c8f847d
commit d8a33f4f2f

View File

@@ -1275,15 +1275,19 @@ static void AddHairVelocityPass(
PassParameters->OutVelocityTexture = GraphBuilder.CreateUAV(OutVelocityTexture);
PassParameters->OutResolveMaskTexture = GraphBuilder.CreateUAV(OutResolveMaskTexture);
FIntRect TotalRect = ComputeVisibleHairStrandsMacroGroupsRect(View.ViewRect, MacroGroupDatas);
// Snap the rect onto thread group boundary
const FIntPoint GroupSize = GetVendorOptimalGroupSize2D();
// We don't use the CPU screen projection for running the velocity pass, as we need to clear the entire
// velocity mask through the UAV write, otherwise the mask will be partially invalid.
#if 1
FIntRect TotalRect = View.ViewRect;
#else
// Snap the rect onto thread group boundary
FIntRect TotalRect = ComputeVisibleHairStrandsMacroGroupsRect(View.ViewRect, MacroGroupDatas);
TotalRect.Min.X = FMath::FloorToInt(float(TotalRect.Min.X) / float(GroupSize.X)) * GroupSize.X;
TotalRect.Min.Y = FMath::FloorToInt(float(TotalRect.Min.Y) / float(GroupSize.Y)) * GroupSize.Y;
TotalRect.Max.X = FMath::CeilToInt(float(TotalRect.Max.X) / float(GroupSize.X)) * GroupSize.X;
TotalRect.Max.Y = FMath::CeilToInt(float(TotalRect.Max.Y) / float(GroupSize.Y)) * GroupSize.Y;
#endif
FIntPoint RectResolution(TotalRect.Width(), TotalRect.Height());
PassParameters->ResolutionOffset = FIntPoint(TotalRect.Min.X, TotalRect.Min.Y);