Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 8993b8e

Browse files
committed
Merge remote-tracking branch 'refs/remotes/Unity-Technologies/master'
2 parents 0854a60 + 6862b5c commit 8993b8e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

PostProcessing/Resources/Shaders/TAA.cginc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,17 @@ float2 GetClosestFragment(float2 uv)
7373
SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv + k)
7474
);
7575

76+
#if defined(UNITY_REVERSED_Z)
77+
#define COMPARE_DEPTH(a, b) step(b, a)
78+
#else
79+
#define COMPARE_DEPTH(a, b) step(a, b)
80+
#endif
81+
7682
float3 result = float3(0.0, 0.0, SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv));
77-
result = lerp(result, float3(-1.0, -1.0, neighborhood.x), step(neighborhood.x, result.z));
78-
result = lerp(result, float3( 1.0, -1.0, neighborhood.y), step(neighborhood.y, result.z));
79-
result = lerp(result, float3(-1.0, 1.0, neighborhood.z), step(neighborhood.z, result.z));
80-
result = lerp(result, float3( 1.0, 1.0, neighborhood.w), step(neighborhood.w, result.z));
83+
result = lerp(result, float3(-1.0, -1.0, neighborhood.x), COMPARE_DEPTH(neighborhood.x, result.z));
84+
result = lerp(result, float3( 1.0, -1.0, neighborhood.y), COMPARE_DEPTH(neighborhood.y, result.z));
85+
result = lerp(result, float3(-1.0, 1.0, neighborhood.z), COMPARE_DEPTH(neighborhood.z, result.z));
86+
result = lerp(result, float3( 1.0, 1.0, neighborhood.w), COMPARE_DEPTH(neighborhood.w, result.z));
8187

8288
return (uv + result.xy * k);
8389
}

0 commit comments

Comments
 (0)