Skip to content

Instantly share code, notes, and snippets.

@bemasher
Created January 27, 2015 04:57
Show Gist options
  • Save bemasher/aa9237a6f6b274e0e11e to your computer and use it in GitHub Desktop.
Save bemasher/aa9237a6f6b274e0e11e to your computer and use it in GitHub Desktop.
uniform int iterations;
uniform vec2 scale, seed;
#define PI 3.14159265358979323846
void main(void) {
vec2 z =(gl_TexCoord[0].xy - 0.5) * scale;
int i = 1;
for(; dot(z, z) <= 4.0 && i < iterations; i++) {
z = vec2(z.x * z.x - z.y * z.y, (z.x + z.x) * z.y) + seed;
}
float gray = i > iterations ? 0.0 : abs(atan(z.x, z.y) / PI);
gl_FragColor = vec4(gray, gray, gray, 0.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment