// by poly@omino.com, 2008 kernel Waves < namespace : "omino"; vendor : "omino.com"; version : 1; description : "Sine Waves"; > { // automatically given the destination rectangle size by my viewer program parameter float2 dstsize; parameter float3 color1; parameter float3 color2; parameter float3 color3; // three frequencies and amplitudes (done using float3, why not) parameter float3 waveF; parameter float3 waveA; input image4 src; // not used output pixel4 dst; void evaluatePixel() { float2 co = outCoord(); float x = (co.x * 6.28 - dstsize.x / 2.0) / dstsize.x; float coY = co.y; float y = sin(x * waveF.x) * waveA.x + sin(x * waveF.y) * waveA.y + sin(x * waveF.z) * waveA.z; // arbitrary scaling to make it not too tall... coY = (coY /dstsize.y) * 7.0 - 3.50; dst = float4(0,0,0,1); if(abs(y - coY) < .4) dst.rgb = color1; if(abs(y - coY) < .1) dst.rgb = color2; if(abs(y - coY) < .03) dst.rgb = color3; } }