From 35cb0826cde79e116736740350682d544c39d2a0 Mon Sep 17 00:00:00 2001 From: Kleber Garcia Date: Wed, 28 Apr 2021 14:04:15 -0400 Subject: [PATCH 1/3] Fixing bloom bicubic filtering for DRS, bicubic was using the wrong dimensions / texel sizes --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 6ff40a07cad..2ec11fb5f5c 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -169,6 +169,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed NaNs when denoising pixels where the dot product between normal and view direction is near zero (case 1329624). - Fixed ray traced reflections that were too dark for unlit materials. Reflections are now more consistent with the material emissiveness. - Fixed pyramid color being incorrect when hardware dynamic resolution is enabled. +- Fixed blocky looking bloom when dynamic resolution scaling was used. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard 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 8a364795a1a..701ade669eb 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 @@ -3165,6 +3165,13 @@ void PrepareBloomData(RenderGraph renderGraph, in RenderGraphBuilder builder, Bl // the mip up 0 will be used by uber, so not allocated as transient. m_BloomBicubicParams = new Vector4(passData.bloomMipInfo[0].x, passData.bloomMipInfo[0].y, 1.0f / passData.bloomMipInfo[0].x, 1.0f / passData.bloomMipInfo[0].y); var mip0Scale = new Vector2(passData.bloomMipInfo[0].z, passData.bloomMipInfo[0].w); + + //apply DRS on bloom bicubic params + m_BloomBicubicParams.x /= RTHandles.rtHandleProperties.rtHandleScale.x; + m_BloomBicubicParams.y /= RTHandles.rtHandleProperties.rtHandleScale.y; + m_BloomBicubicParams.z *= RTHandles.rtHandleProperties.rtHandleScale.x; + m_BloomBicubicParams.w *= RTHandles.rtHandleProperties.rtHandleScale.y; + passData.mipsUp[0] = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(mip0Scale, true, true) { name = "Bloom final mip up", From afd7e203193e95d11efe586222fb32b5395fecd9 Mon Sep 17 00:00:00 2001 From: Kleber Garcia Date: Thu, 29 Apr 2021 10:33:18 -0400 Subject: [PATCH 2/3] Adding better comment to explain offseting of bicubic texture offset fix --- .../Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 701ade669eb..e7480ac8593 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 @@ -3166,7 +3166,10 @@ void PrepareBloomData(RenderGraph renderGraph, in RenderGraphBuilder builder, Bl m_BloomBicubicParams = new Vector4(passData.bloomMipInfo[0].x, passData.bloomMipInfo[0].y, 1.0f / passData.bloomMipInfo[0].x, 1.0f / passData.bloomMipInfo[0].y); var mip0Scale = new Vector2(passData.bloomMipInfo[0].z, passData.bloomMipInfo[0].w); - //apply DRS on bloom bicubic params + // We undo the scale here, because bloom uses these parameters for its bicubic filtering offset. + // The bicubic filtering function is SampleTexture2DBicubic, and it requires the underlying texture's + // unscaled pixel sizes to compute the offsets of the samples. + // For more info please see the implementation of SampleTexture2DBicubic m_BloomBicubicParams.x /= RTHandles.rtHandleProperties.rtHandleScale.x; m_BloomBicubicParams.y /= RTHandles.rtHandleProperties.rtHandleScale.y; m_BloomBicubicParams.z *= RTHandles.rtHandleProperties.rtHandleScale.x; From 2b7356cec2ca3e67b0e8b7a8064c373268b7cdad Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Fri, 30 Apr 2021 18:54:44 +0200 Subject: [PATCH 3/3] update reference screenshots --- .../Vulkan/None/2222_ReflectionProbeDistanceBased.png | 4 ++-- .../Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png | 4 ++-- .../Direct3D11/None/2222_ReflectionProbeDistanceBased.png | 4 ++-- .../Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png | 4 ++-- .../Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png | 4 ++-- .../Vulkan/None/2222_ReflectionProbeDistanceBased.png | 4 ++-- .../Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png index b6dc9f90c38..81941583343 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43a77a6155c2e6e884207100d8270fa8ea13a93900ff16f0bd67c1ad2af0a041 -size 266999 +oid sha256:a6474e5c549f8ed37466456760ea25a008356b83b11eaa49c86b500552049a55 +size 228203 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png index b6d0d3e11cc..e5bd601c4a0 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a87f04aae29392a286b618630430184f21c566d81b9af5ab5a0a757b93302c3 -size 233300 +oid sha256:35ff1830c77c9e65fc7f7d0dbccf95f47c3ae4398fb7341d7a95e2425538c134 +size 233075 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2222_ReflectionProbeDistanceBased.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2222_ReflectionProbeDistanceBased.png index c240e4c2d17..8873077d507 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2222_ReflectionProbeDistanceBased.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2222_ReflectionProbeDistanceBased.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edf10c291c02438bd12783cfdc9b66bbd5990f0a3cd7d252d78a07625536eaaf -size 265630 +oid sha256:a5d0a03e3c1730660fe5f2599fcb43f5df9f7ccfe378b067c3fcde0614134693 +size 227138 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png index b6d0d3e11cc..bdbacb32195 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a87f04aae29392a286b618630430184f21c566d81b9af5ab5a0a757b93302c3 -size 233300 +oid sha256:2d23d3d1466512d66d36532b04405e66ee7aabb3d587270977346b2189a08388 +size 233225 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png index b6d0d3e11cc..10e3c5440cc 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a87f04aae29392a286b618630430184f21c566d81b9af5ab5a0a757b93302c3 -size 233300 +oid sha256:be0a85a64e2c95a909f53da60ae1babc31d1ca93c57c7a6ce7d6e3c6a95ddda4 +size 233313 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png index b6dc9f90c38..81941583343 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2222_ReflectionProbeDistanceBased.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43a77a6155c2e6e884207100d8270fa8ea13a93900ff16f0bd67c1ad2af0a041 -size 266999 +oid sha256:a6474e5c549f8ed37466456760ea25a008356b83b11eaa49c86b500552049a55 +size 228203 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png index b6d0d3e11cc..e5bd601c4a0 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a87f04aae29392a286b618630430184f21c566d81b9af5ab5a0a757b93302c3 -size 233300 +oid sha256:35ff1830c77c9e65fc7f7d0dbccf95f47c3ae4398fb7341d7a95e2425538c134 +size 233075