[mod] Fractal World Generation [fractal_worlds]

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

[mod] Fractal World Generation [fractal_worlds]

by Mator » Post

Image
imgur album - WIP GitHub repository

Introduction
Several years ago, I watched a music video on YouTube of a flight through a mandelbox. The architectural features of the mandelbox inspired me to want to generate fractals in Minecraft. I achieved that goal through a WorldEdit script, though what I truly wanted were massive, world-size fractal objects to explore. Minecraft's 256-height limit and obtuse modding API was a major turnoff to this, so I made my own Voxel Engine in Java. Making this engine taught me a lot. I later made a much faster and cleaner engine in C++ using SDL. I've generated some awesome fractal images with this engine. (1, 2, 3)

However, part of what I wanted was to be able to interact with a fractal world. I recently found out about Minetest, which has brought me full circle back to my original idea - generating fractal worlds to mine, explore, and build in.

The Project
The project will come in two stages. The first stage is using the Lua modding API to make world generation code as a proof of concept. The second stage is native integration into the base game as new world generation modes, including biome and seed support.

Progress

Stage 1 (in progress)
Stage 2
  • Mandelbox: Generates a Mandelbox the size of the entire world.
  • Mandelbulb: Generates a Mandelbulb the size of the entire world.
  • Fractal biomes: Create fractal biome palettes and support multiple fractal "biomes".
  • Parameter seeds: Map seed values to fractal parameters. o
  • Fractal garden: Generates a variety of fractals at various sizes throughout the world.

Any help is appreciated!
- Mator
Last edited by Mator on Sat Feb 17, 2018 08:31, edited 25 times in total.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [mod] Fractal World Generation [fractal_worlds]

by paramat » Post

Good to have you active in Minetest and i'm happy to help.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod] Fractal World Generation [fractal_worlds]

by azekill_DIABLO » Post

awesome! purely awesome! are the colors random or they represent some kind of patern?
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

paramat wrote:Good to have you active in Minetest and i'm happy to help.
Thank you paramat! :)
azekill_DIABLO wrote:awesome! purely awesome! are the colors random or they represent some kind of patern?
The colors are mapped from the iteration that the point exceeded the fallout. When generating fractals such as Mandelboxes and Mandelbulbs you have an algorithm which applies a formula to the point you are testing repeatedly until its magnitude exceeds a certain value, at which point you consider it to be headed to infinity and part of the set. The iteration at which this occurs is mapped to a block in a palette.
Spoiler
E.g. When generating a power 8 mandelbulb I usually use the parameters:

Power: 8
Fallout: 1024
Base iteration: 4
Max Iteration: 16
Palette: [Stone, White Wool, Light Gray Wool, Gray Wool, Black Wool, Red Wool, Orange Wool, Yellow Wool, Green Wool, Dark Green Wool, Blue Wool, Cyan Wool]

For a given point in the mandelbulb, we create a vector with components mapped to the region (1,1,1) to (-1,-1,-1), then apply the mandelbulb formula to it. The first time we apply it is "iteration 0". If the magnitude of the vector exceeds 1024, we stop and would place a block, except our base iteration is 4, so we place nothing. We continue this until we reach iteration 4. If a point exceeds the fallout value at iteration 4 we would place the first block in our "palette", which in this case is Stone. If a point exceeds the fallout value at iteration 5 we would place the second block in our palette, which in this case is White Wool. This continues until we reach the maximum iteration. Anything which doesn't exceed the fallout value by the max iteration is considered not a part of the set.
Last edited by Mator on Mon Apr 03, 2017 17:11, edited 1 time in total.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod] Fractal World Generation [fractal_worlds]

by azekill_DIABLO » Post

ok thanks!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Andrey01
Member
Posts: 2577
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [mod] Fractal World Generation [fractal_worlds]

by Andrey01 » Post

Interestingly... This is second CaveRealms mod in a screenshot

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

Andrey01 wrote:Interestingly... This is second CaveRealms mod in a screenshot
What do you mean, and which screenshot?

u19503

Re: [mod] Fractal World Generation [fractal_worlds]

by u19503 » Post

That looks like chaos but in the good way I like it :)

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [mod] Fractal World Generation [fractal_worlds]

by Desour » Post

toby109tt wrote:That looks like chaos but in the good way I like it :)
I don't think, that it looks like chaos. It's totally structured. Chaos would be like dust.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

Octahedron Fractal generation working. Added images to the imgur album in the OP. Here's a few good ones:

Image

Image

Image

Image

Image

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod] Fractal World Generation [fractal_worlds]

by azekill_DIABLO » Post

magnificient.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

I have three new fractals today.

Fractal Pyramid:

Image

Image

Quadratic Koch Surface:

Image

Image

Greek Cross Fractal:

Image

Image


Additional images have been added to the imgur album linked in the OP as well.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod] Fractal World Generation [fractal_worlds]

by azekill_DIABLO » Post

it's just amazing!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [mod] Fractal World Generation [fractal_worlds]

by Krock » Post

These are impressive! It would be lovely if these fractals could be adjusted in a way to use them as a map. Directly thinking of the mandelbrot set.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

azekill_DIABLO wrote:it's just amazing!
Thanks man. Fractals are fun. :)
Krock wrote:These are impressive! It would be lovely if these fractals could be adjusted in a way to use them as a map. Directly thinking of the mandelbrot set.
That's stage 2. I don't have mandelbrot set planned, however, because it's a 2d fractal. I don't really see the point of 2d fractals in a 3d graphics engine. The mandelbulb, however, is similar to the mandelbrot set. It's not a canonical 3d representation of the mandelbrot set, but it has some mathematical similarities.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [mod] Fractal World Generation [fractal_worlds]

