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.
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 t