Welcome to a page of Menger Sponges

Content, images, & animation copyright 1997-2010 Peter C. Miller.

Page Index:

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.

Here's a picture of a Menger Sponge level 1: Here's the same Menger Sponge in X-ray display:
Same sponge, with unneeded internal surfaces displayed in orange: And a clean Menger Sponge, with no unneeded surfaces. In the example below, only 24 surfaces were removed, not much improvement... but that doesn't last long:


Same again - only this time a level 2 with unnecessary duped surfaces, with 2,400 faces total: And a "clean" Menger Sponge of level 2 as well, consisting of a more tidy 1,056 faces:

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 vertex)

Anyway, here's a simple animation of Menger Sponges (Menger Cubes) level 0-5: 

Content, images, & animation copyright 1997-2006 Peter C. Miller.

Some Hi Res OGL Renderings of Level 5:



#1: "Miller's Menger Sponge"

Content, images, & animation copyright 1997-2006 Peter C. Miller.

Select the value this animation was for you:

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.

#2: Planet Menger

Here is a 1 minute 35 second sequence of levels 0-6:

Select the value this animation was for you: