Category / Alchemy

TubePilot. December 3, 2010 at 1:18 pm

Procedurally generated tubes and tunnels are one of the classic effects known from the Demoscene. It´s like every brilliant demo simply deserves a cam-flight through an infinite tunnel or the like. For example, ‘You should‘ from Haujobb (a demo group) uses a very elegant flight through a tunnel composed of cubes, or better still, ‘Sult‘ by Loonies (guess what…also a demo group) , which puts forward some very stunning tunnel creations!

So even when it comes to Flash10 and its actual non-hardware accelerated status there are tons of techniques to begin the tunneling. But lets start a bit more basic and use an oldschool technique to build a very retro styled tunnel. The trick in the example up next is to precalculate all distances and angles that we need and store that informations in 2 Lookup tables first, so that we get rid of expensive function calls like ‘Math.sqrt’ or ‘Math.sin’ which are quite expensive when it comes to performance. If we follow that simple rule we easily can setup and handle a very large (800×600) oldschool tunnel:

oldschool tunnel
Launch

All right. Perhaps I shouldn´t leave it like that because this approach is way too ancient for sure! And inspired by all those great demos I got an idea for a little 3D camflight too - working title: ‘Tube Pilot’. The underlying idea was to dive into the inside of an 3D cylinder which is textured with a highly glossy/metallic surface. Well, creating texture-materials and behaviours that imitate specular surface conditions like reflections, glossiness, vignettes and light falloffs isn´t that easy to manage with Flash only because you need to calculate lots of pixels at the same time. So I decided to write some Pixel Bender based shaders which are able to process those necessary pixel manipulations a lot more faster compared to a pure Actionscript solution. Took me longer as I expected to write all those little filters, but by now I feel quite comfortable with the results (you can launch the specular texture creation as extract if you feel like).

Finally the fun part: Finding some interesting settings to rotate, zoom and move the camera on its way through the tube. And hell yeah… the actual state of affairs looks like this:

TubePilot
Launch

p.s.: The last six month I spend lots of my time digging deep into some Molehills to prepare demos and stuff for my new upcoming talk called ‘Realtime (hard)‘ - which I´m gonna give for the first time at upcoming FITC Amsterdam next year. For that reason I´d like to invite you all to come and visit upcoming Flash Platform Come Together in Cologne (11.12.2010, SAE Institute). It´s a COSTLESS meeting! There I´ll do my actual talk ‘Triangle Affairs’ for the last time and, for good measure, show a little sneak preview (a.k.a a demo) of what my latest Molehill generated stuff looks like and what you probably can expect from me next year…

Oops, did I mention that the all smart David Lenaerts (derschmale.com) will give a talk there too?

Better be there!

Ray tracing a Menger sponge. July 19, 2010 at 11:38 am

Menger sponge, wtf? - you might say, so let us primary and short clarify what is meant here. In mathematics, a Menger sponge is a fractal curve and it was first described by Karl Menger while exploring the concept of topological dimension. It is a universal curve, in that it has topological dimension one,  and in any other compact metric space of topological dimension 1 is homeomorphic to some subset of it (Reference: Wikipedia).

Hmmm… fine, and where do we go from here? There are tons of code conversions out there showing Menger sponge´s in all kind of variations, but one of my favourite realizations called ‘Spongy‘ from TBC (a demo group) was released in 2009 during ‘Function 2009‘. What´s done here is  that they are ray tracing a Menger sponge from the inside.

‘WOOOT’ - didn´t I just wrote about ‘Raytracer‘ and ray tracing lastly? ;) Btw., never seen demos done by TBC? You really should take a look at TBC demos like ‘untraceable’ or ‘tracie‘ for your inspiration.

Actually, having no hardware acceleration in Flash ray tracing IFS Fractals isn´t a good idea at all. But after I came across this little snippet called ‘JSpongy‘ (by p01) which is an HTML5 adaption of TBC´s Spongy my interest awoke. The task: Let´s bring it to Alchemy and this is where I came up with at the end of the day: And - how shall I put it? Ray tracing a Menger sponge (scaled by factor 2) ~21fps isn´t such a bad thing, right? (thanks to Alchemy)

Ray tracing a Menger sponge
Launch

And referring to all those great ideas from the Demoscene it´s only fair to maintain their course - in other words, if they wouldn´t release the resources of all their great coding tricks and hacks we would not be where we are today! So feel free to catch the sources and make the best of it.

Additionally three more brilliant articles about ray tracing I forgot to mention last time:

Your turn!