TwoTerm/ScanLineFilter.cikernel
Kelvin Sherlock 04d96f94ce change scanline filter.
git-svn-id: svn://qnap.local/TwoTerm/trunk@2004 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
2011-01-20 23:24:03 +00:00

26 lines
428 B
Plaintext

/*
* simulate scanlines by darkening every other line.
*
*/
kernel vec4 scanline(sampler image, float strength)
{
vec4 fudge = vec4( 0.4, 0.4, 0.4, 0.0 );
vec2 coord = samplerCoord(image);
vec4 pixel = sample(image, coord);
fudge *= strength;
float yy = mod(coord.y, 2.0);
fudge *= (yy < 1.0) ? 1.0 : -1.0;
pixel = unpremultiply(pixel);
pixel += fudge;
return premultiply(pixel);
}