---
id: "domain-warping"
title: "Domain Warping"
aliases: [noise warping, warped fBm, flow-distorted noise]
domain: "procgen"
stage: "procedural"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, cpu, blender, unity, unreal, godot]
year_introduced: 2002
outputs: [texture, heightfield, volume-density]
style: "both"
dynamic: "both"
cost: "cheap"
authority: "Quilez"
url: "https://texelatlas.vercel.app/t/domain-warping/"
sources_verified_at: "2026-11-29"
---
# Domain Warping (Quilez)

> Feed the output of one noise function back into the coordinates of another, f(p + w(p)), so the pattern is bent into swirls, folds and marble-like flows that plain fBm cannot make.

## Reach for it when

- noise looks too uniform and blobby
- want swirling marble or smoke patterns
- fractal terrain lacks flowing or folded structure
- need lava or strata looking organic swirls cheaply

## How it works

Instead of evaluating a field f at p, you first displace p by a vector field w, built from independent noise samples (typically two offset fBm calls for x and y). Nesting the idea, f(p + a*g(p + b*h(p))) gives progressively more organic structure; each level multiplies cost by the complexity of the inner evaluation. The displacement amplitude controls how far features travel, and animating one of the offset constants or adding time to the inner noise yields convincing liquid motion. Intermediate values (the warp vectors, the magnitude of the displacement) are free by-products that can be used to colour the pattern, so the result is often both a height and a palette index. The technique is general: any coordinate-based function (noise, Voronoi, SDF) can be warped.

## When to use it

