OldschoolPlasma hydra
From Adobe Labs
Oldschool plasma source code
/*****************************************************************************
*
* Author: Joa Ebert
* http://blog.je2050.de
* Contact: j -at- je2050.de
*
*****************************************************************************/
kernel OldSchoolPlasma
< nameSpace: "popforge::ImageProcessing";
vendor: "Joa Ebert";
version: 1;
description: "Creates an grayscale plasma texture. Has to be used with a color palette.";
>
{
parameter int width
<
defaultValue: 200;
minValue: 1;
maxValue: 400;
description: "Height of the generated plasma.";
>;
parameter int height
<
defaultValue: 200;
minValue: 1;
maxValue: 400;
description: "Width of the generated plasma.";
>;
void evaluatePixel(out pixel4 result)
{
float2 coord = outCoord();
float amp = 0.5 + 0.5 * sin( coord.x / 16.0 ) +
0.5 + 0.5 * sin( coord.y / 8.0 ) +
0.5 + 0.5 * sin((coord.x + coord.y) / 16.0 ) +
0.5 + 0.5 * sin(length(coord) / 8.0 );
amp /= 4.0;
result = pixel4(amp);
}
region generated()
{
return region(float4(0,0,width,height));
}
}