Curl Noise
別名: curl-noise、divergence-free noise
初出 2007 · Robert Bridson — Introduced for procedural fluid flow by Bridson, Hourihan and Nordenstam, "Curl-Noise for Procedural Fluid Flow" (SIGGRAPH 2007). · 年表 ↗
発明者による命名 名称 · 命名 Robert Bridson (2007) — 著者による記述的命名。Bridson ほか 2007 年論文題「Curl-Noise for Procedural Fluid Flow」。
ひとことで スカラーポテンシャル場(通常は Perlin ノイズ)の回転(curl)を速度として用いる流れの手法。ポテンシャルの回転は発散ゼロ=非圧縮なので、粒子は溜まったり薄くなったりせず流体的な渦を描く。
コード
上のデモの実際のスケッチ(サンドボックスで再現可能)。これで全部です。
curl-noise/index.html
// Curl noise (Bridson, Hourihan & Nordenstam, 2007): take a scalar potential
// field ψ (here Perlin noise) and use its curl as the velocity. In 2D the curl
// of ψ is (∂ψ/∂y, -∂ψ/∂x), which is divergence-free — particles neither bunch
// up nor thin out, giving incompressible, fluid-like swirls. This is the key
// difference from a plain flow field that maps noise straight to an angle.
const SEED = Math.floor(Math.random() * 1e9);
const PALETTES = [
['#0b0e14', '#7dd3fc', '#a78bfa', '#f0abfc'],
['#0d0a14', '#fcd34d', '#fb7185', '#f472b6'],
['#08110d', '#34d399', '#a3e635', '#fde68a'],
['#0b0e14', '#e2e8f0', '#94a3b8', '#cbd5e1'],
];
let pal, parts = [], NS = 0.0016, EPS = 1;
function psi(x, y) { return noise(x * NS, y * NS) * 2 - 1; }
function curl(x, y) {
// central differences of the potential -> divergence-free velocity
const dx = (psi(x, y + EPS) - psi(x, y - EPS)) / (2 * EPS);
const dy = (psi(x + EPS, y) - psi(x - EPS, y)) / (2 * EPS);
return [dx, -dy];
}
function setup() {
randomSeed(SEED); noiseSeed(SEED);
const s = Math.min(windowWidth, windowHeight);
createCanvas(s, s);
pal = PALETTES[Math.floor(random(PALETTES.length))];
background(pal[0]);
for (let i = 0; i < 2200; i++) {
parts.push({ x: random(width), y: random(height), c: pal[1 + (i % (pal.length - 1))], life: random(60, 260) });
}
}
function draw() {
noStroke();
fill(pal[0] + '14');
rect(0, 0, width, height);
for (const p of parts) {
const [vx, vy] = curl(p.x, p.y);
const sp = 12;
p.x += vx * sp; p.y += vy * sp; p.life--;
fill(p.c + 'cc');
circle(p.x, p.y, 1.6);
if (p.life < 0 || p.x < 0 || p.x > width || p.y < 0 || p.y > height) {
p.x = random(width); p.y = random(height); p.life = random(60, 260);
}
}
}仕組み
ノイズ ψ をポテンシャルとみなし、その回転 (∂ψ/∂y, −∂ψ/∂x) を中心差分で求めて速度とし、粒子を移流する。素朴なフローフィールドと違い構成上つねに発散ゼロなので、湧き出し・吸い込みが生じず非圧縮な流体に見える。
パラメータ
noiseScale: number — Spatial frequency of the potential; lower values give broader eddies.epsilon: number — Finite-difference step used to estimate the curl.stepSize: number — Distance particles advance along the velocity each frame.
系譜
このアルゴリズムを使う作品 (0)
参考文献
最終更新 2026-07-16