#version 330 core
in vec2 vTex;
out vec4 FragColor;
uniform sampler2D iChannel0;
uniform vec3 iResolution;
uniform float iTime;
uniform float uAlpha;
uniform float uStartDelay;

// noise function
float randomNoise(float x, float y)
{
    return fract(sin(dot(vec2(x, y), vec2(12.9898, 78.233))) * 43758.5453);
}

float _Indensity = 0.11;

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord / iResolution.xy;
    float splitAmount = _Indensity * randomNoise(iTime, 2.0);
    vec4 ColorR = texture(iChannel0, vec2(uv.x + splitAmount, uv.y));
    vec4 ColorG = texture(iChannel0, uv);
    vec4 ColorB = texture(iChannel0, vec2(uv.x - splitAmount, uv.y));
    fragColor = vec4(ColorR.r, ColorG.g, ColorB.b, 1.0);
}

void main(){ mainImage(FragColor, gl_FragCoord.xy); }
