You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
899 B

5 years ago
  1. Shader "Fog Volume/RT viewers/_CameraDepthTexture"
  2. {
  3. Properties{
  4. _MainTex("Base", 2D) = "" {}
  5. _Intensity("Intensity", Range(1, 20)) = 1
  6. }
  7. SubShader
  8. {
  9. Tags { "RenderType"="Opaque" }
  10. LOD 100
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. #include "UnityCG.cginc"
  17. float _Intensity;
  18. struct appdata
  19. {
  20. float4 vertex : POSITION;
  21. float2 uv : TEXCOORD0;
  22. };
  23. struct v2f
  24. {
  25. float2 uv : TEXCOORD0;
  26. float4 vertex : SV_POSITION;
  27. };
  28. sampler2D _CameraDepthTexture;
  29. float4 _MainTex_ST;
  30. v2f vert (appdata v)
  31. {
  32. v2f o;
  33. o.vertex = UnityObjectToClipPos(v.vertex);
  34. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  35. return o;
  36. }
  37. fixed4 frag (v2f i) : SV_Target
  38. {
  39. // sample the texture
  40. fixed4 col = tex2D(_CameraDepthTexture, i.uv).r;
  41. return col*_Intensity;
  42. }
  43. ENDCG
  44. }
  45. }
  46. }