Advertisement
Guest User

spiral shader

a guest
Apr 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. Shader "Unlit/NewUnlitShader"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Mask", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Tags {"Queue"="Transparent" "IgnoreProjector"="True"}
  10. ZWrite Off
  11. Blend SrcAlpha OneMinusSrcAlpha
  12.  
  13. Pass
  14. {
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18.  
  19. #include "UnityCG.cginc"
  20.  
  21. struct appdata
  22. {
  23. float4 vertex : POSITION;
  24. float2 uv : TEXCOORD0;
  25. };
  26.  
  27. struct v2f
  28. {
  29. float2 uv : TEXCOORD0;
  30. float4 vertex : SV_POSITION;
  31. };
  32.  
  33. sampler2D _MainTex;
  34. float4 _MainTex_ST;
  35.  
  36. v2f vert (appdata v)
  37. {
  38. v2f o;
  39. o.vertex = UnityObjectToClipPos(v.vertex);
  40. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  41. return o;
  42. }
  43.  
  44. fixed4 frag (v2f i) : SV_Target
  45. {
  46.  
  47. float2 st = i.uv;
  48. st *= 1.;
  49. st.x -= 0.5;
  50. st.y -= 0.5;
  51. float R = 3.5;
  52. float a = atan2(st.y, st.x);
  53. float r = length(st);
  54. a += 100.0 * r/R + 10.0*_Time.y;
  55. float y = r*sin(a);
  56. float col = smoothstep(st.y - 0.1, st.y, y) - smoothstep(st.y, st.y + 0.01, y);
  57.  
  58. col *= tex2D(_MainTex, i.uv);
  59.  
  60. return float4(col,0,0, step(0.5, col));
  61. }
  62. ENDCG
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement