Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Fix] fix reverse-z bug in Chapter13-MotionBlurWithDepthTexture in Un…
…ity 5.5+
  • Loading branch information
candycat1992 committed Oct 31, 2017
commit 31d4abac1961689d3188eb8878060fb1b2a2c336
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
fixed4 frag(v2f i) : SV_Target {
// Get the depth buffer value at this pixel.
float d = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv_depth);
#if defined(UNITY_REVERSED_Z)
d = 1.0 - d;
#endif
// H is the viewport position at this pixel in the range -1 to 1.
float4 H = float4(i.uv.x * 2 - 1, i.uv.y * 2 - 1, d * 2 - 1, 1);
// Transform by the view-projection inverse.
Expand Down