---
id: "surface-nets"
title: "Surface Nets"
domain: "geometry"
stage: "geometry"
realtime: "interactive"
platforms: [cpu, webgl2, webgpu, desktop-gpu, cuda, unity]
year_introduced: 1998
inputs: [voxels, sdf]
outputs: [mesh]
style: "both"
dynamic: "both"
cost: "cheap"
authority: "Gibson, 1998"
url: "https://texelatlas.vercel.app/t/surface-nets/"
sources_verified_at: "2026-11-29"
---
# Surface Nets (Gibson, 1998)

> A dual meshing method: one vertex per surface-crossing cell, placed at the average of that cell's edge crossings, with quads across sign-changing edges. Simple, fast, smooth, with better triangle quality than marching cubes.

## Reach for it when

- marching cubes gives ugly thin triangles
- smooth voxel terrain meshing at speed
- chunked meshing for sculpting tools
- need tidy quads from a scalar field
- simple fast isosurface extraction

## How it works

Find every cell whose corners have mixed signs. For each, compute the linearly interpolated crossing on each of its sign-changing edges and average them (the 'naive' variant) to get a single vertex. Then, for each grid edge that changes sign, connect the vertices of the four cells sharing that edge into a quad, oriented by the sign. The original paper starts from this net and relaxes it by moving vertices toward neighbour averages under a constraint that keeps each inside its cell. The result is a quad-dominant mesh with roughly regular valence and no sliver triangles, built with a simple two-pass loop and no lookup table.

## When to use it

Choose it for voxel terrain, smooth sculpting and fast chunked meshing where speed and tidy triangles matter more than sharp edges. Prefer [Dual Contouring](https://texelatlas.vercel.app/t/dual-contouring.md) when you need crisp corners (add normals and a QEF), [Marching Cubes](https://texelatlas.vercel.app/t/marching-cubes.md) when a well-known lookup-table implementation or GPU compaction path is already in hand.

## Cost

cheap — Two linear passes over cells and no table lookups; usually the cheapest grid mesher in practice.
Measured GPU Weight: 19.62× baseline (moderate) — 0.6454 ms median / 0.7286 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 18.86× baseline (moderate) — 0.2999 ms median (2.15× faster on L4).
Ampere A100 scaling: 12.47× baseline (moderate) — 0.3591 ms median (1.8× faster on A100).

## Failure modes

- Corners and creases get rounded because vertices sit at crossing averages
- Thin features one voxel wide can collapse or leave holes
- Quads may be non-planar, so triangulating along the wrong diagonal gives faceting
- Minor vertex shrinkage on convex regions versus the true surface

## Dataflow

- Inputs: voxels, sdf
- Outputs: mesh
- Platforms: cpu, webgl2, webgpu, desktop-gpu, cuda, unity

## Presets

### Toy 2D surface nets: mean-of-crossings cell vertices joined into a contour (glsl-fragment; rendered 2026-11-29)

```json
{
  "CELLS": 9
}
```

```glsl
// Toy 2D surface nets: one vertex per mixed cell at the mean of its edge crossings, joined across shared crossing edges.
const float CELLS = 9.0;
float field(vec2 p) {
    vec2 q = abs(p - 0.5) - vec2(0.27, 0.19 + 0.04 * sin(iTime));
    return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - 0.07;
}
float segd(vec2 p, vec2 a, vec2 b) {
    vec2 pa = p - a, ba = b - a;
    return length(pa - ba * clamp(dot(pa, ba) / max(dot(ba, ba), 1e-6), 0.0, 1.0));
}
// vertex of cell (i,j); w = 0 when the cell is not mixed
vec3 vtx(vec2 ij, float cs) {
    vec2 c0 = ij * cs;
    vec2 P[4]; float F[4];
    P[0] = c0; P[1] = c0 + vec2(cs, 0); P[2] = c0 + cs; P[3] = c0 + vec2(0, cs);
    for (int i = 0; i < 4; i++) F[i] = field(P[i]);
    vec2 s = vec2(0); float n = 0.0;
    for (int i = 0; i < 4; i++) {
        int j = (i + 1) % 4;
        if ((F[i] > 0.0) != (F[j] > 0.0)) { s += mix(P[i], P[j], F[i] / (F[i] - F[j])); n += 1.0; }
    }
    return n > 0.0 ? vec3(s / n, 1.0) : vec3(0.0);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    float cs = 1.0 / CELLS;
    vec2 cell = floor(uv / cs);
    float dl = 1e9, dv = 1e9;
    for (int j = -1; j <= 1; j++) for (int i = -1; i <= 1; i++) {
        vec2 ij = cell + vec2(i, j);
        vec3 v = vtx(ij, cs);
        if (v.z == 0.0) continue;
        dv = min(dv, length(uv - v.xy));
        vec3 vr = vtx(ij + vec2(1, 0), cs), vu = vtx(ij + vec2(0, 1), cs);
        vec2 e1 = (ij + vec2(1, 0)) * cs, e2 = e1 + vec2(0, cs);
        if (vr.z > 0.0 && (field(e1) > 0.0) != (field(e2) > 0.0)) dl = min(dl, segd(uv, v.xy, vr.xy));
        vec2 f1 = (ij + vec2(0, 1)) * cs, f2 = f1 + vec2(cs, 0);
        if (vu.z > 0.0 && (field(f1) > 0.0) != (field(f2) > 0.0)) dl = min(dl, segd(uv, v.xy, vu.xy));
    }
    float f = field(uv);
    vec3 col = vec3(0.07, 0.08, 0.11) + (f < 0.0 ? vec3(0.06, 0.1, 0.16) : vec3(0.0));
    vec2 g = abs(fract(uv / cs) - 0.5);
    col = mix(col, vec3(0.22, 0.24, 0.32), smoothstep(0.02, 0.0, 0.5 - max(g.x, g.y)));
    col = mix(col, vec3(0.95, 0.75, 0.3), smoothstep(0.005, 0.003, dl));
    col = mix(col, vec3(0.35, 0.9, 1.0), smoothstep(0.012, 0.009, dv));
    fragColor = vec4(pow(col, vec3(0.8)), 1.0);
}

```

Attribution: written for this index

## Combines with

- [Taubin Smoothing](https://texelatlas.vercel.app/t/taubin-smoothing.md): Optional post-relaxation without shrinkage for binary-segmentation input.

## Sources

1. [primary] Sarah F. F. Gibson (1998) Constrained elastic surface nets: Generating smooth surfaces from binary segmented data. Lecture Notes in Computer Science. https://doi.org/10.1007/bfb0056277 (verified via crossref on 2026-11-29)
2. [tutorial] Mikola Lysenko Smooth Voxel Terrain (Part 2). 0fps.net. https://0fps.net/2012/07/12/smooth-voxel-terrain-part-2 (verified via http on 2026-11-29)
3. [implementation] mikolalysenko (2013) mikolalysenko/isosurface. https://github.com/mikolalysenko/isosurface License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Surface Nets." https://texelatlas.vercel.app/t/surface-nets/ (accessed 2026-12-01).
