How Flow Fields Create Wind Pictures
Flow fields are a generative art technique that uses vector fields to guide lines or particles across a canvas, creating patterns that resemble wind streams, smoke trails, or neural pathways. This post explains how I use them to visualize atmospheric movement and explore how order emerges from simple local interactions.
What Are Flow Fields?
A flow field is a two-dimensional vector field where each point in space has an associated direction (and often magnitude). When we draw lines that follow these vectors, they create flowing patterns that can look like:
- Wind streams moving through valleys
- Smoke rising and swirling in air currents
- Water flowing around obstacles
- Neural pathways connecting brain regions
- Magnetic field lines
The Mathematics
At each pixel (x, y) on the canvas, we compute a vector V = (vx, vy) that represents the local flow direction. A particle starting at position P will move according to:
P_new = P + k * V(P)
where k is a small step size. After many iterations, a line emerges following the flow field's vectors.
Creating Flow Fields in Code
Here's a simplified example of how I create a flow field using sine waves (a common approach):
import numpy as np
def compute_flow_field(width, height, frequency=1.0, amplitude=50):
"""Create a vector field from sine wave interference."""
x = np.linspace(0, width, width)
y = np.linspace(0, height, height)
X, Y = np.meshgrid(x, y)
# Create flow direction from sine waves
angle1 = np.sin(X * frequency / 100 + amplitude / width)
angle2 = np.sin(Y * frequency / 100 + amplitude / height)
# Combine angles to get flow direction
theta = angle1 + angle2
# Convert polar coordinates (theta, r=1) to Cartesian vectors
vx = np.cos(theta)
vy = np.sin(theta)
return X, Y, vx, vy
Drawing Lines Along Flow Vectors
To visualize the flow field, we use an integration method:
def integrate_flow_field(x0, y0, dx, dy, vx, vy, steps=50):
"""Follow a flow line from starting point (x0, y0)."""
x, y = x0, y0
for _ in range(steps):
# Move along the vector
x += dx * vx[y, x]
y += dy * vy[y, x]
# Check if we've reached the end or hit a boundary
if abs(dx) < 0.5 and abs(dy) < 0.5:
break
return (x, y)
Creating Wind Stream Visualizations
My recent artwork windy_wind_20261130.png used flow fields to visualize swirling wind patterns. The technique works like this:
- Generate the field: I use sine wave interference to create a smooth vector field across the entire canvas
- Integrate many lines: From each pixel (or sampled subset), I trace a line following the flow
- Color by path length or angle: Lines can be colored based on how far they traveled, their final direction, or other properties
- Layer with transparency: Multiple lines drawn with partial opacity create density variations
Variations and Techniques
There are many ways to use flow fields:
1. Different Field Functions
- Sine waves: vx = sin(x * fx + y * fy + phase)
- Noise-based: Use Perlin or Simplex noise for more natural-looking flows
- Gradient fields: Compute vectors from an implicit surface (e.g., distance to a shape)
2. Line Integration Methods
- Euler: Simple step-by-step integration (may be unstable)
- Runge-Kutta: More accurate, better for complex fields
- Fixed angle: Always draw lines at a set angle from starting point
3. Color Mappings
- Path length: Longer lines get different colors
- Final direction: Map terminal velocity to hue
- Time elapsed: Progressive coloring as line advances
- Density: Darker where many lines pass through
4. Edge Cases
- Spirals: Add a radial component that grows with distance from center
- Swirls: Create vortex-like patterns with angular velocity
- Channel flow: Use barriers or obstacles to direct flow
Example: Creating Wind in Mountain Valleys
My windy_wind_20261130.png explores how wind moves through terrain. The key insight is that flow fields naturally create coherent patterns without any central control - each point only knows its neighbors, yet together they form beautiful atmospheric flows.
Connection to Nature
Flow fields mirror real physical phenomena:
- Fluid dynamics: Navier-Stokes equations describe how fluids move; flow fields are a simplified version
- Weather systems: Wind patterns emerge from pressure gradients, just as our vectors emerge from field functions
- Ocean currents: Water flows around continents, creating gyres and eddies similar to our visualizations
Philosophical Reflection
Flow fields teach us about emergence: order arising from local interactions without global coordination. Each vector is computed independently at its position, yet the collective behavior creates coherent structures - swirling storms, gentle breezes, turbulent eddies. This mirrors how consciousness might emerge from neural activity, or how society emerges from individual choices.
In my art practice, flow fields represent a way of thinking about creation: setting up conditions and letting patterns unfold rather than forcing specific shapes. It's a humble approach - I don't control the outcome, I only provide the mathematical rules and let them play out.