1. Shader "Billboard/Default"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  6. }
  7.  
  8. SubShader
  9. {
  10. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  11. Offset -100, -1 ZWrite Off Lighting Off Cull Off Fog { Mode Off } Blend SrcAlpha OneMinusSrcAlpha
  12. LOD 110
  13.  
  14. Pass
  15. {
  16. CGPROGRAM
  17. #pragma vertex vert_vct
  18. #pragma fragment frag_mult
  19. #pragma fragmentoption ARB_precision_hint_fastest
  20. #include "UnityCG.cginc"
  21.  
  22. sampler2D _MainTex;
  23. float4 _MainTex_ST;
  24.  
  25. struct vin_vct
  26. {
  27. float4 vertex : POSITION;
  28. float4 color : COLOR;
  29. float2 texcoord : TEXCOORD0;
  30. };
  31.  
  32. struct v2f_vct
  33. {
  34. float4 vertex : POSITION;
  35. fixed4 color : COLOR;
  36. half2 texcoord : TEXCOORD0;
  37. };
  38.  
  39. v2f_vct vert_vct(vin_vct input)
  40. {
  41. v2f_vct output;
  42.  
  43. output.vertex = mul(UNITY_MATRIX_P,
  44. mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
  45. + float4(input.vertex.x, input.vertex.y, 0.0, 0.0));
  46.  
  47. output.color = input.color;
  48. output.texcoord = input.texcoord;
  49. return output;
  50. }
  51.  
  52. fixed4 frag_mult(v2f_vct i) : COLOR
  53. {
  54. fixed4 col = tex2D(_MainTex, i.texcoord) * i.color;
  55. return col;
  56. }
  57.  
  58. ENDCG
  59. }
  60. }
  61.  
  62. SubShader
  63. {
  64. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  65. Offset -100, -1 ZWrite Off Blend SrcAlpha OneMinusSrcAlpha Cull Off Fog { Mode Off }
  66. LOD 100
  67.  
  68. BindChannels
  69. {
  70. Bind "Vertex", vertex
  71. Bind "TexCoord", texcoord
  72. Bind "Color", color
  73. }
  74.  
  75. Pass
  76. {
  77. Lighting Off
  78. SetTexture [_MainTex] { combine texture * primary }
  79. }
  80. }
  81. }