Menger Fractals

The last article I wrote was all about raytracing the Menger Sponge. When I implemented the Menger Sponge algorithm I was careful to keep a certain amount of configurability in the system. The pseudocode I showed in this article uses a fixed algorithm to decide if a cell is solid or not, but in the final production algorithm I used a parameter which allows me to change the fractal pattern.

This leaves me with the ability to try lots of different fractal patterns within the basic 3×3 cube. So first off, here’s the Menger Sponge with the corner taken out of the pattern…

Menger Sponge

Menger Sponge with a corner missing

Next up is a Menger sponge where the entire middle layer has been removed, this gives a fractal of sheets that looks pretty interesting.

cuboid fractal

Planes of planes Fractal

This is a more interesting stalactite type fractal where the bottom layer has the corners taken out along with the normal menger sponge removals.

MengerFun4

Menger Stalactites

It’s interesting to play with these fractals and then stick them against the more regular solid primitives. For this image I used a basic sphere with a sheen specular highlight. I like the effect, and it does help to show a bit more of the scale of detail in the fractal.

It’s quite tricky to really show the full detail visible in the fractal, I’ll put some higher resolution renders in a slideshow gallery when I get a chance.

Menger Stalactites

Menger stalactites and sphere

And finally I came across an interesting fractal that looks something like a spaceship from a film I used to watch occasionally as a child.

Menger Spaceship

Menger Spaceship

I’m sure there’s much more that can be done with this type of fractal, so no doubt I’ll be coming back to this in the near future. :)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Spam Protection *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>