runnable fragment

Pixel Sort

glitch-core generative glsl runnable fragment MIT
code snippet
precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform vec2 u_resolution;
uniform float u_intensity;   // 0.0-1.0
uniform float u_threshold;   // 0.0-1.0 brightness threshold
uniform float u_direction;   // 0=horizontal, 1=vertical

float luminance(vec3 c) {
  return dot(c, vec3(0.299, 0.587, 0.114));
}

void main() {
  vec2 uv = v_texCoord;