ShuiLiZi.shader 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. Shader "Unlit/ShuiLiZi"
  2. {
  3. Properties
  4. {
  5. _MainColor("MianColor",color) = (1,1,1,1)
  6. _MainTex ("Texture", 2D) = "white"
  7. _MoveSpeed("MoveSpeed",Vector) = (0,0,0,0)
  8. }
  9. SubShader
  10. {
  11. Tags { "Queue" = "Transparent" "RenderType"="Transparent" }
  12. Blend SrcAlpha OneMinusSrcAlpha
  13. Pass
  14. {
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18. #include "UnityCG.cginc"
  19. struct appdata
  20. {
  21. float4 vertex : POSITION;
  22. float4 uv : TEXCOORD0;
  23. fixed4 color : COLOR;
  24. };
  25. struct v2f
  26. {
  27. float4 uv : TEXCOORD0;
  28. fixed4 color : TEXCOORD1;
  29. float4 vertex : SV_POSITION;
  30. };
  31. sampler2D _MainTex;
  32. float4 _MainTex_ST;
  33. fixed4 _MainColor;
  34. float4 _MoveSpeed;
  35. v2f vert (appdata v)
  36. {
  37. v2f o;
  38. o.vertex = UnityObjectToClipPos(v.vertex);
  39. o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
  40. o.uv.xy += _Time.y * float2(_MoveSpeed.x, _MoveSpeed.y);
  41. o.uv.zw = v.uv.zw;
  42. o.color = v.color;
  43. return o;
  44. }
  45. fixed4 frag (v2f i) : SV_Target
  46. {
  47. // sample the texture
  48. fixed4 col = tex2D(_MainTex, i.uv.xy);
  49. clip(col.a - i.uv.z);
  50. col *= _MainColor;
  51. col *= i.color;
  52. return col;
  53. }
  54. ENDCG
  55. }
  56. }
  57. }