Last active
December 28, 2018 12:23
-
-
Save JPBotelho/0257946c715b0bc0ba19089be71e9ce4 to your computer and use it in GitHub Desktop.
Celtic Mandelbar
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
//Based on explanation http://www.hiddendimension.com/fractalmath/Divergent_Fractals_Main.html | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 c = fragCoord.xy / iResolution.xy; | |
//scaling real axis to [-2.5, 1.5] and imaginary axis to [-1.5, 1.5] | |
c = c * vec2(4,3) - vec2(2.5, 1.5); | |
vec2 z = vec2(0); | |
fragColor = vec4(0); | |
for (int i=0;i<100;i++) | |
{ | |
if (z.x * z.x + z.y * z.y >= 4.) | |
{ | |
fragColor = vec4(1); | |
break; | |
} | |
z = vec2(z.x*z.x - z.y*z.y, 2.*z.x*z.y); | |
z = z - vec2(z.x + abs(z.x), 0) - c; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment