GLSL shader example

Hologram Shader with a Moving Scan Band

Multiply a silhouette by high-frequency scanlines and add one slower scan band. Random displacement affects only selected horizontal strips.

Live example

Edit the code and the preview updates as you type.

What to observe

Hologram Shader with a Moving Scan Band.

Mechanism

Multiply a silhouette by high-frequency scanlines and add one slower scan band. Random displacement affects only selected horizontal strips.

The controlling code

vec2 q=p;q.x+=step(.95,noise(vec2(floor(q.y*25.),floor(u_time*8.))))*.08;float shape=1.-smoothstep(.45,.46,length(q));float scan=pow(.5+.5*sin(q.y*180.),4.);float band=exp(-pow((q.y-mod(u_time*.3,2.)+1.)*15.,2.));c+=vec3(.05,.8,1.)*shape*(.2+.55*scan+band)*(0.5+u_parameter);

Experiment

Replace sin(q.y*180.) with sin(q.y*90.). The fine scanlines become twice as far apart, while the broader band still travels at the speed set by u_time*.3.

Debugging and cost

Horizontal jumps occur only where step(.95,noise(...)) selects a strip. Lower .95 to .8 to make more strips jump; the circular mask is evaluated after this offset, so the silhouette itself also shifts in those strips.

Built-in functions used

Learn it step by step