Motion-triggered mosh — only actively moving pixels tear and glitch.
GLSL fragment shader
The effect's own code. The uniforms and helpers above it — uTex, uFeedback, the depth proxy, the frame ring, depthAt(), timeAt() — are the same header every Ether-MOSH shader opens with, and are documented once on the registry rather than reprinted on all 143 pages.
void main(){ vec4 base = texture2D(uTex, vUv); vec2 f = flowAt(vUv); float speed = length(f); // Gate the effect on how fast this pixel is moving; still pixels pass through untouched. float gate = smoothstep(uThreshold * 0.05, uThreshold * 0.05 + 0.1, speed); // Motion-driven block shift + smear vec2 block = floor(vUv * 30.0) / 30.0; float roll = rand(block + floor(uTime * 12.0)); vec2 shift = f * uAmount * 1.5 * roll * gate; // Chromatic split dragged along the direction of travel vec3 col; col.r = texture2D(uTex, fract(vUv - shift * 1.2)).r; col.g = texture2D(uTex, fract(vUv - shift)).g; col.b = texture2D(uTex, fract(vUv - shift * 0.8)).b; // Motion-trailing from the feedback buffer, capped at half so it decays instead of latching vec3 past = texture2D(uFeedback, vUv - f * uAmount * 0.5).rgb; col = mix(col, past, gate * uAmount * 0.5); gl_FragColor = vec4(mix(base.rgb, col, gate * clamp(uAmount * 1.5, 0.0, 1.0)), base.a); }