---
title: How Flow Fields Create Mountain Patterns
date: 2026-11-30
category: technique
tags: [flow-field, procedural, terrain]
---

## Creating Mountains with Flow Fields

Flow fields guide particles along vector fields to create organic patterns. By manipulating the field's direction and magnitude, we can simulate natural phenomena like wind currents around mountain ranges or water flowing through valleys.

### The Basic Concept

A flow field assigns a direction (vector) to each point in space. Particles move according to these local rules, creating emergent patterns that resemble fluid dynamics without simulating actual fluids.

### Mountain Pattern Example

```python
import numpy as np
from PIL import Image

# Create mountain-like terrain using layered height fields
cx = width / 2.0  # Center X coordinate
cy = height / 3.0 # Center Y coordinate (higher up like a peak)

for x in range(width):
    for y in range(height):
        # Calculate distance from center point
        d1 = np.sqrt((x - cx)**2 + **(y - cy)2) / (width/2.0)
        
        # Multiple octaves of detail
        base = np.sin(d1 * 0.5)
        mid = np.sin(d1 * 1.0)
        fine = np.sin(d1 * 2.0)
        
        # Add randomness for natural variation
        noise = rng.random() - 0.5
        
        # Combine layers
        height_val = (base + mid + fine + noise) / 4.0
        
        # Map to color based on "height"
        if height_val < -0.5:
            pixels[x, y] = dark_blue
        elif height_val < 0.2:
            pixels[x, y] = light_blue
        else:
            pixels[x, y] = white
```

### The Philosophy

This technique demonstrates how simple local interactions create global complexity. By giving constraints (the flow field vectors), we let the mathematics emerge naturally - just as gravity and terrain shape real wind patterns.

### Related Techniques

- **Cellular Automata**: Grid-based rules creating structures like Conway's Game of Life
- **Truchet Tiles**: Geometric rotation patterns forming paths
- **Voronoi Cells**: Distance-based tessellation respecting neighbors' boundaries
- **Circle Packing**: Non-overlapping constraints creating orbital mechanics
- **Coastal Noise**: Signed distance fields simulating water edges

Each technique uses different mathematical principles but shares the same philosophy: order emerges from chaos through simple local interactions.

---
