Round Pixel Flash Filter (FlashPlayer 10)

// September 19th, 2008 // Pixel Bender, Source code & tutorials

I just created my first Pixel Bender filter. Pixel Bender is a C based Language from Adobe to create filters for After Effects and now also for FlashPlayer 10. It’s no mask effect or some kind of BitmapData stuff, but a real hardware accelerated filter, like a dropshadow or a blur filter.

Move your mouse horizontal and vertical over the image to see the properties change (You need FlashPlayer 10 to see it)

[kml_flashembed movie="http://www.neuroproductions.be/uploads/blog/examples/PixelBender1/PixelBenderTest.swf" FVERSION ="10" BGCOLOR="#000000" useexpressinstall="true" height="430" width="680" /]

The filter has 3 parameters:

  • dist : Distance between the centers of the circles.
  • size : Ratio of the circles.
  • edgeAlpha: Needed to make the edges of the circle smooth. (can be used to create radial alpha edges)

Download the filter

Source:



kernel CirclePixels
<   namespace : "be.neuroproductions";
    vendor : "Neuro Productions";
    version : 1;
    description : "circlePixels";
>
{

    parameter float dist
    <
        minValue: float(1);
        maxValue: float(300);
        defaultValue: float(100);
        description: "distance";
    >;

 parameter float size
    <
        minValue: float(0.0);
        maxValue: float(2.0);
        defaultValue: float(1.0);
        description: "size";
    >;
 parameter float edgeAlpha
    <
        minValue: float(0.0);
        maxValue: float(300.0);
        defaultValue: float(2.0);
        description: "edgeAlpha";
    >;

    input image4 src;
    output pixel4 dst;

    void evaluatePixel()
    {
        float2 inP= outCoord();
        float xPos = (floor((inP.x)/dist)*dist);
        float yPos = (floor((inP.y)/dist)*dist);

        float difX = inP.x -xPos;
        float difY = inP.y -yPos;

        float2 newP;
        newP.x =xPos;
        newP.y = yPos;

        float distt = distance(inP-(dist/2.0),newP);
        dst = sampleNearest(src,newP);
        float   ssize  =size* dst.a;
            if (2.0* distt/ssize> dist)
            {
                dst.a =0.0;
            }
            else if (2.0* (distt)/(ssize)>dist-edgeAlpha)
            {
                dst.a=( dist-( 2.0* (distt)/(ssize)))* dst.a/edgeAlpha ;
            }

    }
}

2 Responses to “Round Pixel Flash Filter (FlashPlayer 10)”

  1. Nice filter!!! BTW: found you guys through your url used when attending the head conference.

  2. Pareen says:

    Dude u rock ,, u r a genious