Der Schmale – David Lenaerts’s blog

Flash Platform Experiments

Render Bender v0.1: optimizing my Flash+Pixel Bender workflow

Tags: , , , , ,

renderbenderOften, when I’m writing Pixel Bender content targeted for Flash Player, the original toolkit leaves something to be desired. Luckily, Joa Ebert created his PBDT plugin for Eclipse which was already a great step to streamline my workflow. Still, the lack of previewing would require switching back to the PB toolkit. And more often than not, that preview didn’t tell me much, as many of my PB projects consist of multiple filters that are dependent on eachother’s output.

Render Bender

So yesterday, I created Render Bender v0.1 (yes, that is some juvenile wordplay) strictly to suit my own needs, but it might just be useful for people out there with the same problem. It is designed to tackle the following issues:

  • Eliminate the need of writing much AS3 code for PB code that might not even work. Instead generating an easy “proof of concept” method.
  • Real Flash-based rendering (instead of simulated rendering of the toolkit, which does not expose runtime bugs)
  • Running a sequence of consecutive Shaders, which may be dependent of a previous Shader or a previous run of an iterative sequence
  • Easy integration with Eclipse and PBDT, without the need of switching applications.
  • Have an easy way of demoing pixel bender effects in development

Essentially, it’s just a Flex App/Component that you need to add to a project, which contains nothing else except for perhaps some interactivity handling necessary for your effect. This way, you can then add your kernels to this project and have them compiled with PBDT. All you need to do is to set up an xml file (once) defining the assets and the kernel sequence. After that, it’s simply a matter of running the project after editing a kernel.

The documentation is a bit sparse at this point, but along with the Demo.mxml source file, it should be pretty clear.

Get it!

In closing…

It’s in early stages, but it works for me :)  I’ll be glad to hear questions, suggestions or bugs. I’m not sure how much time I can invest at this point, but I do have some ideas for future development. At this point, it uses the default Flex skin (3 or 4, depends on your sdk) to minimize compile time. If someone wants to create a minimal fast skin, feel free! :)

Leave a comment (5 comments)

Stubborn and unexpected embedded font weight behaviour

Tags: , , , ,

fontweights

Potentially confusing post warning!

At my job, I often have to work with font embedding. Often, that just happens in Flash IDE as part of assets exported to a swc. Not only because it’s convenient sometimes, but also because I’ve found embedding through Actionscript behaves… well… strange occasionally, especially when using thin or extra light fonts. Just now in fact, I encountered an interesting situation in which this was definitely the case. The font in question is an extra light OpenType font.

I created a static class FontManager, that embeds all the necessary fonts for the project, and also provides a shortcut function to assign the fonts to a TextField. So the setup (let’s call it Setup A) was as follows:

  • ViewClass – _textField: TextField
  • FontManager [static] – Embedded fonts + setFontFormat(textField : TextField, fontFamily : String);

The embedding happened in the usual way. Straight away, the first problem was that the text was rendered too bold. Messing around with anti-aliasing didn’t help one but, until – randomly – it rendered correctly. Afterwards, I changed the GridFitType: back to bold! Oddly enough, reverting to the old “correct” version didn’t fix anything.

After some messing about, I decided to embed the font in the same class as the TextField (still using the shortcut function in the separate class). The new setup B:

  • ViewClass – _textField: TextField + Embedded font
  • FontManager [static] – setFontFormat(textField : TextField, fontFamily : String);

Now it was thinner than it had ever been! Actually, it was exactly how the font should be ;) When reverting back to Setup A to find out what happened, the text wasn’t rendered as bold anymore. A bit thicker, yes, but not nearly as much. See the inset image for a better comparison.

Funnily, I can’t actually reproduce the original bold version anymore! Some behaviours seem completely random, and some perhaps seem to be related to namespace issues (??).

I’m really confused about what’s going on; this way, it’s really hard to create some centralised form of font management in a font-heavy project. I’d be happy if anyone could shed some light on this issue (or non-issue after all?) :)

Leave a comment (8 comments)

MultiMania 2008

Tags: , ,

Belgium’s biggest web-development event (or how should I call it ;) ) is over again, and the countdown to next year’s edition has begun! And yes, that is just a screenshot from their site…

They had some big names this year, and some very good presentations. Starting out with Aral Balkan, who had lots of valid points and touched some interesting topics (such as the Google Apps engine). He also criticised the direction AS3 has taken – a Java wannabe – which is definately not something to be criticised in my eyes. Coming from a C/C++ background (granted, still in DOS-times), I always got annoyed with AS1 and 2 (I could give you plenty of reasons why) and when AS3 came out, I was finally relieved to have a real and logical OO-compliant language to work with. He also criticised frameworks such as PureMVC (actually, he reduced the whole concept of MVC to a buzzword), and showed us that you can seperate model, view and controller while still keeping a very clean and maintainable structure by just separating them in one source file and using comments… Of course, it was a single page example; I’d like to see a full-fledged application made in such a fashion, on which both several developers and designers are working… I’ve seen plenty of projects turned to rubble because of it. Nonetheless, it is true that the Flash platform has become less of a playground, and I’m hearing the complaint a lot from non-developers. In my eyes, it’s a sacrifice that needed to be made sooner or later. A programming language that invites crappy coding rather than discourages it (I’m sorry, but that’s how I feel about AS1+2), will eventually be less performant and buggy. Besides, a lot of the performance boost that AS3 got, is because of the change in language design (one of the most blatant examples: truly typed variables or classes are faster than generic objects). Then again, I guess the views on that evolution depend on who you are and what you want to do with a platform.
Anyway, enough of that rambling, back to MultiMania!

Wim Vanhenden, despite some technical difficulties, had a rather fun presentation, showing how Air can be used in combination with Flash rather than Flex, and how the Flash platform can be extended to do more interesting things. For example: communicating with Java-apps or DLL’s using socket connections, enabling us to do text-to-speech, use the Mac motion-sensor, and so on…

Stealing the show was Ralph Hauwert, who doesn’t seem to know the meaning of “impossible” ;) Pushing Flash to the limits, and then beyond with seemingly relative ease. His flying teapot was unbelievable! I could explain how it looked, but you’ll just have to see it; I hope he’ll have it on his blog sooner or later. Furthermore, he introduced his latest project called rePhlex. It looks like something to look forward to! In general, it was quite inspirational. The main lesson I got from it, was that there’s always a way and that limitations are just a challenge ;)

Last up was Mario Klingemann who needs no introduction. I’d already seen half of his presentation on Flash on the Beach ’07, but the second half was all new to me. It’s always a joy to see him solving mathematical issues in an untraditional way; using *gasp* BitmapData! How he comes up with it, who knows, but it works ;) Finally, he demoed his modular image processing tool “Peacock” for Aviary, and tho it looked a bit confusing at times, it could produce some very cool results, that would take quite a bit of time to make in Photoshop:)

All in all, a good day! Hats off to Koen de Weggheleire! :D

Leave a comment (1 comment)

© 2009 Der Schmale – David Lenaerts’s blog. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.