Three.js Weather Map (Wind Particles, Isobars & Pressure Systems)

A meteorological visualization in Three.js, with thousands of wind tracers streaming around drifting low- and high-pressure systems, isobars from marching squares, and switchable temperature or pressure shading.

Key topics: weather visualization, wind particles, isobars, three.js weather map, vector field visualization, marching squares

What this code does

- Pressure Field: 1013 hPa plus Gaussian lows (cyclones) and highs (anticyclones) drifting east on a westerly flow.
- Wind: flow runs along isobars (perpendicular to ∇p), counter-clockwise around lows, with slight inflow toward low pressure.
- Tracers: particles are advected through the field and drawn as fading streaks with additive blending, then respawned when old.
- Isobars: marching squares on a coarse grid every 4 hPa; tight spacing means strong wind.
- Temperature: colder poleward, with warm air pulled ahead of lows; the data is synthetic, not a forecast.
- Controls: shaded field, isobars, tracer count, playback speed, number of systems and drift.

Continue Learning

JavaScript Implementation

ES6+
// Wind tracers: move particles along a vector field, draw each as a short streak

function wind (x, z) {
  const gx = dPressure_dx(x, z), gz = dPressure_dz(x, z)
  return new THREE.Vector2(gz, -gx).multiplyScalar(0.12)   // flow along isobars, around lows
}
for (let i = 0; i < n; i++) {
  const v = wind(px[i], pz[i])
  positions.setXYZ(i * 2, px[i], 0, pz[i])                 // streak tail
  px[i] += v.x * dt; pz[i] += v.y * dt
  positions.setXYZ(i * 2 + 1, px[i], 0, pz[i])             // streak head
  if (++age[i] > maxAge) respawn(i)
}