Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. Shader "ShaderDrill/ScrollByTime"
  2. {
  3. Properties
  4. {
  5. _MainTex("Texture", 2D) = "white" {}
  6. _SpeedU("Speed U", Float) = 1.0
  7. _SpeedV("Speed V", Float) = 1.0
  8. }
  9. SubShader
  10. {
  11. Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
  12.  
  13. Blend SrcAlpha OneMinusSrcAlpha
  14.  
  15. ZWrite Off
  16. ZTest LEqual
  17.  
  18. Pass
  19. {
  20. CGPROGRAM
  21.  
  22. #pragma vertex vert
  23. #pragma fragment frag
  24.  
  25. #include "UnityCG.cginc"
  26.  
  27. struct appdata_t
  28. {
  29. float4 vertex : POSITION;
  30. float2 texcoord : TEXCOORD0;
  31. };
  32.  
  33. struct v2f
  34. {
  35. float4 vertex : SV_POSITION;
  36. float2 texcoord : TEXCOORD0;
  37. };
  38.  
  39. sampler2D _MainTex;
  40. float4 _MainTex_ST;
  41. float _SpeedU;
  42. float _SpeedV;
  43.  
  44. v2f vert(appdata_t v)
  45. {
  46. v2f o;
  47. o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
  48. o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
  49. return o;
  50. }
  51.  
  52. fixed4 frag(v2f i) : SV_Target
  53. {
  54. float2 offset;
  55. offset.x = _SpeedU * _Time.y;
  56. offset.y = _SpeedV * _Time.y;
  57. fixed4 dst = tex2D(_MainTex, i.texcoord + offset);
  58. return dst;
  59. }
  60.  
  61. ENDCG
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement