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: , , , , , , , , , ,

3 Responses to “PIXEL BENDER #1 color tweaking”


  1. John Lindquist
    on Jul 5th, 2009
    @ 11:46 pm

    Thanks for sharing your source.


  2. Nick Polet
    on Sep 6th, 2009
    @ 12:53 pm

    nice article here, and some useful filters. I am trying to get a ‘replace colour’ filter, where I can select a colour, pass it to a pixel bender filter which then replaces the colour I selected with a new colour. Quite similar to ‘replace colour’ in photoshop.

    Do you have any tips or any links to articles which could help me learn more to create this effect?


  3. Klas Lundberg
    on Apr 2nd, 2010
    @ 4:44 pm

    Nice filters, good work! I have made a pixel bender filter that changes the individual RGB color channels to any given color. This way you can set a picture to match a given set of colors. You can try it out and download it at http://last.instinct.se/graphics-and-effects/channel-colorizer-demo-application/554

    Keep up the good work!

    /Klas

Leave a Reply

© 2009 HIDIHO!. All Rights Reserved.

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