precision mediump float; uniform float time; uniform vec2 resolution; const float pi = 3.1415; mat2 rot(float a){return mat2(cos(a),-sin(a),sin(a),cos(a));} float cube(vec3 p,vec3 s) {return length(max(vec3(0.0), abs(p)-s));} float rand(vec2 p) {return fract( sin(dot(p,vec2(12.9898,78.233)))*43758.5453123 );} float map(vec3 pos) { float d0=1000.0,d1=1000.0,k=7.5,sp=0.5,ftf=pow(fract(time*sp),-0.25),ft=floor(time*sp)+ftf; pos.z -= time * 5.0; pos = mod(pos,k)-k*.5; pos.xy*=rot(pi/4.0 * step(0.5,fract(time * 0.5))); pos.yz*=rot(pi/4.0 * step(fract(time * 0.5),0.5)); { vec3 p = pos; p = abs(p) - 0.1; if(p.x1000.0){l=i; break;} t+=max(0.0001,d*0.75); acc+=exp(-3.0*d); } col = dColor(ro, rd, l, t, d,acc); gl_FragColor = vec4(col,1.0); }