SkyboxToRGBADepth.shader 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/SkyboxToRGBADepth"
  3. {
  4. Properties
  5. {
  6. _MainTex ("Base (RGB)", 2D) = "" {}
  7. }
  8. // Shader code pasted into all further CGPROGRAM blocks
  9. CGINCLUDE
  10. #include "UnityCG.cginc"
  11. struct v2f {
  12. float4 pos : POSITION;
  13. float2 uv : TEXCOORD0;
  14. };
  15. uniform float noSkyBoxMask;
  16. uniform float dontUseSkyboxBrightness;
  17. sampler2D _MainTex;
  18. v2f vert( appdata_img v ) {
  19. v2f o;
  20. o.pos = UnityObjectToClipPos(v.vertex);
  21. o.uv = v.texcoord.xy;
  22. return o;
  23. }
  24. half4 frag(v2f i) : COLOR {
  25. float4 skyboxValue = tex2D( _MainTex, i.uv.xy );
  26. return max( skyboxValue.a, noSkyBoxMask * dot(skyboxValue.rgb,float3(0.59,0.3,0.11)) );
  27. }
  28. ENDCG
  29. Subshader {
  30. Pass {
  31. ZTest Always Cull Off ZWrite Off
  32. Fog { Mode off }
  33. CGPROGRAM
  34. #pragma fragmentoption ARB_precision_hint_fastest
  35. #pragma vertex vert
  36. #pragma fragment frag
  37. // the Cg code itself
  38. ENDCG
  39. // ... the rest of pass setup ...
  40. }
  41. }
  42. Fallback off
  43. } // shader