Skip to content

Instantly share code, notes, and snippets.

@code-disaster
Created August 3, 2016 07:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save code-disaster/869c1c47d8b708dc2458538907445952 to your computer and use it in GitHub Desktop.
Save code-disaster/869c1c47d8b708dc2458538907445952 to your computer and use it in GitHub Desktop.
simple scanline shader
/* post-fx pass by blending a solid white fullscreen quad, no texture required */
/*uniform*/ float fmin = 0.7;
void main(void)
{
float fmod = mod(gl_FragCoord.y, 2.0);
float fstep = fmin + (1.0 - fmin) * fmod;
gl_FragColor = vec4(1.0, 1.0, 1.0, fstep);
}
/* shadertoy test - blends with a texture */
float fmin = 0.7;
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
float fmod = mod(fragCoord.y, 2.0);
float fstep = fmin + (1.0 - fmin) * fmod;
vec2 uv = fragCoord.xy / iResolution.xy;
fragColor = vec4(texture2D(iChannel0, uv).rgb * fstep, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment