Menger's sponge

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
shviller
Posts: 4
Joined: Tue Nov 10, 2009 4:47 pm

Menger's sponge

Post by shviller »

So I made a depth 5 Menger's sponge, and it worked well enough I decided I can throw some ghetto SSAA on top of it (a 3200x2400 RenderTarget for a 800x600 window). Drag LMB to rotate, wheel to zoom.

A friend complained that his laptop can't properly handle a depth 4 sponge in XScreenSaver, and depth 5 is entirely unbearable. I said it shouldn't lag unless it's just straight up made from 3200000 individual cubes (and even that should probably work fine on modern hardware), so I tried to show how it can be made with a lot fewer polygons.

This is how I did it: the M₅ mesh is made from 20 M₄ meshes, and M₄ is 6 (one for each cardinal direction) stacks of 81 textured quads, the quad being an entire cross-section of the sponge, its texture coming from an atlas of 16 81x81 bitmaps. Fewer than 20K polys in total, and one 324x324 texture.

Many thanks to Kjell for answering a lot of dumb questions I threw his way while making this, and for straight up making the camera controls (with all the quat math) for me.

I hope this cheeky thing inspires someone to do something cool. :)
Attachments
menger04.zgeproj
(11.71 KiB) Downloaded 766 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Menger's sponge

Post by VilleK »

Cool! Thanks for sharing. Works fine here.
Post Reply