Pixel Bender

Pixel Bender (formerly known by its codename: Hydra) is an image processing algorithm that optimizes image and video processing. In other words, it is a really useful tool to process image and video without killing performance.

I’ve had a chance to sit down and play with the IDE. Pixel Bender’s syntax is based on OpenGL Shading Language (GLSL). It is quite different than working with AS3.

Pixel Bender code example:

kernel NewFilter
< namespace : "Your Namespace";
vendor : "Joshua";
version : 1;
description : "Text Pixel Bender";
>
{
input image4 src;
output pixel4 dst;
parameter float testInputValue<
minValue: float( 1 );
maxValue: float( 100 );
defaultValue: float( 1 );
>;
void evaluatePixel() {
//code goes here
}

Where as AS3 looks like:

package
{
//@author Joshua Ho
public class MyClass {
public function MyClass() {
//code goes here
}
}

Now this is just a semiotic difference. The real importance is how both these two languages can work together and really make some pretty cool projects come to life.
Below is an example :

Get Adobe Flash player

This is a webcam feed that pixelates based off my Pixel Bender file. Now this type of pixelation can be done via actionscript. However the performance using Pixel Bender is not hindered when applying a pixelate filter. Normally with actionscript all of the processing is done by the CPU, the greater the data the more calculations the CPU has to make, thus slowing down the flash application. In an application like this, the flash application would drop framerate (see the top right corner for framerate values). By using Pixel Bender we can have the image and video processing done by the GPU, allowing the CPU to focus on the webcam feed and thus an increase in performance.


Leave a Reply