Imagine placing a particle at every pixel in an image. Now imagine a wind flowing through the image - a vector field that pushes particles in different directions depending on their location. The particles flow along invisible currents, creating beautiful, organic-looking streaks. This is a flow field, and it's one of the most elegant ways to generate flowing, fluid-like art.
Vector Fields and Gradients
A vector field assigns a direction (and sometimes magnitude) to every point in space. In 2D, that's usually an arrow pointing in some direction at each (x, y) coordinate.
One common source of vector fields is the gradient of a scalar field. If you have a grayscale image, the gradient at each point tells you the direction of increasing brightness. Perpendicular to the gradient is the direction of constant brightness.
Many flow field artists use gradients of Perlin noise as their vector field. Noise-based gradients create natural-looking, non-repeating flow.
Curl, Divergence, and Divergence-Free Fields
In fluid dynamics, there's an important distinction:
- Divergence: Whether fluid is spreading out (positive) or converging (negative)
- Curl: Whether fluid is rotating/swirling
Divergence-free fields don't compress or expand - they're purely rotational. These are ideal for particle flow because particles never accumulate or disappear. Curl is the perfect measure of this: a zero-divergence field is entirely determined by its curl.
Ken Perlin and Noise
Ken Perlin invented Perlin noise in 1983 for computer graphics. It's a pseudo-random gradient noise that looks natural - not too chaotic, not too smooth. When you compute the gradient of Perlin noise (how the noise value changes in x and y directions), you get a divergence-free vector field.
This is why Perlin noise gradients are so popular for flow fields: they're guaranteed to have zero divergence, creating smooth, continuous flow without accumulation.
The Flow Field Algorithm
- Create a vector field (e.g., Perlin noise gradient, image gradient, etc.)
- Place particles (typically one per pixel or sampled sparsely)
- For each timestep: move each particle along the vector at its current location
- Draw a line segment from the particle's old position to new position
- Repeat for many timesteps until the image is saturated with flow lines
Variations and Enhancements
Color mapping: Color particles based on their speed, age, or position.
Particle traces: Draw long tails behind particles instead of single segments.
Advection: Let the flow field itself change over time, creating dynamic effects.
Vorticity confinement: Amplify swirling motion while preserving divergence-free property.
Flow Fields in Digital Art
Flow field visualizations have become popular in digital art because they:
- Look organic and natural despite being purely mathematical
- Are visually striking with high aesthetic impact
- Allow meaningful parameter variation (different noise scales, particle densities)
- Can incorporate image content (using image gradients as flow)
Real-World Applications
Beyond art, flow fields are used in:
- Fluid simulation: Physics engines use divergence-free fields for accurate flows
- Game development: AI movement and particle effects
- Scientific visualization: Displaying air currents, ocean flows, magnetic fields
Ready to try it? Open GlitchArt Studio and experiment with this effect.