diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-17 14:43:18 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-17 15:11:56 -0800 |
| commit | c6923a553c98da7805407fe1fbfdb6c69c8d7530 (patch) | |
| tree | ad4a46d220fbb210cf82ffbe83b14ed05bab0a28 /DepthBlit.shader | |
| parent | 02c32fcc30e753da96f0aa072ed1d74ca300979c (diff) | |
Impostors: continue work on depth
Diffstat (limited to 'DepthBlit.shader')
| -rw-r--r-- | DepthBlit.shader | 15 |
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 } |
