Interactive demo

Curl Noise

The curl of a noise field is a velocity field that never compresses or expands, like an incompressible fluid. Particles that follow it swirl like smoke but never bunch up, which makes curl noise a favorite for visual effects.

Your browser does not support the HTML5 canvas tag.

Switch the field to Gradient: the particles now run uphill and gather on the peaks of the noise. In the curl field they follow its contour lines instead.

Controls

Display

Legend

  • Particle trails
  • Noise field (potential), light = high
  • Flow direction

1. Curl of a potential

The noise ψ(x, y) serves as a potential. The velocity is v = (∂ψ/∂y, −∂ψ/∂x), the gradient turned by 90°. It runs along the contour lines of ψ, so the particles circle around the highs and lows of the noise.

2. No sources, no sinks

The divergence of this field is zero everywhere: as much flows into every small area as flows out of it, so the particles stay evenly spread. The gradient field (∂ψ/∂x, ∂ψ/∂y) has sources and sinks, and the particles pile up in its sinks.

3. Around obstacles

To make the flow avoid an obstacle, the potential is multiplied by a smooth ramp of the distance to it. On the boundary the potential becomes zero, so the boundary is a contour line and the flow glides along it instead of passing through.

Credits