---
id: "geometry-clipmaps-terrain"
title: "Geometry clipmaps"
aliases: [clipmap terrain, geometry clipmap]
domain: "performance"
stage: "performance"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, unity, unreal]
year_introduced: 2004
inputs: [heightfield]
outputs: [mesh]
style: "both"
dynamic: "both"
cost: "cheap"
authority: "Losasso & Hoppe, 2004"
url: "https://texelatlas.vercel.app/t/geometry-clipmaps-terrain/"
sources_verified_at: "2026-11-29"
---
# Geometry clipmaps (Losasso & Hoppe, 2004)

> Cache terrain heights as a stack of nested, camera-centered regular grids of equal size but doubling spacing, updated incrementally as the viewer moves.

## Reach for it when

- terrain mesh needs lod around the camera
- huge heightmap rendering with constant triangle count
- terrain vertices pop when lod changes
- open world ground detail near viewer only
- avoid cpu quadtree traversal for terrain

## How it works

Each LOD level is a square window of the heightmap of fixed vertex count; level k covers twice the world extent of level k-1 at half the sampling density. All levels are centered on the viewer, so detail falls off roughly with distance and the triangle count is nearly constant.

As the camera moves, each level shifts in toroidal fashion: only the strip of new rows and columns entering the window is uploaded or generated, the rest is reused. Because the grids are regular, they are drawn as instanced ring meshes with heights fetched in the vertex shader.

Seams between levels are hidden by blending heights over a transition band at each ring's outer edge (geomorphing) and by stitching or skirt triangles; the original also compresses the height data and synthesizes extra detail at the finest levels.

## When to use it

Choose it for very large heightfield terrain viewed from near the ground, when you want constant triangle budget and no CPU quadtree traversal. Prefer [CDLOD terrain](https://texelatlas.vercel.app/t/cdlod-terrain.md) when you want adaptive detail per quadtree node (flat areas cost less) and smoother per-node morphing. Prefer [Nanite virtualized geometry](https://texelatlas.vercel.app/t/nanite-virtualized-geometry.md) when terrain is arbitrary mesh rather than a heightfield, and use [Interactive Hydraulic Erosion on Heightfields](https://texelatlas.vercel.app/t/hydraulic-erosion-stava.md) style data as the height source.

## Cost

cheap — Fixed vertex budget per frame, mostly vertex-texture fetch cost; update cost is proportional to camera movement.
Measured GPU Weight: 181.9× baseline (extreme) — 5.6388 ms median / 5.739 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 163.19× baseline (extreme) — 2.5948 ms median (2.17× faster on L4).
Ampere A100 scaling: 132.66× baseline (extreme) — 3.8205 ms median (1.48× faster on A100).

## Failure modes

- Cannot represent overhangs, caves or cliffs, since terrain is a single-valued height function
- Vertices swim or visibly pop when the clip window snaps and morphing is too short
- Cracks between rings if stitching and morph ranges disagree
- Uniform detail in flat regions wastes triangles compared with adaptive schemes
- Normals computed from coarse levels look faceted unless a separate normal map is used

## Engine support

- godot: plugin — `Install Terrain3D (GDExtension)` (evidence: https://github.com/TokisanGames/Terrain3D/blob/main/doc/docs/introduction.md, checked 2026-12-01) — Third-party Terrain3D uses a geometry clipmap mesh.

## Dataflow

- Inputs: heightfield
- Outputs: mesh
- Platforms: webgl2, webgpu, desktop-gpu, unity, unreal

## Presets

### Geometry Clipmaps — nested doubling LOD rings & morph bands (left) vs blended alpine terrain (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_RING_SCALE": 1,
  "P_WIRE_GAIN": 0.9,
  "P_CAM_SPEED": 0.7,
  "P_SPLIT": 0.5
}
```

```glsl
const float P_RING_SCALE = 1.0; // P Clipmap Scale [0.5, 2.0, 0.05]
const float P_WIRE_GAIN = 0.90; // P Grid Wireframe [0.0, 1.5, 0.05]
const float P_CAM_SPEED = 0.70; // P Flyover Speed [0.0, 2.0, 0.05]
const float P_SPLIT = 0.50; // P LOD Rings / Lit Split [0.0, 1.0, 0.02]

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.5);
  return fract(p.x * p.y);
}

float noise2(vec2 p) {
  vec2 i = floor(p);
  vec2 f = fract(p);
  f = f * f * (3.0 - 2.0 * f);
  return mix(
    mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x),
    mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), f.x),
    f.y
  );
}

// Multi-octave ridged alpine terrain heightfield
float terrainH(vec2 p) {
  float h = 0.0;
  float amp = 0.55;
  float freq = 0.45;
  for (int i = 0; i < 5; i++) {
    float n = 1.0 - abs(noise2(p * freq) * 2.0 - 1.0);
    h += n * n * amp;
    p = mat2(0.8, 0.6, -0.6, 0.8) * p;
    freq *= 2.05;
    amp *= 0.48;
  }
  return h - 0.58;
}

vec3 terrainNormal(vec2 p) {
  float e = 0.025;
  float hx = terrainH(p + vec2(e, 0.0)) - terrainH(p - vec2(e, 0.0));
  float hz = terrainH(p + vec2(0.0, e)) - terrainH(p - vec2(0.0, e));
  return normalize(vec3(-hx, 2.0 * e, -hz));
}

