From 43f2696364f15ff4e94e2ff8da6c9c3e36fc1878 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Fri, 26 Nov 2021 09:34:25 +0100 Subject: [PATCH] [HDRP] Fixed taa jitter for after post process materials --- .../None/4061_CustomPostProcessMotionVectors.png | 4 ++-- .../None/4061_CustomPostProcessMotionVectors.png | 4 ++-- .../None/4061_CustomPostProcessMotionVectors.png | 4 ++-- .../None/4061_CustomPostProcessMotionVectors.png | 4 ++-- .../None/4061_CustomPostProcessMotionVectors.png | 4 ++-- .../CHANGELOG.md | 1 + .../RenderPipeline/HDRenderPipeline.PostProcess.cs | 14 ++++++++++++++ 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png index b4e3c3af98d..5fc411d1d5b 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b316f30b0fe1f2c2bdcf29779c7c59e8970087c7bab27a309aae8ad0af14010 -size 10556 +oid sha256:8c1a37f1e195f37a1f6ba8470c85d751d9d4906f5954fb951b7beb3057aa73df +size 9088 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/4061_CustomPostProcessMotionVectors.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/4061_CustomPostProcessMotionVectors.png index 1c9dc584218..5fc411d1d5b 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/4061_CustomPostProcessMotionVectors.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/4061_CustomPostProcessMotionVectors.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55a182d1d88a164d3760b10c4995508e4908bbab46ece6f2aaf98c479b42bd02 -size 10510 +oid sha256:8c1a37f1e195f37a1f6ba8470c85d751d9d4906f5954fb951b7beb3057aa73df +size 9088 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4061_CustomPostProcessMotionVectors.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4061_CustomPostProcessMotionVectors.png index 4dcfb27b203..5fc411d1d5b 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4061_CustomPostProcessMotionVectors.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4061_CustomPostProcessMotionVectors.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39e343610b62e18567b358f95077de49d4feee233c8e508bd1c235cebeecde1c -size 9008 +oid sha256:8c1a37f1e195f37a1f6ba8470c85d751d9d4906f5954fb951b7beb3057aa73df +size 9088 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4061_CustomPostProcessMotionVectors.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4061_CustomPostProcessMotionVectors.png index b4e3c3af98d..5fc411d1d5b 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4061_CustomPostProcessMotionVectors.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4061_CustomPostProcessMotionVectors.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b316f30b0fe1f2c2bdcf29779c7c59e8970087c7bab27a309aae8ad0af14010 -size 10556 +oid sha256:8c1a37f1e195f37a1f6ba8470c85d751d9d4906f5954fb951b7beb3057aa73df +size 9088 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png index b4e3c3af98d..5fc411d1d5b 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4061_CustomPostProcessMotionVectors.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b316f30b0fe1f2c2bdcf29779c7c59e8970087c7bab27a309aae8ad0af14010 -size 10556 +oid sha256:8c1a37f1e195f37a1f6ba8470c85d751d9d4906f5954fb951b7beb3057aa73df +size 9088 diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 9d842910262..8555176cf56 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed stackLit coat screen space reflection and raytrace reflection light hierarchy and IBL fallback - Fixed custom pass utils Blur and Copy functions in XR. - Fixed SpeedTree graph compatibility by removing custom interpolators. +- Fixed taa jitter for after post process materials (case 1380967). ## [12.1.2] - 2021-10-22 diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 46b43e12b80..f876f6792e1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -636,6 +636,13 @@ TextureHandle RenderAfterPostProcessObjects(RenderGraph renderGraph, HDCamera hd builder.SetRenderFunc( (AfterPostProcessPassData data, RenderGraphContext ctx) => { + // Disable camera jitter. See coment in RestoreNonjitteredMatrices + if (data.hdCamera.RequiresCameraJitter()) + { + data.hdCamera.UpdateAllViewConstants(false); + data.hdCamera.UpdateShaderVariablesGlobalCB(ref data.globalCB); + } + UpdateOffscreenRenderingConstants(ref data.globalCB, true, 1.0f); ConstantBuffer.PushGlobal(ctx.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal); @@ -643,6 +650,13 @@ TextureHandle RenderAfterPostProcessObjects(RenderGraph renderGraph, HDCamera hd // Setup off-screen transparency here DrawTransparentRendererList(ctx.renderContext, ctx.cmd, data.hdCamera.frameSettings, data.transparentAfterPostprocessRL); + // Reenable camera jitter for CustomPostProcessBeforeTAA injection point + if (data.hdCamera.RequiresCameraJitter()) + { + data.hdCamera.UpdateAllViewConstants(true); + data.hdCamera.UpdateShaderVariablesGlobalCB(ref data.globalCB); + } + UpdateOffscreenRenderingConstants(ref data.globalCB, false, 1.0f); ConstantBuffer.PushGlobal(ctx.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal); });