With Flash on the Beach behind us and having had time to process everything, I can safely say it may have been the best edition yet. A great way to get inspired and meet old as well as new friends, and every year it becomes harder to leave. So thanks John for organizing yet another kick-ass festival (yeah it’s really more like a festival than a conference
).
One of the things I swear by every year, is that you haven’t experienced Flash on the Beach if you didn’t catch Joa Ebert‘s session, especially since he started to work on his Apparat suite. Needless to say, I was very honoured when he asked me to contribute some Pixel Bender shaders to show his new JITB player running on the GPU. For those not aware of JITB, it’s essentially a lean & mean Java-based Flash player, with all the niceties the Java runtime provides. Read more about it here.
Results
I ended up writing two ray tracers (or rather, ray marchers).
Yeah, yet another quaternion Julia set. I mentioned last time that they look much better raytraced, and I hope you’ll agree. The sound synching is as interesting as I could get it with only left/rightPeak being supported and a limited amount of time ![]()
Based on the paper “Ray Tracing Deterministic 3-D Fractals” by John C. Hart et al.
Music: Aphex Twin – Xtal
It’s a bit hard to tell, but the terrain marching also has dynamic lighting and shadow casting. The frame rate in the video is actually quite bad, due to the screen capture.
Based on Inigo Quilez’ Terrain Raymarching article
Source
In the spirit of sharing, happy bunnies and double rainbows OMG, I provided the source to these projects, so you can run it yourself.
Of course, you’ll need to run it using JITB. Check Joa’s post on how to get things running.
Also, the download is a bit heavy due to big-ass terrain images (just because, y’know, now I can
)
DISCLAIMER: run it at your own risk. If your machine/GPU is known to overheat easily, it’s best not to try it at all (Case in point – sorry dude
).
Keep in mind, it’s still Pixel Bender compiled for the Flash Player, so all the limitations in that field remain. That of course means no loops. As a result, the Pixel Bender shaders themselves are near-comical (there’s an huge unrolled double loop in the case of the Julia set, for example). I wasn’t aiming for the most optimized code either, but rather show how much difference JITB can make. So please, do take it with a grain of salt
Noteworthy, JITB actually recognizes “copy/paste unrolledness” and recompiles it to loops: very cool!
Finally
It’s been great fun to work on it, and getting to annoy Joa with feature requests
Seeing how these shaders run in real time is still very thrilling to me, when you consider the normal Flash Player takes up to 2 minutes per frame! It’s not fair to compare CPU to GPU, but still…
In closing, many thanks and humble bows to Joa for inviting me and making my attempts a part of his session, as well as his hard work on Apparat! I encourage anyone to check out his work and contribute!
Leave a comment (5 comments)










Since I started playing around with Pixel Bender in Flash, I’ve been trying out some different approaches here and there and learned a thing or two on performance optimizations (and quirks). As many people use PB specifically for its performance, and not much has been written on the subject, I thought I’d share my experiences and back them up with some benchmarks. Some of the things here are pretty obvious, yet others can be surprising and even frustrating.


