Created
January 27, 2015 04:57
-
-
Save bemasher/aa9237a6f6b274e0e11e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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