DeepSDF (neural signed distance functions)
A network that takes a 3D point and a per-shape latent code and returns signed distance, so a whole shape category lives in one decoder and shapes are recovered by optimising their latent code.
Also known as DeepSDF, auto-decoder SDF, neural SDF
In the family Geometry, meshing & signed distance fields, learned implicit shapes
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 | Research method; no engine feature. |
| Blender 5.2 | None found | Research method; no Blender feature. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Train a single MLP f(z, x) whose output is the signed distance at point x for the shape described by code z. Training data is sampled SDF values near and far from each training shape's surface, with the output clamped near the surface to focus capacity. There is no encoder: every training shape owns a learnable latent vector, and codes and decoder weights are optimised together (an auto-decoder). At test time, with the weights fixed, you fit a new latent code by gradient descent so predicted distances match observed samples, which may be sparse or partial. Interpolating between codes morphs shapes. Extract the surface by evaluating on a grid and running Marching Cubes, or by sphere tracing the field. Shape completion from partial scans works because the decoder encodes a prior over plausible shapes.
When to choose it
Reach for it when
- want a neural network that outputs a shape from a latent code
- complete a partial scan into a full shape
- interpolate between two shapes smoothly
- learn a shape prior for a whole object category
Choose it as the reference design for learned SDF shape priors, shape completion from partial depth, and latent-space interpolation within a category. Prefer Poisson Surface Reconstruction when you have dense oriented points and no prior is wanted, NeuS or Neuralangelo when the supervision is multi-view photos, and Instant NGP (Multiresolution Hash Encoding)-style hash grids when a single scene must be fit fast rather than a category generalised.
Field marks
- Fine detail and thin structures are lost because one MLP and a small code must cover the whole category
- Out-of-category inputs decode to a blobby average shape
- Latent-code fitting on partial data has local minima and needs good initialisation
- The SDF is not guaranteed to be a true distance field, which breaks sphere-tracing step sizes and gradient-norm assumptions
Presets
DeepSDF Neural Implicit — latent-space shape interpolation & signed-distance iso-contour slice
{
"P_LATENT_Z": 0.5,
"P_SLICE_Y": -0.22,
"P_ISO_FREQ": 14,
"P_ROT_SPEED": 0.65
}Show GLSL (136 lines)
const float P_LATENT_Z = 0.50; // P Latent Code z [0.0, 1.0, 0.02]
const float P_SLICE_Y = -0.22; // P SDF Slice Height [-0.55, 0.45, 0.02]
const float P_ISO_FREQ = 14.0; // P Iso-Ring Density [6.0, 26.0, 1.0]
const float P_ROT_SPEED = 0.65; // P Spin Speed [0.0, 2.0, 0.05]
mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
float sdBox(vec3 p, vec3 b) {
vec3 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}
float sdTorus(vec3 p, vec2 t) {
vec2 q = vec2(length(p.xz) - t.x, p.y);
return length(q) - t.y;
}
// Latent-conditioned implicit shape f_theta(x, z) smoothly morphing across a 3-shape manifold
float evalDeepSDF(vec3 p, float zCode) {
// Shape 0: Chamfered architectural chair/frame
float dSeat = sdBox(p - vec3(0.0, -0.10, 0.0), vec3(0.42, 0.09, 0.42)) - 0.04;
float dBack = sdBox(p - vec3(0.0, 0.28, -0.34), vec3(0.42, 0.34, 0.08)) - 0.04;
float dLegs = sdBox(vec3(abs(p.x) - 0.32, p.y + 0.36, abs(p.z) - 0.32), vec3(0.07, 0.24, 0.07)) - 0.02;
float sChair = min(min(dSeat, dBack), dLegs);
// Shape 1: Smooth torus-sphere sculpture
float sTorus = min(sdTorus(p.xzy, vec2(0.42, 0.16)), length(p) - 0.26);
// Shape 2: Hollowed rounded cube with cylindrical cutouts
float sCube = max(sdBox(p, vec3(0.46)) - 0.06, -(min(min(length(p.xy), length(p.yz)), length(p.xz)) - 0.27));
float u = clamp(zCode, 0.0, 1.0) * 2.0;
float d = (u < 1.0) ? mix(sChair, sTorus, smoothstep(0.0, 1.0, u)) : mix(sTorus, sCube, smoothstep(0.0, 1.0, u - 1.0));
// Subtle neural MLP sinusoidal smoothness characteristic of continuous latent decoding
return d + 0.012 * sin(p.x * 7.0) * sin(p.y * 7.0) * sin(p.z * 7.0) * sin(zCode * 3.1415926);
}
vec3 calcNormal(vec3 p, float zCode, float spin) {
vec2 e = vec2(0.0022, 0.0);
vec3 qx1 = p + e.xyy; qx1.xz = rot2(spin) * qx1.xz;
vec3 qx0 = p - e.xyy; qx0.xz = rot2(spin) * qx0.xz;
vec3 qy1 = p + e.yxy; qy1.xz = rot2(spin) * qy1.xz;
vec3 qy0 = p - e.yxy; qy0.xz = rot2(spin) * qy0.xz;
vec3 qz1 = p + e.yyx; qz1.xz = rot2(spin) * qz1.xz;
vec3 qz0 = p - e.yyx; qz0.xz = rot2(spin) * qz0.xz;
return normalize(vec3(
evalDeepSDF(qx1, zCode) - evalDeepSDF(qx0, zCode),
evalDeepSDF(qy1, zCode) - evalDeepSDF(qy0, zCode),
evalDeepSDF(qz1, zCode) - evalDeepSDF(qz0, zCode)
));
}
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 spin = iTime * max(P_ROT_SPEED, 0.0) * 0.55;
// Blend user latent code with gentle automatic latent-space traversal
float zCode = clamp(fract(P_LATENT_Z + 0.18 * sin(iTime * 0.45)), 0.0, 1.0);
float sliceY = clamp(P_SLICE_Y, -0.58, 0.48);
float isoFreq = clamp(P_ISO_FREQ, 5.0, 28.0);
vec3 ro = vec3(0.0, 0.72, 2.38);
vec3 ta = vec3(0.0, -0.06, 0.0);
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.55 + right * uv.x + up * uv.y);
vec3 col = mix(vec3(0.024, 0.034, 0.056), vec3(0.070, 0.092, 0.144), smoothstep(-0.55, 0.55, uv.y));
// Intersect horizontal SDF iso-contour inspection plane at y = sliceY
float tPlane = (abs(rd.y) > 0.001) ? ((sliceY - ro.y) / rd.y) : 1e5;
if (tPlane < 0.0) tPlane = 1e5;
// Raymarch the zero-level set f_theta(x, z) = 0
float tHit = 0.0;
bool hitShape = false;
for (int i = 0; i < 68; i++) {
vec3 p = ro + rd * tHit;
vec3 q = p;
q.xz = rot2(spin) * q.xz;
float d = evalDeepSDF(q, zCode);
if (d < 0.002) { hitShape = true; break; }
tHit += d * 0.85;
if (tHit > 7.5) break;
}
// Render translucent SDF slice plane first if behind or intersecting
if (tPlane < 7.5 && (!hitShape || tPlane < tHit)) {
vec3 sp = ro + rd * tPlane;
if (length(sp.xz) < 1.38) {
vec3 sq = sp;
sq.xz = rot2(spin) * sq.xz;
float sdf = evalDeepSDF(sq, zCode);
// Classic positive (cool blue) / negative (warm orange) signed-distance contour map
vec3 sCol = (sdf > 0.0) ? vec3(0.14, 0.58, 0.92) : vec3(0.96, 0.44, 0.18);
sCol *= 0.82 - exp(-4.5 * abs(sdf)) * 0.42;
float rings = 0.72 + 0.28 * cos(sdf * isoFreq * 6.2831853);
sCol *= rings;
// Crisp white zero-level set contour f(x,z) = 0
sCol = mix(sCol, vec3(0.98, 0.99, 1.0), smoothstep(0.022, 0.004, abs(sdf)));
float diskMask = smoothstep(1.38, 1.24, length(sp.xz));
col = mix(col, sCol, diskMask * 0.78);
}
}
// Render neural implicit surface (above slice plane or in front of it)
if (hitShape) {
vec3 p = ro + rd * tHit;
vec3 n = calcNormal(p, zCode, spin);
vec3 l1 = normalize(vec3(0.55, 0.85, 0.52));
vec3 l2 = normalize(vec3(-0.70, -0.25, 0.48));
float diff = max(dot(n, l1), 0.0) * 0.85 + max(dot(n, l2), 0.0) * 0.26;
float spec = pow(max(dot(n, normalize(l1 - rd)), 0.0), 52.0);
float rim = pow(1.0 - max(dot(n, -rd), 0.0), 3.0);
vec3 alb = mix(vec3(0.24, 0.76, 0.86), vec3(0.88, 0.62, 0.96), zCode);
vec3 surfCol = alb * (0.24 + 0.85 * diff) + vec3(0.98) * spec * 0.58 + vec3(0.48, 0.80, 1.0) * rim * 0.34;
// Highlight intersection seam where slice plane cuts the zero-level surface
float cutRing = smoothstep(0.022, 0.004, abs(p.y - sliceY));
surfCol = mix(surfCol, vec3(1.0, 0.94, 0.46), cutRing * 0.90);
if (tPlane < tHit && length((ro + rd * tPlane).xz) < 1.38) {
col = mix(surfCol, col, 0.38);
} else {
col = surfCol;
}
}
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| deepsdf-neural-sdf-live | Tesla T4 1920x1080 | 27.6× baseline (heavy) · 0.854 ms / 0.873 ms | opengl-timer-query · 36 frames · GPU Weight Atlas · Colab T4 sweep |
| deepsdf-neural-sdf-live | NVIDIA L4 1920x1080 | 25.3× baseline (heavy) · 0.403 ms / 0.410 ms · 2.1× faster on L4 | opengl-timer-query · Cross-architecture validation |
| deepsdf-neural-sdf-live | NVIDIA A100-SXM4-40GB 1920x1080 | 17.3× baseline (moderate) · 0.497 ms / 0.510 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Screened Poisson Surface Reconstruction, Sphere Tracing; cited by DUSt3R, Large Reconstruction Model (LRM), MeshGPT, Mip-Splatting, Neural Radiance Fields (NeRF), NeuS, PolyGen autoregressive mesh generation, Shap-E, TexFusion, TRELLIS.2 (O-Voxel structured latents), TRELLIS (Structured 3D Latents), Zero-1-to-3.
Crosses
- Crack-free latent morphing via DeepSDF and Marching Tetrahedra: Interpolating latent shape codes inside a compact DeepSDF MLP and extracting the evolving zero level set with Marching Tetrahedra yields guaranteed watertight, ambiguity-free triangle meshes that morph smoothly across topological changes.
- Marching Cubes: Evaluating the decoder on a grid gives sampled distances that marching cubes turns into a triangle mesh.
Sources
- primaryJeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, Steven Lovegrove (2019). DeepSDF: Learning Continuous Signed Distance Functions for Shape Representation. arXiv preprint (cs.CV).Verified via arxiv · 2026-11-29arXiv:1901.05103
- implementationfacebookresearch (2019). facebookresearch/DeepSDF. Learning Continuous Signed Distance Functions for Shape RepresentationGitHub API · license MIT · archived · 2026-11-29