From 200637da5ba0e80d1b57b658e75b9e81061f7039 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Mon, 19 Apr 2021 15:56:14 +0200 Subject: [PATCH 1/6] Disable sharpening on alpha --- .../PostProcessing/Shaders/TemporalAntialiasing.hlsl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl index ebb6d9dbc35..65e90f3b628 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl @@ -6,12 +6,13 @@ // Legacy defines, DON'T USE IN NEW PASSES THAT USE TEMPORAL AA #define RADIUS 0.75 +#define SHARPEN_ALPHA 0 + #if !defined(CTYPE) #define CTYPE float3 #define CTYPE_SWIZZLE xyz #endif - #if UNITY_REVERSED_Z #define COMPARE_DEPTH(a, b) step(b, a) #else @@ -717,5 +718,11 @@ CTYPE SharpenColor(NeighbourhoodSamples samples, CTYPE color, float sharpenStren linearC = linearC + (linearC - linearAvg) * sharpenStrength * 3; linearC = clamp(linearC, 0, CLAMP_MAX); #endif - return linearC * PerceptualWeight(linearC); + CTYPE outputSharpened = linearC * PerceptualWeight(linearC); + +#if (SHARPEN_ALPHA == 0 && defined(ENABLE_ALPHA)) + outputSharpened.a = color.a; +#endif + + return outputSharpened; } From ff6acee583127d0e8fea00622111c235874562b2 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Mon, 19 Apr 2021 15:57:48 +0200 Subject: [PATCH 2/6] Changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 9e5d2575d4e..27186bc9c66 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -150,6 +150,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix potential NaN on apply distortion pass. - Fixed the camera controller in the template with the old input system (case 1326816). - Fixed broken Lanczos filter artifacts on ps4, caused by a very aggressive epsilon (case 1328904) +- Disable TAA sharpening on alpha channel. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard From a9ead86656b7af88d58db095616f023861601bfb Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Mon, 19 Apr 2021 16:24:13 +0200 Subject: [PATCH 3/6] Move the define below options --- .../Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl index 65e90f3b628..4dd12181469 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl @@ -6,8 +6,6 @@ // Legacy defines, DON'T USE IN NEW PASSES THAT USE TEMPORAL AA #define RADIUS 0.75 -#define SHARPEN_ALPHA 0 - #if !defined(CTYPE) #define CTYPE float3 #define CTYPE_SWIZZLE xyz @@ -50,6 +48,8 @@ float4 Fetch4Array(Texture2DArray tex, uint slot, float2 coords, float2 offset, // Options // --------------------------------------------------- +#define SHARPEN_ALPHA 0 + // History sampling options #define BILINEAR 0 #define BICUBIC_5TAP 1 From 9096a32d25efffa476d499a8e284f1341411e0a5 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Tue, 20 Apr 2021 10:13:33 +0200 Subject: [PATCH 4/6] Update TemporalAntialiasing.hlsl --- .../Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl index 4dd12181469..a17d7891173 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl @@ -48,7 +48,7 @@ float4 Fetch4Array(Texture2DArray tex, uint slot, float2 coords, float2 offset, // Options // --------------------------------------------------- -#define SHARPEN_ALPHA 0 +#define SHARPEN_ALPHA 0 // switch to 1 if you want to enable TAA sharpenning on alpha channel // History sampling options #define BILINEAR 0 From ef0115746e105904d6f5fbd113f7f12bc17797c7 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Tue, 20 Apr 2021 11:53:48 +0200 Subject: [PATCH 5/6] Update ref images --- .../Linear/LinuxEditor/Vulkan/None/4053_TAA-FP16Alpha.png | 4 ++-- .../WindowsEditor/Direct3D11/None/4053_TAA-FP16Alpha.png | 4 ++-- .../WindowsEditor/Direct3D12/None/4053_TAA-FP16Alpha.png | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4053_TAA-FP16Alpha.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4053_TAA-FP16Alpha.png index cca086bcef3..de41dc14321 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4053_TAA-FP16Alpha.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/4053_TAA-FP16Alpha.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9735a8fd95812d2e3e7411a8fa6a08454154f1173c09893c1539aadc4ebc265c -size 240651 +oid sha256:effbcbb24599ca89bcb0b99284769a32852531e79de9368048531e3cffe82972 +size 204829 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4053_TAA-FP16Alpha.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4053_TAA-FP16Alpha.png index 8c2f382b5e4..b547eaad820 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4053_TAA-FP16Alpha.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/4053_TAA-FP16Alpha.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5bbb287a925e1a4dba1232fff20f6b562622a60ab0b6cc8dda04fc63b4c23f75 -size 240678 +oid sha256:ec59d9a2dc4de6d09000dbfe3d736a0d97ba6f862840596d58f26b35b53661ea +size 204811 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4053_TAA-FP16Alpha.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4053_TAA-FP16Alpha.png index 8c2f382b5e4..b547eaad820 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4053_TAA-FP16Alpha.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/4053_TAA-FP16Alpha.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5bbb287a925e1a4dba1232fff20f6b562622a60ab0b6cc8dda04fc63b4c23f75 -size 240678 +oid sha256:ec59d9a2dc4de6d09000dbfe3d736a0d97ba6f862840596d58f26b35b53661ea +size 204811 From 71d425eed8c360d394163bc96aac700a4292960e Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Tue, 20 Apr 2021 21:25:04 +0200 Subject: [PATCH 6/6] update win vulkan image --- .../Linear/WindowsEditor/Vulkan/None/4053_TAA-FP16Alpha.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4053_TAA-FP16Alpha.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4053_TAA-FP16Alpha.png index cca086bcef3..de41dc14321 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4053_TAA-FP16Alpha.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/4053_TAA-FP16Alpha.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9735a8fd95812d2e3e7411a8fa6a08454154f1173c09893c1539aadc4ebc265c -size 240651 +oid sha256:effbcbb24599ca89bcb0b99284769a32852531e79de9368048531e3cffe82972 +size 204829