Contents

CRT Shader

Shader

CRT Shader, or something.

Code

Vertex Shader

attribute vec2 position;
varying vec2 vPosition;
void main() {
    vPosition = position;
    gl_Position = vec4(position, 0.0, 1.0);
}

Fragment Shader

precision highp float;
varying vec2 vPosition;

uniform float uTime;
uniform sampler2D uSampler;

void main() {
    vec2 ndc = vPosition;

    // Bend the texture coordinates across a sphere-ish thing

    // Add some scan-line noise
    vec2 tpos = vPosition * vec2(0.5, -0.5) + 0.5;
    tpos.x += sin(tpos.y*205. + uTime*30.)*0.00060;

    vec4 color = texture2D(uSampler, tpos);

    const float strip_mix = 0.5;

    // Every other line is faded... interpolation effect
    float strip = tpos.t * mix(50.0, 100.0, strip_mix);
    float stripFac = 
        1.0 + 0.25 
            * strip_mix 
            * (step(0.5, strip-float(int(strip))) - 0.5);

    gl_FragColor = vec4(color.rgb * stripFac, 1);
}