GLSL shader example
Ripple Refraction on an Image
The radial wave displaces sampling coordinates rather than being painted as color. Watch straight lines in the fixture bend.
Live example
Edit the code and the preview updates as you type.
What to observe
Ripple Refraction on an Image.
Mechanism
The radial wave displaces sampling coordinates rather than being painted as color. Watch straight lines in the fixture bend.
The controlling code
float r=length(p),wave=sin(r*35.-u_time*4.)*exp(-r*2.);vec2 q=uv+normalize(p+vec2(.0001))*wave*(.005+.04*u_parameter);c=texture2D(u_texture,q).rgb;
Experiment
Change the radial frequency r*35. to r*18.. Fewer, wider ripples bend the fixture's straight grid lines while their outward phase still uses -u_time*4..
Debugging and cost
A single image lookup uses the displaced q coordinate; the wave is not directly painted as a colored ring. Set .005+.04*u_parameter to 0. to remove all refraction and recover the original image while the wave calculation still runs.