GLSL shader example

Moiré Interference Between Line Grids

Multiply two nearby high-frequency orientations to reveal a low-frequency beat. Fine lines can alias; reduce frequency to inspect.

Live example

Edit the code and the preview updates as you type.

What to observe

Moiré Interference Between Line Grids.

Mechanism

Multiply two nearby high-frequency orientations to reveal a low-frequency beat. Fine lines can alias; reduce frequency to inspect.

The controlling code

vec2 q=rot(.01+.12*u_parameter)*p;float a=sin(p.x*180.),b=sin(q.x*180.+u_time*.2);c=vec3(.5+.5*a*b);

Experiment

Change both line frequencies p.x*180. and q.x*180. to 90.. Fine stripes become easier to resolve, and the broad interference bands spread farther apart for the same rotation angle.

Debugging and cost

This pattern multiplies two sine signals without filtering their subpixel detail. Set the rotation expression .01+.12*u_parameter to 0. and pause time to remove the angular mismatch; the large angled beat bands disappear.

Built-in functions used

Learn it step by step