---
id: "geometry-images"
title: "Geometry Images"
domain: "geometry"
stage: "geometry"
realtime: "interactive"
platforms: [cpu, webgl2, webgpu, desktop-gpu]
year_introduced: 2002
inputs: [mesh]
outputs: [texture, uv-atlas]
style: "both"
dynamic: "static"
cost: "interactive"
authority: "Gu et al., 2002"
url: "https://texelatlas.vercel.app/t/geometry-images/"
sources_verified_at: "2026-11-29"
---
# Geometry Images (Gu et al., 2002)

> Cuts a mesh into a single disc, parametrizes it onto a square, and stores x, y, z as three colour channels of an ordinary image. The geometry becomes a texture that GPUs filter, compress and tessellate naturally.

## Reach for it when

- want mesh geometry stored as a regular texture
- need lod through mipmaps on geometry
- neural surface needs a regular grid representation
- stream and compress meshes like ordinary images

## How it works

Choose a cut graph that turns the surface into a topological disc, e.g. by shortest paths between handles after removing triangles until only a tree remains. Parametrize the disc onto a square so that the boundary maps to the border with matching sample points on the two sides of every seam. Then resample the surface on a regular grid in parameter space and store positions in a floating-point image, along with normals in a second one. The grid structure gives a mesh implicitly (connect neighbours), with no index buffer. Because the seams are consistent, 'zippering' the border samples makes the surface watertight. Standard image tools apply: mipmaps give levels of detail, compression gives mesh compression, and displacement-map-like editing works on the geometry directly.

## When to use it

Choose it for regular, GPU-friendly meshes: LOD via mipmaps, streaming, compression research and neural surface representations that need a regular grid. Prefer [xatlas](https://texelatlas.vercel.app/t/xatlas.md) or [Least Squares Conformal Maps](https://texelatlas.vercel.app/t/lscm-uv-unwrapping.md) when you want a conventional UV atlas for texturing a retained mesh, and [Quadric Error Metric Simplification](https://texelatlas.vercel.app/t/qem-mesh-simplification.md) for LODs of an irregular mesh.

## Cost

interactive — Parametrization and resampling are offline; rendering is a regular grid draw call.
Measured GPU Weight: 13.87× baseline (moderate) — 0.43 ms median / 0.4543 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 10.1× baseline (moderate) — 0.1606 ms median (2.68× faster on L4).
Ampere A100 scaling: 8.1× baseline (moderate) — 0.2333 ms median (1.84× faster on A100).

## Failure modes

- Seam artifacts and cracks where mip levels or filtering break the boundary correspondence
- Stretching in the parameter domain undersamples regions of high detail
- Single-chart parametrization of high-genus shapes is hard and distorts heavily
- Bilinear filtering of positions mixes across seams unless borders are handled

## Dataflow

- Inputs: mesh
- Outputs: texture, uv-atlas
- Platforms: cpu, webgl2, webgpu, desktop-gpu

## Presets

### Geometry Images — 2D square RGB=[X,Y,Z] atlas (left) vs reconstructed 3D surface & cut seam (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_GRID_RES": 12,
  "P_SEAM_VIS": 1,
  "P_ROT_SPEED": 0.75,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_GRID_RES = 12.0; // P Regular Grid N [6.0, 24.0, 2.0]
const float P_SEAM_VIS = 1.0; // P Cut Seam Highlight [0.0, 1.5, 0.05]
const float P_ROT_SPEED = 0.75; // P Spin Speed [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P 2D Atlas / 3D Mesh [0.0, 1.0, 0.02]

mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }

// Octahedral geometry-image bijection: 2D square [0,1]^2 <-> 3D unit sphere S^2 (Gu-Gortler-Hoppe!)
vec3 octDecode(vec2 uv01) {
  vec2 f = uv01 * 2.0 - 1.0;
  vec3 n = vec3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));
  float t = max(-n.z, 0.0);
  n.x += (n.x >= 0.0) ? -t : t;
  n.y += (n.y >= 0.0) ? -t : t;
  return normalize(n);
}

vec2 octEncode(vec3 n) {
  n /= max(abs(n.x) + abs(n.y) + abs(n.z), 1e-5);
  if (n.z < 0.0) {
    vec2 sgn = vec2((n.x >= 0.0) ? 1.0 : -1.0, (n.y >= 0.0) ? 1.0 : -1.0);
    n.xy = (1.0 - abs(n.yx)) * sgn;
  }
  return n.xy * 0.5 + 0.5;
}

// Sculpted genus-0 organic displacement encoded into the Geometry Image RGB = (x, y, z)
vec3 evalSurfacePoint(vec3 dir) {
  float disp = 0.68 + 0.14 * sin(dir.x * 4.2) * cos(dir.y * 4.2) + 0.09 * sin(dir.z * 5.5);
  return dir * disp;
}

float mapShape(vec3 p, float spin) {
  vec3 q = p;
  q.xz = rot2(spin * 0.65) * q.xz;
  q.yz = rot2(0.35) * q.yz;
  float r = length(q);
  vec3 d = q / max(r, 1e-5);
  float targetR = length(evalSurfacePoint(d));
  return (r - targetR) * 0.72;
}

