Personal tools

Views

Ripple hydra

From Adobe Labs

[edit]

Ripple source code

/*****************************************************************************
 *
 * Author: Joa Ebert
 * http://blog.je2050.de
 * Contact: j -at- je2050.de
 *
 *****************************************************************************/
kernel Ripple
<   nameSpace:          "popforge::ImageProcessing";
    vendor:             "Joa Ebert";
    version:            1;
    description:        "Applies a sine wave distortion";
>
{
    parameter float2 frequency<
        minValue:       float2(0.0);
        maxValue:       float2(0.5);
        defaultValue:   float2(0.06125);
        description:    "Frequency of the sine wave";
    >;
    
    parameter float2 amplitude<
        minValue:       float2(0.0);
        maxValue:       float2(64.0);
        defaultValue:   float2(4.0);
        description:    "Amplitude of the sine wave";
    >;
    
    void evaluatePixel(in image4 source, out pixel4 result)
    {
        float2 xy = outCoord();
        
        xy += amplitude * sin( xy.yx * frequency.xy );
        
        result = sampleLinear(source,xy);
    }
}
Retrieved from "http://labs.adobe.com/wiki/index.php/Ripple_hydra"