summaryrefslogtreecommitdiffstats
path: root/DepthBlit.shader
diff options
context:
space:
mode:
Diffstat (limited to 'DepthBlit.shader')
-rw-r--r--DepthBlit.shader15
1 files changed, 6 insertions, 9 deletions
diff --git a/DepthBlit.shader b/DepthBlit.shader
index 04187c2..4094fe5 100644
--- a/DepthBlit.shader
+++ b/DepthBlit.shader
@@ -4,6 +4,8 @@ Shader "Hidden/yum_food/DepthBlit"
Properties
{
_MainTex ("", 2D) = "white" {}
+ _Near ("Near Plane", Float) = 0.01
+ _Far ("Far Plane", Float) = 1.0
}
SubShader
@@ -19,6 +21,8 @@ Shader "Hidden/yum_food/DepthBlit"
#include "UnityCG.cginc"
sampler2D _DepthTex;
+ float _Near;
+ float _Far;
struct v2f
{
@@ -36,15 +40,8 @@ Shader "Hidden/yum_food/DepthBlit"
float4 frag(v2f i) : SV_Target
{
- float rawDepth = tex2D(_DepthTex, i.uv).r;
-
- // Orthographic depth is already linear.
- // We just need to handle the platform-specific Z-buffer direction.
- #if defined(UNITY_REVERSED_Z)
- return 1.0 - rawDepth;
- #else
- return rawDepth;
- #endif
+ // 0 = near clip plane, 1 = far clip plane.
+ return tex2D(_DepthTex, i.uv).r;
}
ENDCG
}