GLSL shader example

Digital Glitch with Horizontal Band Displacement

Hash strip index with discrete time so pixels in one band move together while unselected bands remain stable.

Live example

Edit the code and the preview updates as you type.

What to observe

Digital Glitch with Horizontal Band Displacement.

Mechanism

Hash strip index with discrete time so pixels in one band move together while unselected bands remain stable.

The controlling code

float row=floor(uv.y*30.),tick=floor(u_time*8.);float active=step(.8,hash(vec2(row,tick)));vec2 q=uv;q.x+=(hash(vec2(row,tick+1.))-.5)*active*u_parameter*.3;c=texture2D(u_texture,q).rgb;c.r=texture2D(u_texture,q+vec2(active*.02,0)).r;

Experiment

Replace floor(u_time*8.) with floor(u_time*2.). Each selected horizontal strip holds its displacement longer, making the shared row-level motion easier to follow.

Debugging and cost

Two texture reads supply the base color and shifted red channel. Set step(.8,hash(vec2(row,tick))) to step(.5,hash(vec2(row,tick))) to activate more strips without adding texture samples.

Built-in functions used

Learn it step by step