Game Dev Engine #13. Fractal: Iterated Function System.

Subscribers:
615
Published on ● Video Link: https://www.youtube.com/watch?v=SjL6N586QDY



Game:
Fractal (2010)
Duration: 1:21
383 views
14


2023-11-05. IFS (iterative function system) producing fractals using the chaos game: Order from Chaos.

Inspiration:

My prior video, "order from chaos" produced the Sierpinski Triangle in 2D and 3D. I recalled the IFS (iterative function system) method of producing fractals. Specifically, the Barnsley fern. It is reminiscent of the 1994 graphics demo: Verses by Electromotive Force, showcasing an animation / transition between IFS fractals.

VGA Graphics:

Verses was made using VGA, which had many graphics modes, mostly demonstrated by its 256 color mode (18-bit color palette = 6-bit per RGB = 0..63) -- the standard 320x200 mode 13h (and other Mode-X variants). However, their IFS demo ran in VGA mode 12h: 640x480 x 16-colors.

(I've always wondered what the Sierra line of 3D adventure games would've looked like if the artists deployed their phenomenal use of 16-color dithered graphics in VGA 640x480 vs. the ugly 320x200 digitized versions of painted scenes).

How IFS works:

Versus amazed me with the showcase of the Sierpinski Triangle. How was this done? It's actually quite similar to the chaos game. In fact, it likely makes more sense when you think about it from the IFS perspective. Let's use the Sierpinski Triangle as an example, since it's easy to view as self-similar.

IFS is a collection of transformations of existing points. If you start with the entire Sierpinski Triangle -- how do you make the 3 sections of self-similarity? You transform the triangle to be half the size (in X and Y) and move it towards one of the 3 spots. That's it! Those are the 3 transform functions used in IFS. (The Chaos Game -- in which you move an existing point half-way to one of the triangle vertices -- is actually just doing the same thing!).

Now take the Barnsley fern. It's the same thing except: The entire fern becomes two things: the left leaf, and the right leaf -- which involves a rotation. But it also becomes two more things: it becomes itself pushed "upward" so that both left/right leaves become the next leaf in the row, and a "reset" function: it also becomes its own stem (the starting point). Why is the stem transform required? Because if it just continued to become left/right leaves, and "upward" pushes into the array of such leaves, the points would become "trapped" in that recursion.

That begs the question: Why does the Sierpinski Triangle not require a 4th function that resets the fractal? Why don't the points get trapped in recursion, and never find their way back "out" to become the entire fractal? Because the transforms are only 50% of the size, and if you continue halving, and sum all of these, you get the whole: 50% + 25% + 12.5% + 6.25% + ... = 100%. This is not the case with the fern.

Colors:

There is no standard way to color. I have my own invention: I assign a color to each transformation function. During the chaos game of transforming an X,Y point over and over, it also gets the color of that transformation. Now, if you just immediately used that color, you'd get (in the case of the ferns), the stem being color A, left leaf = color B, right = color C, and the extension (i.e. 95% of the entire fractal) = color D. Ugly. So it only interpolates (LERPs) to the desired color. This is how the stem of the fern stays colored so well.

As for the non-nature fractals... I'm not too pleased with the coloring; both in how the colors "spread" through the fractal, and the "nature" color palettes are just plain bad. In these non-nature cases, it would actually be better (sometimes) if the color changed (was reset) immediately, with no interpolation -- as it would showcase the direct result of each function.

Source:

Fractal data is acquired from the gallery of examples of IFS Construction Kit, made by Larry Riddle.
https://larryriddle.agnesscott.org/ifskit/gallery/gallery.htm

Playlists:
--------------
- Xona System 8: https://youtube.com/watch?v=PqFQv60p-0E&list=PLjnbT4UISq0YwheLThIhm3LDxIkwpmKeb
- Voxel: https://youtube.com/watch?v=uadGU-stF-w&list=PLjnbT4UISq0bQF1g85tE9jTrKfEtdRYlY
- Ray Cast: https://youtube.com/watch?v=SkaPYZOKPQg&list=PLjnbT4UISq0YcFtRFjFQqK0g6ONNCtrvY
- Graph-All: https://youtube.com/watch?v=kLSc7bZW2Bs&list=PLjnbT4UISq0YLgynFSpLzml4BMC6TDZL2
- Scroll Shmup: https://youtube.com/watch?v=l9bIYkZepPo&list=PLjnbT4UISq0Y_7IAN_zUzxgZnfhXxo_0Q
- Road: https://youtube.com/watch?v=rA4g4VX7ys8&list=PLjnbT4UISq0bnfd1RC3M4PgTgkmhlkikV
- Arena Shmup: https://youtube.com/watch?v=VKjiuq437t0&list=PLjnbT4UISq0adw__Y9B2eXA0LL35TyORU
- Wave Function: https://youtube.com/watch?v=ngctVd9VK8I&list=PLjnbT4UISq0Y8vYnrSauHkBKgOBHXFFdf
- 3D Polygon: https://youtube.com/watch?v=0Qq_euAMP48&list=PLjnbT4UISq0YyjqBGG8Q34Kng5gqDmYrT
- GW-BASIC: https://youtube.com/watch?v=QMQJ7o8e-GI&list=PLjnbT4UISq0bMjb81xFBIWOLhBKFCVkuB

Websites:
---------------
- GitHub: https://github.com/JDoucette
- Blog: http://thefirstpixel.com
- Studio: http://xona.com







Tags:
gamedev
monogame
indie
development
graphics
engine
xona
firstpixel
pixel
pixelart
retro
coding
wolf3d
raycast
raycasting
software
custom
shader



Other Statistics

Fractal Statistics For Jason Doucette

At present, Jason Doucette has 827 views spread across 2 videos for Fractal, with his channel publishing less than an hour of Fractal content. This makes up less than 0.08% of the total overall content on Jason Doucette's YouTube channel.