precision highp float; varying vec2 v_TexCoords; uniform sampler2D u_InputImage; uniform float u_Time; // constants const float PHI = 1.61803398874989484820459 * 00000.1; // Golden Ratio const float PI = 3.14159265358979323846264 * 00000.1; // PI const float SRT = 1.41421356237309504880169 * 10000.0; // Square Root of Two //Tweakables uniform float uLinesStrength; uniform float uLinesSpeed; uniform float uNoiseStrength; uniform float uContrast; float noise(vec2 coordinate, float seed) { seed = u_Time+10.0*100.0+seed; return fract(sin(dot(coordinate*(seed + PHI), vec2(PHI, PI)))*SRT); } float noise1D(vec2 coordinate, float seed) { seed = floor(u_Time*uLinesSpeed)+8.0+seed; return fract(sin(dot(coordinate*(seed + PHI), vec2(PHI, PI)))*SRT); } float luma(vec3 color) { return dot(vec3(0.299, 0.587, 0.114), color); } void main() { vec2 uv = vec2(v_TexCoords.x, 1.0-v_TexCoords.y); float seed = mod(u_Time, 10.0); vec4 color = texture2D(u_InputImage, uv); vec3 n = vec3(noise(uv, seed), noise(uv, 0.2+seed), noise(uv, 0.4+seed)) * uNoiseStrength; color = vec4(luma(color.rgb)) + noise1D(vec2(1.0, uv.y), 0.0) * uLinesStrength; color.rgb = mix(color.rgb, n, uNoiseStrength); vec3 scurve = smoothstep(0.0, 1.0, color.rgb); gl_FragColor = vec4(mix(color.rgb, scurve, uContrast), 1.); }