Skip to content

Instantly share code, notes, and snippets.

@xylifyx2
Last active August 29, 2015 14:01
Show Gist options
  • Save xylifyx2/a529187745bee25e4269 to your computer and use it in GitHub Desktop.
Save xylifyx2/a529187745bee25e4269 to your computer and use it in GitHub Desktop.
Juliasm
const int max_iterations = 255;
vec2 complex_square( vec2 v ) {
return vec2(
v.x * v.x - v.y * v.y,
v.x * v.y * 2.0
);
}
void main(void)
{
vec2 uv = gl_FragCoord.xy - iResolution.xy * 0.5;
uv *= 2.5 / min( iResolution.x, iResolution.y );
vec2 c = vec2(0.40,0.36)+0.06*vec2(cos(iGlobalTime)*0.8786534987354,sin(iGlobalTime*1.235254543));//vec2( -(0.37+cos(iGlobalTime*1.23462673423)*0.04), -(sin(iGlobalTime*1.43472384234)*0.10+0.50));
vec2 v = uv;
float scale = 0.01;
float smoothcolor = exp(-length(v));
for ( int i = 0 ; i < max_iterations; i++ ) {
v = c + complex_square( v );
smoothcolor += exp(-length(v));
if ( dot( v, v ) > 4.0 ) {
break;
}
}
/*
gl_FragColor = 0.4*(1.0+
vec4( sin(smoothcolor*0.05+iGlobalTime*0.63),
sin(smoothcolor*0.04+iGlobalTime*0.32),
sin(smoothcolor*0.03+iGlobalTime*0.7),1.0));
*/
float r = 0.6+0.4*(sin(smoothcolor*0.1+iGlobalTime*0.63));
float g = r * r;
float b = r * g;
gl_FragColor = vec4(r,g,b,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment