mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2025-03-11 08:32:50 +00:00
26 lines
428 B
Plaintext
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);
|
|
|
|
}
|