EffectDissolveZ.shader 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "WPYS/Effect/Special/EffectDissolveZ"
  3. {
  4. Properties
  5. {
  6. _MainTex ("Texture", 2D) = "white" {}
  7. _TintColor("Tint Color", Color) = (1, 1, 1, 1)
  8. _DissolveTex("DissolveTex", 2D) = "white" {}
  9. _Dissolve("Dissolve", Range(0, 1)) = 0
  10. }
  11. Category{
  12. Tags{ "Queue" = "Transparent+200" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
  13. Blend SrcAlpha OneMinusSrcAlpha
  14. Cull Off Lighting Off ZWrite On
  15. SubShader
  16. {
  17. Pass
  18. {
  19. CGPROGRAM
  20. #pragma fragmentoption ARB_precision_hint_fastest
  21. #pragma vertex vert
  22. #pragma fragment frag
  23. #pragma multi_compile_particles
  24. #include "UnityCG.cginc"
  25. struct appdata
  26. {
  27. half4 vertex : POSITION;
  28. fixed4 color : COLOR;
  29. half2 uv : TEXCOORD0;
  30. };
  31. struct v2f
  32. {
  33. half4 vertex : SV_POSITION;
  34. fixed4 color : COLOR;
  35. half2 uv : TEXCOORD0;
  36. half2 uv2 : TEXCOORD1;
  37. };
  38. sampler2D _MainTex;
  39. sampler2D _DissolveTex;
  40. fixed4 _MainTex_ST;
  41. fixed4 _DissolveTex_ST;
  42. v2f vert(appdata v)
  43. {
  44. v2f o;
  45. o.vertex = UnityObjectToClipPos(v.vertex);
  46. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  47. o.uv2 = TRANSFORM_TEX(v.uv, _DissolveTex);
  48. o.color = v.color;
  49. return o;
  50. }
  51. fixed4 _TintColor;
  52. fixed _Dissolve;
  53. fixed4 frag(v2f i) : SV_Target
  54. {
  55. fixed4 disov = tex2D(_DissolveTex, i.uv2);
  56. disov.r += i.color.a - 1;
  57. clip(disov.r - _Dissolve);
  58. // sample the texture
  59. fixed4 col = tex2D(_MainTex, i.uv) * _TintColor;
  60. col.rgb *= i.color.rgb;
  61. return col;
  62. }
  63. ENDCG
  64. }
  65. }
  66. SubShader {
  67. Lighting Off
  68. Blend SrcAlpha OneMinusSrcAlpha
  69. Pass {
  70. Name "BASE"
  71. SetTexture[_MainTex] {
  72. constantColor[_TintColor]
  73. combine texture * constant
  74. }
  75. SetTexture[_MainTex] {
  76. combine previous * Primary
  77. }
  78. }
  79. }
  80. }
  81. }