WaiBao_02.shader 1.9 KB

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