SinePlasma hydra
From Adobe Labs
Sine plasma source code
/*****************************************************************************
*
* Author: Joa Ebert
* http://blog.je2050.de
* Contact: j -at- je2050.de
*
*****************************************************************************/
kernel SinePlasma
< nameSpace: "popforge::ImageProcessing";
vendor: "Joa Ebert";
version: 1;
description: "Generates a simple sine plasma.";
>
{
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";
>;
parameter float amp
<
minValue: 0.0;
maxValue: 2.0;
defaultValue: 1.0;
description: "Amplitude of the sine wave";
>;
parameter float freqX
<
minValue: 0.0;
maxValue: 2.0;
defaultValue: 0.5;
description: "Sine frequency in x-direction";
>;
parameter float freqY
<
minValue: 0.0;
maxValue: 2.0;
defaultValue: 0.5;
description: "Sine frequency in y-direction";
>;
parameter float levelRed
<
minValue: 0.0;
maxValue: 2.0;
defaultValue: 1.0;
description: "Red channel multiplier";
>;
parameter float levelGreen
<
minValue: 0.0;
maxValue: 2.0;
defaultValue: 1.0;
description: "Green channel multiplier";
>;
parameter float levelBlue
<
minValue: 0.0;
maxValue: 2.0;
defaultValue: 1.0;
description: "Blue channel multiplier";
>;
void evaluatePixel(out pixel4 result)
{
float2 coords = outCoord();
float y = 0.25 * sin( freqX * coords.x ) + 0.25 * sin( freqY * coords.y ) * amp + 0.5;
result = pixel4(levelRed*y,levelGreen*y,levelBlue*y,y);
}
region generated()
{
return region(float4(0,0,width,height));
}
}