ZED_Fade.shader 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //======= Copyright (c) Stereolabs Corporation, All rights reserved. ===============
  2. //Fade system depending on the current alpha
  3. Shader "ZED/ZED Fade"
  4. {
  5. Properties
  6. {
  7. _MainTex ("Texture", 2D) = "white" {}
  8. _FadeColor("Wire color", Color) = (1.0, 1.0, 1.0, 1.0)
  9. }
  10. SubShader
  11. {
  12. Tags { "RenderType"="Opaque" }
  13. LOD 100
  14. Pass
  15. {
  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. float4 _FadeColor;
  33. uniform float _Alpha;
  34. v2f vert (appdata v)
  35. {
  36. v2f o;
  37. o.vertex = UnityObjectToClipPos(v.vertex);
  38. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  39. return o;
  40. }
  41. fixed4 frag (v2f i) : SV_Target
  42. {
  43. // sample the texture
  44. fixed4 col = tex2D(_MainTex, i.uv);
  45. return col*(1 - _Alpha) + (_Alpha)*_FadeColor;
  46. }
  47. ENDCG
  48. }
  49. }
  50. }