GlowAdditiveTwoColor.shader 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Effects/GlowAdditiveTwoColor" {
  3. Properties {
  4. _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
  5. _CoreColor ("Core Color", Color) = (0.5,0.5,0.5,0.5)
  6. _MainTex ("Particle Texture", 2D) = "white" {}
  7. _TintStrength ("Tint Color Strength", Float) = 1
  8. _CoreStrength ("Core Color Strength", Float) = 1
  9. _CutOutLightCore ("CutOut Light Core", Range(0, 1)) = 0.5
  10. _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
  11. }
  12. Category {
  13. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  14. Blend SrcAlpha One
  15. AlphaTest Greater .01
  16. ColorMask RGB
  17. Cull Off
  18. Lighting Off
  19. ZWrite Off
  20. Fog { Color (0,0,0,0) }
  21. SubShader {
  22. Pass {
  23. CGPROGRAM
  24. #pragma vertex vert
  25. #pragma fragment frag
  26. #pragma multi_compile_particles
  27. #include "UnityCG.cginc"
  28. sampler2D _MainTex;
  29. fixed4 _TintColor;
  30. fixed4 _CoreColor;
  31. float _CutOutLightCore;
  32. float _TintStrength;
  33. float _CoreStrength;
  34. struct appdata_t {
  35. float4 vertex : POSITION;
  36. fixed4 color : COLOR;
  37. float2 texcoord : TEXCOORD0;
  38. };
  39. struct v2f {
  40. float4 vertex : POSITION;
  41. fixed4 color : COLOR;
  42. float2 texcoord : TEXCOORD0;
  43. #ifdef SOFTPARTICLES_ON
  44. float4 projPos : TEXCOORD1;
  45. #endif
  46. };
  47. float4 _MainTex_ST;
  48. v2f vert (appdata_t v)
  49. {
  50. v2f o;
  51. o.vertex = UnityObjectToClipPos(v.vertex);
  52. #ifdef SOFTPARTICLES_ON
  53. o.projPos = ComputeScreenPos (o.vertex);
  54. COMPUTE_EYEDEPTH(o.projPos.z);
  55. #endif
  56. o.color = v.color;
  57. o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
  58. return o;
  59. }
  60. sampler2D _CameraDepthTexture;
  61. float _InvFade;
  62. fixed4 frag (v2f i) : COLOR
  63. {
  64. #ifdef SOFTPARTICLES_ON
  65. float sceneZ = LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))));
  66. float partZ = i.projPos.z;
  67. float fade = saturate (_InvFade * (sceneZ-partZ));
  68. //i.color.a *= fade;
  69. #endif
  70. fixed4 tex = tex2D(_MainTex, i.texcoord);
  71. fixed4 col = (_TintColor * tex.g * _TintStrength + tex.r * _CoreColor * _CoreStrength - _CutOutLightCore);
  72. return i.color * clamp(col, 0, 255);
  73. }
  74. ENDCG
  75. }
  76. }
  77. }
  78. }