Beacon.shader 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Shader "CompassNavigatorPro/Beacon"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. _Color ("Main Color", Color) = (1,1,1,1)
  7. _EmissionMap("Emission Map", 2D) = "black" {}
  8. _EmmisionColor("Emission Color", Color) = (1,1,1,1)
  9. _Intensity("Intensity", Float) = 1
  10. }
  11. SubShader
  12. {
  13. Tags { "RenderType"="Transparent" "Queue"="Transparent" }
  14. LOD 100
  15. Pass
  16. {
  17. Blend SrcAlpha OneMinusSrcAlpha
  18. CGPROGRAM
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. // make fog work
  22. #pragma multi_compile_fog
  23. #include "UnityCG.cginc"
  24. struct appdata
  25. {
  26. float4 vertex : POSITION;
  27. float2 uv : TEXCOORD0;
  28. };
  29. struct v2f
  30. {
  31. float4 vertex : SV_POSITION;
  32. float2 uv : TEXCOORD0;
  33. float2 uvEmission : TEXCOORD1;
  34. UNITY_FOG_COORDS(2)
  35. };
  36. sampler2D _MainTex, _EmissionMap;
  37. float4 _MainTex_ST, _EmissionMap_ST;
  38. fixed4 _Color, _EmissionColor;
  39. fixed _Intensity;
  40. v2f vert (appdata v)
  41. {
  42. v2f o;
  43. o.vertex = UnityObjectToClipPos(v.vertex);
  44. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  45. o.uvEmission = TRANSFORM_TEX(v.uv, _EmissionMap);
  46. UNITY_TRANSFER_FOG(o,o.vertex);
  47. return o;
  48. }
  49. fixed4 frag (v2f i) : SV_Target
  50. {
  51. // sample the texture
  52. fixed4 col = tex2D(_MainTex, i.uv) * _Color;
  53. fixed4 emi = tex2D(_EmissionMap, i.uvEmission) * _EmissionColor;
  54. col += emi;
  55. col.a *= _Color.a;
  56. col *= _Intensity;
  57. // apply fog
  58. UNITY_APPLY_FOG(i.fogCoord, col);
  59. return col;
  60. }
  61. ENDCG
  62. }
  63. }
  64. }