XGame-TestTime.shader 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Shader "XGame/TestTime"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. _ScrollY ("Scroll Speed", Range(0, 1)) = 1
  7. _MoveTime("Move Time", float) = 0
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType"="Opaque" }
  12. LOD 100
  13. Pass
  14. {
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18. // make fog work
  19. // #pragma multi_compile_fog
  20. #include "UnityCG.cginc"
  21. struct appdata
  22. {
  23. float4 vertex : POSITION;
  24. float2 uv : TEXCOORD0;
  25. };
  26. struct v2f
  27. {
  28. float2 uv : TEXCOORD0;
  29. float4 vertex : POSITION;
  30. };
  31. sampler2D _MainTex;
  32. float4 _MainTex_ST;
  33. float _ScrollY;
  34. float _MoveTime;
  35. v2f vert (appdata v)
  36. {
  37. v2f o;
  38. // v.vertex.y = sin(v.vertex.x+_Time.y);
  39. o.vertex = UnityObjectToClipPos(v.vertex);
  40. o.uv = v.uv + float2(0, _ScrollY * _MoveTime);
  41. return o;
  42. }
  43. fixed4 frag (v2f i) : SV_Target
  44. {
  45. fixed4 col = tex2D(_MainTex, i.uv);
  46. return col;
  47. }
  48. ENDCG
  49. }
  50. }
  51. }