SHARE
TWEET

Untitled

a guest Oct 21st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uniform vec2 resolution;
  2. uniform float zoom, panx, pany;
  3.  
  4. void main(void)
  5. {
  6.     // vec2 res = vec2(1366.0, 768.0);
  7.     vec2 uv = gl_FragCoord.xy / resolution.xy * zoom;
  8.     float scale = resolution.y / resolution.x;
  9.     uv=((uv-0.5)*5.5);
  10.     uv.y*=scale;
  11.     uv.y+=pany;
  12.     uv.x-=0.5;
  13.     uv.x+=panx;
  14.  
  15.  
  16.     vec2 z = vec2(0.0, 0.0);
  17.     vec3 c = vec3(0.0, 0.0, 0.0);
  18.     float v;
  19.  
  20.     int depth = 170 + int(zoom);
  21.  
  22.     for(int i=0;i < depth;i++)
  23.     {
  24.  
  25.         if(((z.x*z.x+z.y*z.y) >= 4.0)) break;
  26.         z = vec2(z.x*z.x - z.y*z.y, 2.0*z.y*z.x) + uv;
  27.  
  28.  
  29.         if((z.x*z.x+z.y*z.y) >= 2.0)
  30.         {
  31.             c.b = 1.0;
  32.             c.r=float(i)/20.0;
  33.             c.g=sin((float(i)/5.0));
  34.         } else {
  35.             c.r = 1.0;
  36.             c.g = 1.0;
  37.             c.b = 1.0;
  38.         }
  39.  
  40.     }
  41.  
  42.  
  43.     gl_FragColor = vec4(c,1.0);
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top