Last night I was thinking of ways to create “fish eye” effect with flash 3D engines, and decided that Pixel Bender is the way to go. However, two things I’ve found on the internet did not make it look the way I wanted, so I ended up creating my own “spherize” filter:
Of course, it is not limited to 3D – you are free to use it in any other way, too. Here goes the source:
<languageVersion : 1.0;>
kernel NewFilter
< namespace : "experimental";
vendor : "makc";
version : 1;
description : "spherize";
>
{
input image4 src;
output pixel4 dst;
parameter float2 center
<
minValue:float2(0.0, 0.0);
maxValue:float2(1024.0, 1024.0);
defaultValue:float2(232.5, 232.5);
>;
parameter float zoom
<
minValue:float(0.0);
maxValue:float(10.0);
defaultValue:float(2.0);
>;
parameter float radius
<
minValue:float(10.0);
maxValue:float(1000.0);
defaultValue:float(329.0);
>;
void
evaluatePixel()
{
float2 at = outCoord ();
float2 r = (at - center);
float d = sqrt (r.x * r.x + r.y * r.y);
if (d < radius) {
r *= pow ((radius / (d + 0.1)) * asin (d / radius) / 1.57, zoom);
at = center + r;
}
dst = sampleLinear (src, at);
}
}

That’s a pretty cool example! :)
why is there no sound?