Surface Nets
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.
In the family Geometry, meshing & signed distance fields, isosurface extraction
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
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 choose it
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
Choose it for voxel terrain, smooth sculpting and fast chunked meshing where speed and tidy triangles matter more than sharp edges. Prefer Dual Contouring when you need crisp corners (add normals and a QEF), Marching Cubes when a well-known lookup-table implementation or GPU compaction path is already in hand.
Field marks
- 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
Presets
Toy 2D surface nets: mean-of-crossings cell vertices joined into a contour
{
"CELLS": 9
}Show GLSL (48 lines)
// 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
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| surface-nets-specimen | Tesla T4 1920x1080 | 19.6× baseline (moderate) · 0.645 ms / 0.729 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| surface-nets-specimen | NVIDIA L4 1920x1080 | 18.9× baseline (moderate) · 0.300 ms / 0.323 ms · 2.1× faster on L4 | opengl-timer-query · Cross-architecture validation |
| surface-nets-specimen | NVIDIA A100-SXM4-40GB 1920x1080 | 12.5× baseline (moderate) · 0.359 ms / 0.386 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Taubin Smoothing: Optional post-relaxation without shrinkage for binary-segmentation input.
Sources
- primarySarah F. F. Gibson (1998). Constrained elastic surface nets: Generating smooth surfaces from binary segmented data. Lecture Notes in Computer Science.Verified via crossref · 2026-11-29doi:10.1007/bfb0056277
- tutorialMikola Lysenko. Smooth Voxel Terrain (Part 2). 0fps.net.Verified via live page · 2026-11-29
- implementationmikolalysenko (2013). mikolalysenko/isosurface. Isosurface polygonizer algorithmsGitHub API · license MIT · 2026-11-29