Open makc opened 8 years ago
Still happens in 2020, of course
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#define TAU 6.28318530718
#define MAX_ITER 5
void main( void ) {
float t = time * .5+23.0;
// uv should be the 0-1 uv of texture...
vec2 xy = gl_FragCoord.xy / resolution.yy -vec2(0.5);
vec2 uv = vec2(
atan(xy.y, xy.x) * 7.0 / TAU,
log(length(xy)) * 0.8
);
vec2 p = mod(uv*TAU, TAU)-250.0;
vec2 i = vec2(p);
float c = 0.8;
float inten = .005;
for (int n = 0; n < MAX_ITER; n++)
{
float t = t * (1.0 - (3.5 / float(n+1)));
i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));
c += 1.0/length(vec2(p.x / (sin(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));
}
c /= float(MAX_ITER);
c = 1.17-pow(c, 1.4);
vec3 colour = vec3(pow(abs(c), 8.0));
colour = clamp(colour + vec3(
0.20 + 0.40 * (1.0 + cos(time * 2.0 + length(uv.y) * 3.0)),
0.10 + 0.15 * (1.0 + sin(time * 3.0 + length(uv.y) * 7.0)),
0.05 + 0.05 * (1.0 + cos(time * 5.0 + length(uv.y) * 9.0))
), 0.0, 1.0);
gl_FragColor = vec4(colour, 1.0);
}
the original code from https://github.com/mrdoob/glsl-sandbox/issues/42#issue-154226898 can be saved now, but not the code from https://github.com/mrdoob/glsl-sandbox/issues/42#issuecomment-756116512
it was saving ok until I changed sin to cos in gl_FragColor = ... line.
won't accept it as new code either.