by paramat » Post

We already have 3D/4D mandelbrots used as maps in mgfractal.

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

paramat wrote:We already have 3D/4D mandelbrots used as maps in mgfractal.
That's actually a 2d mandelbrot set with height projected based on iteration instead of using iteration to determine color (I think). It is cool though. :)

EDIT: Actually no, I have no idea what that is. o_o

EDIT 2: I think it's some form of Julia Set maybe? Not sure.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [mod] Fractal World Generation [fractal_worlds]

by paramat » Post

2D with height as iteration is too boring for me.
Some are 3D slices of 4D hypercomplex mandelbrot sets, some are 3D hypercomplex mandelbrot sets, each has the corresponding julia option.
All are from http://www.bugman123.com/Hypercomplex/index.html

All parameters are here https://github.com/minetest/minetest/bl ... mple#L1523

Code: Select all

#    Choice of 18 fractals from 9 formulas.
#    1 = 4D "Roundy" mandelbrot set.
#    2 = 4D "Roundy" julia set.
#    3 = 4D "Squarry" mandelbrot set.
#    4 = 4D "Squarry" julia set.
#    5 = 4D "Mandy Cousin" mandelbrot set.
#    6 = 4D "Mandy Cousin" julia set.
#    7 = 4D "Variation" mandelbrot set.
#    8 = 4D "Variation" julia set.
#    9 = 3D "Mandelbrot/Mandelbar" mandelbrot set.
#    10 = 3D "Mandelbrot/Mandelbar" julia set.
#    11 = 3D "Christmas Tree" mandelbrot set.
#    12 = 3D "Christmas Tree" julia set.
#    13 = 3D "Mandelbulb" mandelbrot set.
#    14 = 3D "Mandelbulb" julia set.
#    15 = 3D "Cosine Mandelbulb" mandelbrot set.
#    16 = 3D "Cosine Mandelbulb" julia set.
#    17 = 4D "Mandelbulb" mandelbrot set.
#    18 = 4D "Mandelbulb" julia set.
#    type: int min: 1 max: 18
# mgfractal_fractal = 1

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

Got four new fractals today, all fractals I hadn't known about before now. Generation algorithms for these fractals are all very similar to the Menger Sponge.

Snowflake Cube

Image

Image

Penta Sponge

Image

Image

H Sponge

Image

Image

Koch Cube

Image

Image

User avatar
the_raven_262
Member
Posts: 343
Joined: Mon Sep 22, 2014 09:30
GitHub: theraven262
IRC: [Discord unfortunately] corvus262

Re: [mod] Fractal World Generation [fractal_worlds]

by the_raven_262 » Post

I see you are doing an awesome job here :)
I thought to ask if fractals like the ones here (3d ones) could be made as minetest maps: http://hirnsohle.de/test/fractalLab/(The fractal library section)

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

the_raven_262 wrote:I see you are doing an awesome job here :)
I thought to ask if fractals like the ones here (3d ones) could be made as minetest maps: http://hirnsohle.de/test/fractalLab/(The fractal library section)
Hi the_raven,

The only fractal there which I don't already have here is the SphereSponge. I don't know how good it will look volumetrically, but if I can find a description of the algorithm I'll give it a go.

The main thing that site has differently is a bunch of transforms. Some of these are entirely new to me. The biggest difficulty is in figuring out the transform's implementation.

- Mator


EDIT: Found the original posting about the SphereSponge fractal. Will see if I can implement the pseudocode provided there.

User avatar
the_raven_262
Member
Posts: 343
Joined: Mon Sep 22, 2014 09:30
GitHub: theraven262
IRC: [Discord unfortunately] corvus262

Re: [mod] Fractal World Generation [fractal_worlds]

by the_raven_262 » Post

Thanks for the answer, I don't know about making a spherical fractal in a cubic world, might seem odd, a lot.
Do you plan on using minetest's ore generation or are you going to use the fractal for it?
Also, I have no idea how does that site add colour to the fractals, but as it colours certain sections of the fractal I can guess colouring has something to do with the fractal itself, would be nice to implement biomes this way.

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

the_raven_262 wrote:Thanks for the answer, I don't know about making a spherical fractal in a cubic world, might seem odd, a lot.
Do you plan on using minetest's ore generation or are you going to use the fractal for it?
Also, I have no idea how does that site add colour to the fractals, but as it colours certain sections of the fractal I can guess colouring has something to do with the fractal itself, would be nice to implement biomes this way.
I think the SphereSponge can work in a cubic world so long as I set the minimum sphere radius sufficiently high.

I'm planning on taking both a "natural" approach to biome/ore generation (via MineTest algorithms or similar) and potentially a fractal approach as well. We'll see how it goes once I get there. :)

User avatar
Mator
Member
Posts: 18
Joined: Sun Apr 02, 2017 17:41
GitHub: matortheeternal
In-game: Mator

Re: [mod] Fractal World Generation [fractal_worlds]

by Mator » Post

Added cube tree fractal after taking a bit of a break.

Image

Image

Image

User avatar
the_raven_262
Member
Posts: 343
Joined: Mon Sep 22, 2014 09:30
GitHub: theraven262
IRC: [Discord unfortunately] corvus262

Re: [mod] Fractal World Generation [fractal_worlds]

by the_raven_262 » Post

Awesome! I really hoped you didn't abandon this project :)

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests