GlowConeTap.shader 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/GlowConeTap" {
  3. Properties {
  4. _Color ("Color", color) = (1,1,1,0)
  5. _MainTex ("", 2D) = "white" {}
  6. }
  7. Category {
  8. ZTest Always Cull Off ZWrite Off Fog { Mode Off }
  9. Subshader {
  10. Pass {
  11. CGPROGRAM
  12. #pragma vertex vert
  13. #pragma fragment frag
  14. #pragma fragmentoption ARB_precision_hint_fastest
  15. #include "UnityCG.cginc"
  16. struct v2f {
  17. float4 pos : POSITION;
  18. half4 uv[2] : TEXCOORD0;
  19. };
  20. float4 _MainTex_TexelSize;
  21. float4 _BlurOffsets;
  22. v2f vert (appdata_img v)
  23. {
  24. v2f o;
  25. float offX = _MainTex_TexelSize.x * _BlurOffsets.x;
  26. float offY = _MainTex_TexelSize.y * _BlurOffsets.y;
  27. o.pos = UnityObjectToClipPos (v.vertex);
  28. float2 uv = MultiplyUV (UNITY_MATRIX_TEXTURE0, v.texcoord.xy-float2(offX, offY));
  29. o.uv[0].xy = uv + float2( offX, offY);
  30. o.uv[0].zw = uv + float2(-offX, offY);
  31. o.uv[1].xy = uv + float2( offX,-offY);
  32. o.uv[1].zw = uv + float2(-offX,-offY);
  33. return o;
  34. }
  35. sampler2D _MainTex;
  36. fixed4 _Color;
  37. fixed4 frag( v2f i ) : COLOR
  38. {
  39. fixed4 c;
  40. c = tex2D( _MainTex, i.uv[0].xy );
  41. c += tex2D( _MainTex, i.uv[0].zw );
  42. c += tex2D( _MainTex, i.uv[1].xy );
  43. c += tex2D( _MainTex, i.uv[1].zw );
  44. c.rgb *= _Color.rgb;
  45. return c * _Color.a;
  46. }
  47. ENDCG
  48. }
  49. }
  50. Subshader {
  51. Pass {
  52. SetTexture [_MainTex] {constantColor [_Color] combine texture * constant alpha}
  53. SetTexture [_MainTex] {constantColor [_Color] combine texture * constant + previous}
  54. SetTexture [_MainTex] {constantColor [_Color] combine texture * constant + previous}
  55. SetTexture [_MainTex] {constantColor [_Color] combine texture * constant + previous}
  56. }
  57. }
  58. }
  59. Fallback off
  60. }