Choose it when you need organic swirls, marble, smoke, lava, strata, or want to break the regularity of [Fractal Brownian Motion and Multifractals](https://texelatlas.vercel.app/t/fractal-brownian-motion.md) terrain cheaply (for example to fake flow-aligned ridges). Prefer [Interactive Hydraulic Erosion on Heightfields](https://texelatlas.vercel.app/t/hydraulic-erosion-stava.md) or [Stream-Power Erosion (Fluvial Terrain Uplift)](https://texelatlas.vercel.app/t/stream-power-erosion.md) for physically plausible drainage, and [Reaction-Diffusion Textures (Turk)](https://texelatlas.vercel.app/t/reaction-diffusion-textures.md) for self-organising stripes and spots.

## Cost

cheap — Multiplicative in nesting depth: two levels of warp with 5 fBm calls each is about 15 noise stacks per pixel.
Measured GPU Weight: 34.16× baseline (heavy) — 1.1237 ms median / 1.151 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 29.82× baseline (heavy) — 0.4741 ms median (2.37× faster on L4).
Ampere A100 scaling: 23.94× baseline (heavy) — 0.6895 ms median (1.63× faster on A100).

## Failure modes

- Large warp amplitude folds the domain over itself, causing discontinuous seams or smeared detail
- Differentiation is hard: finite-difference normals through nested warps are noisy and expensive
- Each nesting level multiplies the cost, so mobile or per-vertex use needs a baked texture
- Using the same noise for warp and base creates visible diagonal correlation instead of independent swirls

## Engine support

- blender: builtin — `Noise Texture > Distortion input` (evidence: https://docs.blender.org/manual/en/5.2/render/shader_nodes/textures/noise.html, checked 2026-12-01) — Distortion offsets the lookup coordinates by noise.
- godot: builtin — `FastNoiseLite > domain_warp_enabled = true (Simplex and BasicGrid coordinate warping)` (evidence: https://github.com/godotengine/godot/blob/4.4-stable/modules/noise/fastnoise_lite.cpp, checked 2026-12-01)

## Dataflow

- Inputs: —
- Outputs: texture, heightfield, volume-density
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, cpu, blender, unity, unreal, godot

## Presets

### Two-level domain-warped fBm (glsl-fragment; rendered 2026-11-29)

```json
{
  "warp_strength": 4,
  "octaves": 5
}
```

```glsl
// GLSL ES 3.0, Shadertoy-style. f(p + 4*q + 4*r) with animated warp fields.
const int   OCTAVES = 5;
const float WARP = 4.0;

float hash21(vec2 p){
  p = fract(p * vec2(123.34, 456.21));
  p += dot(p, p + 45.32);
  return fract(p.x * p.y);
}
float vnoise(vec2 p){
  vec2 i = floor(p), f = fract(p);
  vec2 u = f * f * (3.0 - 2.0 * f);
  return mix(mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),
             mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x), u.y);
}
float fbm(vec2 p){
  float s = 0.0, a = 0.5;
  for (int i = 0; i < OCTAVES; i++) {
    s += a * vnoise(p);
    p = mat2(1.6, 1.2, -1.2, 1.6) * p;
    a *= 0.5;
  }
  return s;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord){
  vec2 p = (fragCoord - 0.5 * iResolution.xy) / iResolution.y * 3.0;
  float t = iTime * 0.15;
  vec2 q = vec2(fbm(p + vec2(0.0, 0.0)), fbm(p + vec2(5.2, 1.3)));
  vec2 r = vec2(fbm(p + WARP * q + vec2(1.7, 9.2) + t),
                fbm(p + WARP * q + vec2(8.3, 2.8) - t));
  float f = fbm(p + WARP * r);
  vec3 col = mix(vec3(0.10, 0.12, 0.30), vec3(0.85, 0.35, 0.15), smoothstep(0.2, 0.8, f));
  col = mix(col, vec3(0.95, 0.90, 0.75), clamp(length(r) * 0.8, 0.0, 1.0) * f);
  col = mix(col, vec3(0.02, 0.05, 0.12), clamp(q.x * q.x * 2.0, 0.0, 1.0) * 0.5);
  fragColor = vec4(col * (0.3 + 1.1 * f), 1.0);
}
```

Attribution: written for this index. Technique described by Inigo Quilez; code is original.

### Multi-octave FBM domain warping (WGSL) (webgpu-wgsl; WebGPU WGSL runtime)

```json
{
  "WARP": 3.2,
  "OCTAVES": 5
}
```

```wgsl
// WebGPU WGSL fragment specimen: iterated f(p + WARP * q + WARP * r) domain warping
const WARP: f32 = 3.2000; // P
const OCTAVES: i32 = 5; // P

fn hash21(p_in: vec2f) -> f32 {
  var p = fract(p_in * vec2f(123.34, 456.21));
  p = p + dot(p, p + 45.32);
  return fract(p.x * p.y);
}

fn vnoise(p: vec2f) -> f32 {
  let i = floor(p);
  let f = fract(p);
  let u = f * f * (3.0 - 2.0 * f);
  let a = hash21(i);
  let b = hash21(i + vec2f(1.0, 0.0));
  let c = hash21(i + vec2f(0.0, 1.0));
  let d = hash21(i + vec2f(1.0, 1.0));
  return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}

fn fbm(p_in: vec2f) -> f32 {
  var p = p_in;
  var acc: f32 = 0.0;
  var amp: f32 = 0.5;
  let rot = mat2x2f(vec2f(0.8, 0.6), vec2f(-0.6, 0.8));
  for (var i: i32 = 0; i < OCTAVES; i = i + 1) {
    acc = acc + amp * vnoise(p);
    p = rot * p * 2.02;
    amp = amp * 0.5;
  }
  return acc;
}

@fragment
fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
  let uv = (pos.xy / u.resolution.y) * 2.6;
  let t = u.time * 0.14;
  let q = vec2f(fbm(uv + vec2f(0.0, t)), fbm(uv + vec2f(5.2, 1.3 - t)));
  let r = vec2f(fbm(uv + WARP * q + vec2f(1.7, 9.2)), fbm(uv + WARP * q + vec2f(8.3, 2.8)));
  let f = fbm(uv + WARP * r);
  var col = mix(vec3f(0.09, 0.18, 0.24), vec3f(0.68, 0.48, 0.30), clamp(f * 1.4, 0.0, 1.0));
  col = mix(col, vec3f(0.94, 0.92, 0.86), smoothstep(0.55, 0.92, length(q) * 0.75 + f * 0.4));
  return vec4f(col, 1.0);
}
```

Attribution: written for this index

## Lineage

- extends [Fractal Brownian Motion and Multifractals](https://texelatlas.vercel.app/t/fractal-brownian-motion.md)

## Sources

1. [primary] Inigo Quilez Domain Warping. iquilezles.org. https://iquilezles.org/articles/warp (verified via http on 2026-11-29)
2. [tutorial] Patricio Gonzalez Vivo The Book of Shaders: Fractal Brownian Motion. thebookofshaders.com. https://thebookofshaders.com/13 (verified via http on 2026-11-29)
3. [implementation] Gökay Aydoğan (2026) gokayfem/glsl-studies. https://github.com/gokayfem/glsl-studies License: MIT. (verified via github on 2026-11-30)

## Cite this entry

Texel. "Domain Warping." https://texelatlas.vercel.app/t/domain-warping/ (accessed 2026-12-01).
