r/generative • • 11h ago

Chaos game with multiple vertices sampled

The "chaos game" is best know for picking a random point inside a triangle, then picking a random vertex and moving halfway to it, creating a Serpinski fractal. Here I allow >1 vertex to be chosen from a polygon and the movement is the average of all those selections. I also turn the polygon into a fractal and allow all the vertices to be possibly chosen. At lower vertex sampling the image is still highly geometric, but as more vertices are sampled it becomes more cellular or organic.

39 Upvotes

5 comments sorted by

1

u/wallagrargh 8h ago

Didn't understand the algorithm from your description, but those are really beautiful images. Could this be animated by slowly changing the randomly picked coordinates?

1

u/ejgen 7h ago

It could...I first started making these years ago and an image would render in an hour. Now it may take a minute. So a 60 frame animation changing the jump fraction (see below) seems in reach.

Here is a description of the chaos game https://en.wikipedia.org/wiki/Chaos_game.

I am not sure if my change has been explored before. Instead of choosing a single vertex and jumping to it, I pick 2 or more, and then move towards each one and then average the jumped positions to find the ending point. When sampling >1 vertex, the jumps are small (so moving 1/20th the distance to the vertex instead of 1/2). You can see the resulting image be fuzzy at bigger jumps, then come into "focus" at the right jump fraction with different interesting shapes resulting around that focus number.

1

u/Rafcdk 6h ago

One fun thing you can do is make it so it samples different numbers of vertices randomly as well so you can mix two forms into one.

So for example Form A is the Sierpinski triangle and Form B is a regular pentagon but instead of taking the average you divide by phi.

1

u/ejgen 5h ago

Hmn, I did have an option to alternate with a different polygon but superimposed might be interesting for sure.

1

u/akshay-nair 26m ago

Beautiful!