Skip to content

Instantly share code, notes, and snippets.

@ssghost
Last active October 1, 2025 08:55
Show Gist options
  • Save ssghost/f4ab679c6768f73e7991b02c113de508 to your computer and use it in GitHub Desktop.
Save ssghost/f4ab679c6768f73e7991b02c113de508 to your computer and use it in GitHub Desktop.
vec3 pallete( float t )
{
vec3 a = vec3(0.500, 0.500, 0.500);
vec3 b = vec3(0.500, 0.500, 0.500);
vec3 c = vec3(1.000, 1.000, 1.000);
vec3 d = vec3(0.000, 0.333, 0.667);
return a + b*cos(6.28318*(c*t+d));
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy * 2.0 - 1.0;
uv.x *= iResolution.x / iResolution.y;
vec2 uv0 = uv;
vec3 fc = vec3(0.0);
float d = length(uv);
for (float i = 0.0; i < 3.0; i++){
uv = fract(uv*2.0) - 0.5;
float d = length(uv)*exp(-length(uv0));
vec3 c = pallete(length(uv0) + i*.4 + iTime*.4);
d = sin(d*8.+ iTime)/8.;
d = abs(d);
d = smoothstep(0.0, 0.1, d);
d = 0.2/d;
fc += c*d;
}
fragColor = vec4(fc, 1.0);
}
void Mandelbrot( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
vec2 c = uv * 4.0 - vec2(2.5, 2.0);
vec2 z = vec2(0.0, 0.0);
float i;
for(i = 0.0; i < 100.0; i++)
{
z = vec2(z.x*z.x - z.y*z.y, 2.0*z.x*z.y) + c;
if(dot(z, z) > 4.0) break;
}
vec3 color = vec3(0.0);
if(i < 100.0)
{
color = 0.5 + 0.5*cos(3.0 + i*0.15 + vec3(0.0, 0.6, 1.0));
}
fragColor = vec4(color, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment