Content, images, & animation copyright © 1997-2010 Peter C. Miller.
My work on Menger Sponges Optimized for 3d
Simple gif Animation of Menger Sponge levels 1-5
"Miller's Menger Sponge": a 14 minute animation of a Menger Sponge multiplying from level 0 to level 9
"Planet Menger": a 1.5 minute animation of a Menger Sponge to level 6
Optimized Menger Sponge generation for 3d graphics:
While testing 3d software and supporting
hardware, I needed a basic polygonal model set which could
easily grow in graphic content data density. The Menger
Sponge fit the specification perfectly since each
iteration allows for an arbitrarily defined level of
complexity. I wrote several mel and Python scripts, each using
different approaches to create Menger Sponges of different
depths. Some are subtractive Boolean in their approach, some
are simply additive, some use basic replacement.
For those readers familiar with 3d technology, obviously the efficient way to go about rendering a Menger Sponge is via a custom shader, not with actual polygonal geometry. So to those interested in pure rendering fps rates and practical optimizations, the geometric approach described below may seem quite unnecessary or even counter productive. So I clarify here that my target realm is not efficiency, but testing and verifying the power of workstations, and in particular the capabilities of graphics cards. If "stressing the system to find the practical limits" is the goal, then this linearly-driven, geometry-based approach is (and has been) quite effective.
That said, I did not want inefficiency for inefficiencies sake. One problem I specifically wanted to address was that a casually formed Menger Sponge can commonly have unnecessary internal surfaces defined, which can seriously over-tax the target rendering engine, be that a graphics card or a software renderer. I also wanted to avoid duplicated polygonal vertices, which happily most 3d applications have efficient tools for removing.
The snapshots below describe this problem.
You can see the removal of unnecessary surfaces can add up. And this is only level 2; for a level 3 there are 18,048 faces if it is built clean, while a 'lazy' level 3 Menger Sponge will have 48,000 faces. My scripts can build clean or lazy to any arbitrary level, with a maximum ceiling being of the amount of memory Maya consumes for the geometry data. Clearly this maximum level is higher if the scripts are run with the more recent 64 bit versions of Maya. Obviously as well building clean takes a bit more processing time.
Another point of clarification - these "clean" Menger Sponges are "pure" in the sense that no surfaces exist that are hidden, and every surface that exists is necessary and could be viewed from "outside" the sponge if a camera could be placed appropriately within the sponge. In other words, these clean/pure Menger Sponges could be filled with water from the inside, they would not leak.
So these Menger Sponges have neither unnecessary internal
surfaces or duplicated vertices. So far I've used these
scripts to make clean Menger Sponges level 1-6 in Maya. Keep
in mind a level 6+ Menger Sponge really needs 64 bit memory
space in Maya. (Memory consumption is ~200-250 bytes per
Anyway, here's a simple animation of Menger Sponges (Menger Cubes) level 0-5:
This is an old concept rough animation of mine which depicts a series of Menger Sponges multiplying into each iteration of Menger Sponge depth rather than subdividing. To see the animation, click here or on the image above.
In the animation we watch, from the point of view of a person standing, a Menger Sponge growing from a 1 inch cube at level 0 to a 1,640 foot tall Menger Sponge at level 9.
This was achieved in a 32 bit memory space by simulating levels above level 4 with procedural texturing. This animation was inspired partially from the old "power of 10" movies. I plan to have a second version of this animation with object scale references (basketballs, chairs, cars, boats, 747's etc.) added to aid a sense of scale. This animation was made with Maya and several mel scripts driving the animation procedurally.
Here is a 1 minute 35 second sequence of