r/fractals • • 4h ago

Moiré Fractal with C, Raylib and GLSL

0 Upvotes

I created a simple moiré fractal using C, raylib and GLSL shaders.

The idea is quite simple: start with two nearby centers and generate concentric circles around each one, gradually increasing their radius.

Then, using the radius as input to a sin function, I generate alternating light and dark values. By applying this to the colors, the two circle patterns interact and produce the characteristic moiré effect.

Complete coding session:

https://youtu.be/7MmUcDiOJDc

Source code:

https://github.com/FractalCodeRicardo/hangover-programming/tree/main/moire-shaders

Shader:

#version 330

out vec4 color;

uniform float time;

void main() {
  vec2 uv = gl_FragCoord.xy / 800;
  uv = uv - 0.5;
  
  float a = 30;

  vec2 center1 = vec2(0.1, 0.0);
  vec2 center2 = vec2(-0.1, 0.0);
  
  float d1 = distance(center1, uv);
  float d2 = distance(center2, uv);

  vec4 color1 = vec4(
      0.0 * sin(a * time*d1),
      0.8 * sin(a * time*d1),
      0.8 * sin(a * time*d1),
      1
  );

  vec4 color2 = vec4(
      1 * sin(a * time*d2),
      0.2 * sin(a * time*d2),
      1 * sin(a * time*d2),
      1
  );
  
  color = mix(color1, color2, 0.5);
}

AI Disclaimer:

I did not use AI to code the fractal.


r/fractals • • 3h ago

Mandelheart: fleshy, interactive mandelbulb

16 Upvotes

r/fractals • • 21h ago

I've been working on adding an animation system along with my Mandelbrot renderer

131 Upvotes

It takes multiple saved renderings and interpolates between them to provide the animation. All done in C with SDL and being actively updated at the moment. If you're interested, the source is at https://github.com/jacobEwing/C-Mandelbrot under a GPL3 license.

No documentation yet though. :)


r/fractals • • 12h ago

Living Fractal Waves

11 Upvotes

r/fractals • • 13h ago

Test Render

Post image
24 Upvotes

Another test flame fractal render. The blue/green colour showcases a different style of colouring with a gradient than Apophysis uses. The position of the point dictates the gradient colour that is blended in.


r/fractals • • 14h ago

Heart-omato

Post image
4 Upvotes

r/fractals • • 8h ago

three Mandelbrot close-ups

Thumbnail
gallery
5 Upvotes

All three are z = z² + c with smooth escape-time colouring, rotated 15°.

Snowflake: -0.10119049 + 0.95628956i, width 0.006, 1200 iterations

Seahorse Valley: -0.74540197 + 0.11270331i, width 0.0065, 900 iterations

Far Out There: -0.76162891 - 0.08475782i, width 0.0035, 1400 iterations

Full guide here: rezonanca.art/guide/mandelbrot-set-explained


r/fractals • • 1h ago

Mandelbrot animation with sin wave orbit trap

Thumbnail
youtube.com
4 Upvotes

I'm working on expanding the coloring options. Here is a preview using trap with sin+harmonics and a cycling phase.

Rendered with Fractadyne (https://fractadyne.org/).

Phase Loop video


r/fractals • • 16m ago

Sierpinski Curve

Post image
2 Upvotes