Skip to content

Commit 02e301d

Browse files
Disable TAA sharpening on alpha (#4227)
* Disable sharpening on alpha * Changelog * Move the define below options * Update TemporalAntialiasing.hlsl * Update ref images * update win vulkan image Co-authored-by: sebastienlagarde <[email protected]>
1 parent 2d8e29e commit 02e301d

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
202202
- Changed ray tracing acceleration structure build, so that only meshes with HDRP materials are included (case 1322365).
203203
- Increased path tracing max samples from 4K to 16K (case 1327729).
204204
- Film grain does not affect the alpha channel.
205+
- Disable TAA sharpening on alpha channel.
205206

206207
## [10.3.0] - 2020-12-01
207208

com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/TemporalAntialiasing.hlsl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define CTYPE_SWIZZLE xyz
1212
#endif
1313

14-
1514
#if UNITY_REVERSED_Z
1615
#define COMPARE_DEPTH(a, b) step(b, a)
1716
#else
@@ -49,6 +48,8 @@ float4 Fetch4Array(Texture2DArray tex, uint slot, float2 coords, float2 offset,
4948
// Options
5049
// ---------------------------------------------------
5150

51+
#define SHARPEN_ALPHA 0 // switch to 1 if you want to enable TAA sharpenning on alpha channel
52+
5253
// History sampling options
5354
#define BILINEAR 0
5455
#define BICUBIC_5TAP 1
@@ -717,5 +718,11 @@ CTYPE SharpenColor(NeighbourhoodSamples samples, CTYPE color, float sharpenStren
717718
linearC = linearC + (linearC - linearAvg) * sharpenStrength * 3;
718719
linearC = clamp(linearC, 0, CLAMP_MAX);
719720
#endif
720-
return linearC * PerceptualWeight(linearC);
721+
CTYPE outputSharpened = linearC * PerceptualWeight(linearC);
722+
723+
#if (SHARPEN_ALPHA == 0 && defined(ENABLE_ALPHA))
724+
outputSharpened.a = color.a;
725+
#endif
726+
727+
return outputSharpened;
721728
}

0 commit comments

Comments
 (0)