ZED_Blit.shader 981 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //======= Copyright (c) Stereolabs Corporation, All rights reserved. ===============
  2. //Custom blit, to blit canal alpha to all canals
  3. Shader "ZED/ZED Blit"
  4. {
  5. Properties
  6. {
  7. _MainTex ("Texture", 2D) = "white" {}
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType"="Opaque" }
  12. //Blit Alpha to R
  13. Pass
  14. {
  15. ZTest Always Cull Off ZWrite Off
  16. CGPROGRAM
  17. #pragma vertex vert
  18. #pragma fragment frag
  19. #include "UnityCG.cginc"
  20. struct appdata
  21. {
  22. float4 vertex : POSITION;
  23. float2 uv : TEXCOORD0;
  24. };
  25. struct v2f
  26. {
  27. float2 uv : TEXCOORD0;
  28. float4 vertex : SV_POSITION;
  29. };
  30. sampler2D _MainTex;
  31. float4 _MainTex_ST;
  32. v2f vert (appdata v)
  33. {
  34. v2f o;
  35. o.vertex = UnityObjectToClipPos(v.vertex);
  36. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  37. return o;
  38. }
  39. fixed4 frag (v2f i) : SV_Target
  40. {
  41. fixed col = tex2D(_MainTex, i.uv).a;
  42. return col;
  43. }
  44. ENDCG
  45. }
  46. }
  47. }