HIDIHO!

giving something back to the Flash community

PIXEL BENDER #1 color tweaking

Tags: , , , , , , , , , ,


first steps to pixel bender

I first heard of it codenamed hydra.
it was almost 2 years ago… at the time I was starting AS3 and was far from having the skills to understand the basics. needless say that a Kernel sounded more like an viking sea monster than a graphic tool.

last monday, MUKIMUKI sent me a link about MATHMAP saying I would surely be interested. MathMap is a plugin for the gimp where you can input maths formulas to distort images.
so with his help, I ported almost all of them in AS3 using a good old bitmapData.
some of them were ok in terms of speed but the rest would make the CPU sweat hard.
still chatting with MUKIMUKI, we thought it would suit perfectly to Pixel Bender.
And off I went !
alone in the dark…
after a couple of days being absolutely lost (dataformats, fewer instructions, those bloody .0 for the floats) and with the help of some resources and tutorials / experiments, it started working.
so I ported some filters to PB.

You shouldn’t expect anything spectacular here, all of it has already been done differents ways on adobe exchange or by other people. it is more about sharing the basics.
the start/stop filter is heer to prevent CPU overload (the last swf is very expensive) + you can copy the code to clipboard and paste it to the evaluatePixel method in pixel bender.

the simplest color to grayscale image

image to negative

isolate or replace the channels of an image (move mouse when running, the operation is written in the textfield):

multiplying the channels of an image ( if the 3 sliders have the same value > it’s the brightness):

the very same as my reduceColor class just a whole lot faster and 3 lines long:

and finally the zoom blur:

as the kernel does not have loops, we have to ‘unfold’ the loop which gives us a shitload of if(){} instructions. that’s also where PB told me ‘this kernel is too complex to run on your computer’(after 47 if conditions) which I found few pieces of information about.

for now here’s a filter pack of the animations above: pixel bender filters 1
next article: distortions.
howdy!

Tags: , , , , , , , , , ,

© 2009 HIDIHO!. All Rights Reserved.

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