JumpOne
RoundItGoes
click on them to view in full screen.

I’m experimenting what can be done in 2kb with flash. The Scion was also one of those tryouts. I use Pixel Bender here and it seems to be the best tool for low bytes works. Here are couple of things I figured out while playing.

You don’t need to setup the default values. Following works just fine.

parameter float z;

Also the metadata can be written like this:

<languageVersion:1.0;>
kernel a <namespace:"";vendor:"";version:1;description:"";>

The fastes way to calculate distance between two points in PB:

float2 point0 = float2(0.0,0.0);
float2 point1 = float2(1.0,1.0);
float d = length(point0-point1); //not accurate but useful enough

I’m not quite sure about this but it seems to me that it’s much faster to calculate sin(), cos(), atan() values in Flash then in PB. :) So avoid calculating same math for each pixel.

If someone knows more tricks please share.

*** [update 2010-05-14] ***

Here’s how to create a class function (sort of..)

#define calculate_something(pixel,x) pixel.r = 1.0/(x*.01);

void evaluatePixel()
{
float2 p = outCoord();
calculate_something(outpixel,p.x);
}

Here’s the way to do a loop in Pixel Bender

#define loop(res, i) res *= i;

void evaluatePixel()
{
float myColor = 1.0;
loop(myColor, 0.5); //myColor = 0.5
loop(myColor, 0.5); //myColor = 0.25
loop(myColor, 0.5); //myColor = …so on.
loop(myColor, 0.5);
loop(myColor, 0.5);
outpixel = float3(myColor,0.0,0.0);
}