Hydra

The keynote at Adobe MAX at Chicago just finished. Get your hands on Hydra now!

via Kevin Goldsmith

I am currently reading through the Hydra manual. Actually it is kinda sad again. It is cool BUT the cool stuff is not available in Flash. Anyways I thinkwe can squeeze a lot of nice effect out of this anways.

My very first Hydra filters:

kernel BlendModeADD
{
  parameter pixel4 intensity;

  void evaluatePixel(in image4 source, out pixel4 result)
  {
    pixel4 in_pixel = sampleLinear( source, outCoord() );
    result = in_pixel + intensity;
  }
}

Here is another one:

kernel ColorMatrixFilter
{
  parameter float4x4 matrix;

  void evaluatePixel(in image4 source, out pixel4 result)
  {
    pixel4 in_pixel = sampleLinear( source, outCoord() );
    result = in_pixel * matrix;
  }
}

I think pure AS3 developers will like this syntax ;)

Update: Here is a simple sharpen filter. Check out the two techinques. I think both are completly wrong but it works. Time will definitly tell how to use this proper.

kernel Sharpen
{
    parameter float strength;

    void evaluatePixel(in image4 source, out pixel4 result)
    {
        int i;
        int j;

        float2 coords = outCoord();
        pixel4 s = pixel4( -strength, -strength, -strength, -strength );
        pixel4 total = pixel4(0,0,0,0);
        float factor = 8.0 * strength + 1.0;
        pixel4 f = pixel4(factor,factor,factor,factor);

        for ( i = -1; i <= 1; i++ )
        {
            for ( j = -1; j <= 1; j++ )
            {
                pixel4 current = sampleLinear( source, coords + float2(i,j));

                if ( i == 0 && j == 0 )
                {
                    total += f * current;
                }
                else
                {
                    total += s * current;
                }
            }
        }

        result = total;
    }

    /*
    void evaluatePixel(in image4 source, out pixel4 result)
    {
        float2 coord = outCoord();
        pixel4 tL = sampleLinear(source, coord - float2(1,1));
        pixel4 tM = sampleLinear(source, coord - float2(0,1));
        pixel4 tR = sampleLinear(source, coord + float2(1,-1));
        pixel4 mL = sampleLinear(source, coord - float2(1,0));
        pixel4 mR = sampleLinear(source, coord + float2(1,0));
        pixel4 bL = sampleLinear(source, coord - float2(1,-1));
        pixel4 bM = sampleLinear(source, coord + float2(0,1));
        pixel4 bR = sampleLinear(source, coord - float2(-1,-1));
        pixel4 mM = sampleLinear( source, outCoord() );
        pixel4 s = pixel4( -strength, -strength, -strength, -strength );
        float ms = 8.0 * strength + 1.0;
        pixel4 up = pixel4(ms,ms,ms,ms);
        result = s * tL + s * tM + s * tR + s * mL + s * mR + s * bL + s * bM + s * bR + mM * up;
    }
    */
}

Update 2: More hydra examples.

4 Responses to “Hydra”


  • Wow! That was super fast! Find me at MAX. I’ll buy you a beer and we can talk about how you can do more than you think within the limitations of the Hydra subset for Flash.

  • What do you mean when you say:

    “Actually it is kinda sad again. It is cool BUT the cool stuff is not available in Flash.”

    I thought that the effects were able to be applied in the next flash player?

  • Reading through the docs. You can see that a set of features is not available in the Flashplayer. But it is great. I want to get home to play around with it even more and tomorrow I will be able to post some more news about it.

  • Wow realy nice Job. I will try it for my next Projekt.
    Adobe Hydra is coool.

Leave a Reply