vec3 lodPalette(float lvl) {
  if (lvl < 0.5) return vec3(0.18, 0.90, 0.82); // L0 finest
  if (lvl < 1.5) return vec3(0.28, 0.72, 0.98); // L1 2x
  if (lvl < 2.5) return vec3(0.96, 0.78, 0.22); // L2 4x
  if (lvl < 3.5) return vec3(0.96, 0.44, 0.20); // L3 8x
  return vec3(0.76, 0.30, 0.88);                // L4 16x
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool isLit = screenX >= split;
  float ringScale = clamp(P_RING_SCALE, 0.45, 2.2);
  float wireGain = clamp(P_WIRE_GAIN, 0.0, 1.5);
  float flyZ = -iTime * max(P_CAM_SPEED, 0.0) * 1.1;

  vec3 ro = vec3(0.0, 1.85, 2.2 + flyZ);
  vec3 ta = vec3(0.0, 0.15, -3.2 + flyZ);
  vec3 fwd = normalize(ta - ro);
  vec3 right = normalize(cross(fwd, vec3(0.0, 1.0, 0.0)));
  vec3 up = cross(right, fwd);
  vec3 rd = normalize(fwd * 1.45 + right * uv.x + up * uv.y);

  // Horizon sky
  vec3 skyCol = mix(vec3(0.46, 0.62, 0.82), vec3(0.10, 0.20, 0.42), smoothstep(-0.08, 0.55, rd.y));
  vec3 col = skyCol;

  // Raymarch heightfield terrain
  float t = 0.2;
  bool hit = false;
  for (int i = 0; i < 80; i++) {
    vec3 p = ro + rd * t;
    float h = terrainH(p.xz);
    float d = p.y - h;
    if (d < 0.008 * t) { hit = true; break; }
    t += max(d * 0.55, 0.035);
    if (t > 26.0) break;
  }

  if (hit) {
    vec3 p = ro + rd * t;
    vec3 n = terrainNormal(p.xz);
    vec3 lDir = normalize(vec3(0.62, 0.68, 0.40));
    float diff = max(dot(n, lDir), 0.0);

    // Clipmap center anchored on camera XZ footprint: Chebyshev L-infinity square rings!
    vec2 rel = abs(p.xz - ro.xz) / ringScale;
    float cheb = max(rel.x, rel.y);
    float contLvl = max(log2(max(cheb * 0.48, 0.5)), 0.0);
    float lvl = floor(contLvl);
    float ringFrac = fract(contLvl);

    // Doubling grid cell spacing per clipmap level: 2^lvl * baseSpacing
    float spacing = 0.18 * pow(2.0, min(lvl, 5.0)) * ringScale;
    vec2 gUV = p.xz / spacing;
    vec2 gf = abs(fract(gUV - 0.5) - 0.5);
    float wire = smoothstep(0.075, 0.015, min(gf.x, gf.y));
    // Diagonal triangle split edge inside each clipmap quad
    float diag = smoothstep(0.06, 0.012, abs(fract(gUV.x + gUV.y) - 0.5));
    wire = max(wire, diag * 0.45);

    // Highlight concentric square ring transition morph band (outer 15% of each ring)
    float morphBand = smoothstep(0.82, 0.96, ringFrac);
    float ringSeam = smoothstep(0.04, 0.008, abs(ringFrac - 0.98));

    // Natural alpine coloring (valley forest -> rock -> snow peaks)
    float snow = smoothstep(0.08, 0.36, p.y) * smoothstep(0.45, 0.78, n.y);
    vec3 ground = mix(vec3(0.16, 0.28, 0.18), vec3(0.38, 0.35, 0.32), smoothstep(-0.22, 0.16, p.y));
    ground = mix(ground, vec3(0.92, 0.95, 0.98), snow);
    vec3 litTerrain = ground * (0.24 + 0.92 * diff) + vec3(0.12, 0.20, 0.34) * (0.5 + 0.5 * n.y) * 0.28;

    if (!isLit) {
      // Left: nested clipmap LOD rings color-coded with doubling grid resolution & morph bands
      vec3 ringCol = lodPalette(lvl);
      vec3 nextCol = lodPalette(lvl + 1.0);
      vec3 lodMix = mix(ringCol, nextCol, morphBand * 0.65);
      col = mix(litTerrain * 0.42, lodMix * (0.35 + 0.75 * diff), 0.74);
      col = mix(col, vec3(0.03, 0.05, 0.09), wire * 0.68 * min(wireGain, 1.2));
      col = mix(col, vec3(1.0, 0.98, 0.85), ringSeam * 0.85);
    } else {
      // Right: seamless shaded terrain with subtle morph-band wireframe hint
      col = litTerrain;
      col = mix(col, vec3(0.10, 0.16, 0.24), wire * 0.12 * min(wireGain, 1.0));
    }

    float fog = 1.0 - exp(-t * t * 0.0045);
    col = mix(col, skyCol, clamp(fog, 0.0, 0.88));
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.97, 1.0), sep);

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index.

## Lineage

- extended by [CDLOD terrain](https://texelatlas.vercel.app/t/cdlod-terrain.md)

## Combines with

- [Sparse virtual texturing](https://texelatlas.vercel.app/t/virtual-texturing.md): Clipmap rings give a camera-centered mesh whose color and normals come from a streamed virtual texture.

## Combination ideas

- [Mesh-shader amplified geometry clipmaps with zero CPU draw calls](https://texelatlas.vercel.app/ideas/clipmap-terrain-mesh-shaders/)

## Sources

1. [primary] Frank Losasso, Hugues Hoppe (2004) Geometry clipmaps. ACM Transactions on Graphics. https://doi.org/10.1145/1015706.1015799 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Geometry clipmaps." https://texelatlas.vercel.app/t/geometry-clipmaps-terrain/ (accessed 2026-12-01).
