You are currently browsing the archive for the Code category.

Pixel Bender Differences

I’ve been using Pixel Bender for some projects of mine (SquishFilter, Voxel Renderer). It’s been quite fun to write the pixel bender scripts, but the flash implementation is crippled (no functions, no loop constructs) and behaves diffrent than the gpu and cpu implementations on windows atleast. I’ve found two things:

First: normalize( float2 ) is not giving the same results in flash as gpu/cpu versions. In the flash version I had to replace the function with float2 / length(float2)

I wanted to set the alpha of a pixel4. when the color was pure green (0.,1.,0.) alpha could be set to anything. but when I sat the color to (0.2, 1.0, 0.2) and the alpha to something low as 0.3, the color got gray. What’s up with that?

Also, check this out:
Some Flash Pixel Bender performance tips + benchmarks

Tags: ,

SquishFilter 0.1

This is a demo of the very first version of my SquishFilter for flash.
SquishFilter 0.1

In this demo I’ve animated a wooden box in the timeline. In as3 I added the Pixel Bender filter (that I wrote) in the filters array of the animation. The filter is making the movieclip bulge and pinch when scaleY is more or less than 1.
Read the rest of this entry »

Tags: , ,