vec3 calcNormal(vec3 p, float spin) {
  vec2 e = vec2(0.0022, 0.0);
  return normalize(vec3(
    mapShape(p + e.xyy, spin) - mapShape(p - e.xyy, spin),
    mapShape(p + e.yxy, spin) - mapShape(p - e.yxy, spin),
    mapShape(p + e.yyx, spin) - mapShape(p - e.yyx, spin)
  ));
}

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;
  vec2 uv01 = fragCoord / max(iResolution.xy, vec2(1.0));
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool is3D = uv01.x >= split;
  float gridN = clamp(floor(P_GRID_RES + 0.5), 6.0, 26.0);
  float seamVis = clamp(P_SEAM_VIS, 0.0, 1.5);
  float spin = iTime * max(P_ROT_SPEED, 0.0);

  vec3 col = mix(vec3(0.026, 0.036, 0.058), vec3(0.068, 0.088, 0.138), smoothstep(-0.55, 0.55, uv.y));

  if (!is3D) {
    // Left: 2D square Geometry Image texture where RGB encodes 3D vertex positions (x, y, z)
    float panelCX = split * 0.5 * (iResolution.x / max(iResolution.y, 1.0));
    vec2 rel = vec2((uv01.x - split * 0.5) * (iResolution.x / max(iResolution.y, 1.0)), uv.y);
    vec2 gUV = rel / 0.72 + 0.5;

    if (gUV.x >= 0.0 && gUV.x <= 1.0 && gUV.y >= 0.0 && gUV.y <= 1.0) {
      vec3 dir = octDecode(gUV);
      vec3 pos3D = evalSurfacePoint(dir);
      // Map XYZ coordinates [-0.9, 0.9] -> [0, 1] RGB channels (exact Geometry Image encoding)
      vec3 rgbPos = clamp(pos3D * 0.55 + 0.5, 0.0, 1.0);

      // Regular 2D square sampling lattice (completely regular topology!)
      vec2 gf = abs(fract(gUV * gridN - 0.5) - 0.5);
      float gWire = smoothstep(0.055, 0.012, min(gf.x, gf.y));
      col = mix(rgbPos, vec3(0.04, 0.06, 0.10), gWire * 0.52);

      // Outer cut-seam boundary (the 4 edges of the square glue symmetrically onto the 3D cut tree!)
      float bdr = min(min(gUV.x, 1.0 - gUV.x), min(gUV.y, 1.0 - gUV.y));
      col = mix(col, vec3(1.0, 0.88, 0.28), smoothstep(0.024, 0.005, bdr) * min(seamVis, 1.0));
    }
  } else {
    // Right: Reconstructed 3D surface sampled from the regular 2D Geometry Image grid
    vec2 rightUV = vec2((uv01.x - (split + 1.0) * 0.5) * (iResolution.x / max(iResolution.y, 1.0)), uv.y);
    vec3 ro = vec3(0.0, 0.04, 2.38);
    vec3 rd = normalize(vec3(rightUV, -1.52));

    float t = 0.0;
    bool hit = false;
    for (int i = 0; i < 64; i++) {
      float d = mapShape(ro + rd * t, spin);
      if (d < 0.002) { hit = true; break; }
      t += d;
      if (t > 7.0) break;
    }

    if (hit) {
      vec3 p = ro + rd * t;
      vec3 n = calcNormal(p, spin);

      vec3 objP = p;
      objP.xz = rot2(spin * 0.65) * objP.xz;
      objP.yz = rot2(0.35) * objP.yz;
      vec2 gUV = octEncode(normalize(objP));

      // Regular quad mesh reconstructed directly from the 2D Geometry Image pixels
      vec2 gf = abs(fract(gUV * gridN - 0.5) - 0.5);
      float gWire = smoothstep(0.060, 0.014, min(gf.x, gf.y));
      // Highlight the 3D cut seam (where gUV hits 0 or 1 boundary of the square)
      float bdr = min(min(gUV.x, 1.0 - gUV.x), min(gUV.y, 1.0 - gUV.y));
      float seamLine = smoothstep(0.025, 0.005, bdr);

      vec3 l1 = normalize(vec3(0.58, 0.82, 0.55));
      float diff = max(dot(n, l1), 0.0);
      float spec = pow(max(dot(n, normalize(l1 - rd)), 0.0), 42.0);
      vec3 rgbPos = clamp(objP * 0.55 + 0.5, 0.0, 1.0);
      vec3 alb = mix(vec3(0.76, 0.80, 0.86), rgbPos, 0.62);

      col = alb * (0.28 + 0.82 * diff) + vec3(0.95) * spec * 0.45;
      col = mix(col, vec3(0.04, 0.07, 0.12), gWire * 0.55);
      col = mix(col, vec3(1.0, 0.88, 0.28), seamLine * 0.92 * min(seamVis, 1.2));
    }
  }

  float sep = smoothstep(0.0035, 0.0008, abs(uv01.x - 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.

## Combines with

- [Least Squares Conformal Maps](https://texelatlas.vercel.app/t/lscm-uv-unwrapping.md): A conformal or stretch-minimising parametrization places the chart on the square.

## Sources

1. [primary] Xianfeng Gu, Steven J. Gortler, Hugues Hoppe (2002) Geometry images. Proceedings of the 29th annual conference on Computer graphics and interactive techniques. https://doi.org/10.1145/566570.566589 (verified via crossref on 2026-11-29)

## Cite this entry

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