title: How can I get Z-depth from unlit shader?
body: <p>Currently, I try to make z depth effect as Image Effect, but result image is not correctly rendered. something wrong...</p>
  
  <p>If I use standard shader (unity 5), result image was correctly rendered(z depth image is ok), but not unlit shader.</p>
  
  <p>what happen? if you have any idea, tell me why.</p>
  
  <h3>shader</h3>
  
  <pre><code>Shader "Custom/RenderDepth"
  {
      Properties
      {
          _DepthLevel ("Depth Level", Range(1, 3)) = 2
      }
      SubShader
      {
          Pass
          {
  
              CGPROGRAM
  
              #pragma vertex vert
              #pragma fragment frag
              #include "UnityCG.cginc"
  
              uniform sampler2D_float _CameraDepthTexture;
              uniform fixed _DepthLevel;
              uniform half4 _MainTex_TexelSize;
  
              struct uinput
              {
                  float4 pos : POSITION;
                  half2 uv : TEXCOORD0;
              };
  
              struct uoutput
              {
                  float4 pos : SV_POSITION;
                  half2 uv : TEXCOORD0;
              };
  
              uoutput vert(uinput i)
              {
                  uoutput o;
                  o.pos = mul(UNITY_MATRIX_MVP, i.pos);
                  o.uv = MultiplyUV(UNITY_MATRIX_TEXTURE0, i.uv);
                  return o;
              }
  
              fixed4 frag(uoutput o) : COLOR
              {
                  float depth = UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, o.uv));
                  depth = pow(Linear01Depth(depth), _DepthLevel);
                  return depth;
              }
  
              ENDCG
          }
      }
  }
  </code></pre>
  
  <h3>CS</h3>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  [ExecuteInEditMode]
  [RequireComponent (typeof(Camera))]
  public class Test : MonoBehaviour
  {
      public Camera _cam;
      public Material mat;
  
      public float DepthLevel = 1.0F;
  
      void Start ()
      {
          _cam.depthTextureMode |= DepthTextureMode.Depth;
      }
  
      void Update ()
      {
      }
  
      void OnRenderImage (RenderTexture source, RenderTexture destination)
      {
          mat.SetFloat("_DepthLevel", DepthLevel);
          Graphics.Blit(source, destination, mat);
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/s4LYN.jpg" alt="Standar Shader(Unity5)"></p>
  
  <p><img src="https://i.stack.imgur.com/8M6yM.jpg" alt="Unlit Shader"></p>