Texel A field guide to 3D techniques

Neuralangelo × NanoVDB × SDF Modeling: CSG and Smooth Minimum

Scanned objects as SDF primitives. Real objects captured as distance fields become primitives in a shader modeller: smooth-blend a scanned statue into procedural rock, carve it with booleans, bend or repeat it, and ray-march the result in real time.

Open in StudioReproduced36.8× · 1.14 ms

NeuralangeloCapture · Offlinein: photos, camera-posesout: sdf, meshsdfNanoVDBVolume · Real-timein: volume-density, sdfout: volume-density, sdfsdfSDF Modeling: CSG and Smooth MinimumGeometry · Real-timein: sdfout: sdf, normals

Verified proof

reproduced · 2026-12-01texel-lablicense MIT
Specimen render of Captured SDF sculpting (left: hard boolean CSG seam, right: narrow-band smooth-min CSG + blended triplanar scan texture)
Cross-proof specimen. Captured SDF sculpting (left: hard boolean CSG seam, right: narrow-band smooth-min CSG + blended triplanar scan texture). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing hard rigid boolean union/subtraction between a Neuralangelo-style captured sculptural bust and analytic geometric primitives (left, leaving harsh unblended seams and mismatched flat shading) against narrow-band NanoVDB-style SDF sculpting blended organically via polynomial smooth-min CSG with continuous triplanar texture blending across the melted bridge (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · demonstrates seamless C1-continuous organic sculpting between captured neural SDF geometry and analytic CSG primitives with blended triplanar albedo

Show GLSL proof (165 lines)
const float P_SMOOTH_K = 0.16; // P Smooth-Min Blend k [0.02, 0.34, 0.01]
const float P_CARVE_DEPTH = 1.00; // P Sculpt Carve Depth [0.2, 1.6, 0.05]
const float P_BAND_VIS = 0.35; // P Narrow-Band Grid [0.0, 1.0, 0.05]
const float P_ORBIT = 0.38; // P Turntable Speed [0.0, 1.2, 0.05]

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

// Polynomial smooth-min returning vec2(blendedDistance, materialBlendFactor)
vec2 sminBlend(float a, float b, float k) {
  float h = clamp(0.5 + 0.5 * (b - a) / max(k, 1e-4), 0.0, 1.0);
  return vec2(mix(b, a, h) - k * h * (1.0 - h), h);
}

// Captured Neuralangelo-like sculpted marble artifact SDF (fluted amphora/bust profile)
float capturedBustSDF(vec3 p) {
  float a = atan(p.z, p.x);
  float r = length(p.xz);
  // Classical lathe silhouette with fine captured surface ripples
  float profile = 0.32 + 0.12 * sin(p.y * 4.4 + 0.4) - 0.09 * p.y * p.y;
  float flutes = 0.024 * cos(a * 10.0 + p.y * 2.2) * smoothstep(0.55, 0.05, abs(p.y));
  float scanDetail = 0.009 * sin(p.x * 19.0 + p.y * 15.0) * cos(p.z * 17.0);
  float body = r - (profile + flutes + scanDetail);
  float caps = abs(p.y) - 0.62;
  return max(body, caps) * 0.82;
}

// Analytic sculpting primitives: tilted torus collar (union) + orbiting carving spheres (subtraction)
float sculptAddSDF(vec3 p, float t) {
  vec3 q = p - vec3(0.0, 0.08 * sin(t * 0.9), 0.0);
  q.xy *= rot2(0.52);
  vec2 tor = vec2(length(q.xz) - 0.44, q.y);
  return length(tor) - 0.11;
}

float sculptSubSDF(vec3 p, float t) {
  vec3 c1 = vec3(0.36 * cos(t * 0.7), 0.18, 0.36 * sin(t * 0.7));
  vec3 c2 = vec3(-0.34 * cos(t * 0.7), -0.22, -0.34 * sin(t * 0.7));
  float s1 = length(p - c1) - 0.22 * P_CARVE_DEPTH;
  float s2 = length(p - c2) - 0.20 * P_CARVE_DEPTH;
  return min(s1, s2);
}

// Returns vec2(sdf, materialBlend [0=captured marble, 1=analytic sculpted gold-terracotta])
vec2 mapSculpt(vec3 p, float t, bool useSmooth) {
  float dScan = capturedBustSDF(p);
  float dAdd = sculptAddSDF(p, t);
  float dSub = sculptSubSDF(p, t);
  if (!useSmooth) {
    float u = min(dScan, dAdd);
    float m = (dAdd < dScan) ? 1.0 : 0.0;
    float res = max(u, -dSub);
    if (-dSub > u) m = 0.5;
    return vec2(res, m);
  }
  vec2 u = sminBlend(dScan, dAdd, P_SMOOTH_K);
  // Smooth subtraction via negated smooth-min
  vec2 sub = sminBlend(-u.x, dSub, P_SMOOTH_K * 0.78);
  float matBlend = mix(1.0 - u.y, 0.65, clamp(1.0 - sub.y, 0.0, 0.55));
  return vec2(-sub.x, clamp(matBlend, 0.0, 1.0));
}

vec3 calcNormal(vec3 p, float t, bool useSmooth) {
  vec2 e = vec2(0.0025, -0.0025);
  return normalize(
    e.xyy * mapSculpt(p + e.xyy, t, useSmooth).x +
    e.yyx * mapSculpt(p + e.yyx, t, useSmooth).x +
    e.yxy * mapSculpt(p + e.yxy, t, useSmooth).x +
    e.xxx * mapSculpt(p + e.xxx, t, useSmooth).x
  );
}

// Triplanar projected captured Carrara marble texture
vec3 triplanarMarble(vec3 p, vec3 n) {
  vec3 w = pow(abs(n), vec3(4.0));
  w /= max(w.x + w.y + w.z, 1e-4);
  float vx = sin(p.y * 12.0 + 2.4 * sin(p.z * 7.5 + p.x * 4.0));
  float vy = sin(p.x * 12.0 + 2.4 * sin(p.z * 7.5 + p.y * 4.0));
  float vz = sin(p.x * 12.0 + 2.4 * sin(p.y * 7.5 + p.z * 4.0));
  float vein = abs(vx * w.x + vy * w.y + vz * w.z);
  vein = smoothstep(0.12, 0.92, vein);
  return mix(vec3(0.46, 0.49, 0.54), vec3(0.92, 0.90, 0.86), vein);
}

vec3 acesTone(vec3 x) {
  return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  bool useSmooth = uv.x > 0.0;
  vec2 suv = vec2(useSmooth ? (uv.x - 0.25) : (uv.x + 0.25), uv.y);
  suv.x *= 1.80;

  float ang = 0.55 + iTime * P_ORBIT;
  vec3 ro = vec3(sin(ang) * 2.25, 0.36, cos(ang) * 2.25);
  vec3 fwd = normalize(-ro);
  vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), fwd));
  vec3 up = cross(fwd, right);
  vec3 rd = normalize(fwd * 1.82 + right * suv.x + up * suv.y);

  vec3 bg = mix(vec3(0.055, 0.065, 0.088), vec3(0.14, 0.16, 0.21), clamp(suv.y + 0.55, 0.0, 1.0));
  vec3 col = bg;

  // Floor plinth plane at y = -0.66 with NanoVDB narrow-band distance iso-contours
  float tFloor = (-0.66 - ro.y) / min(rd.y, -1e-4);
  float bestT = 1e5;
  if (rd.y < -0.01 && tFloor > 0.0 && tFloor < 10.0) {
    bestT = tFloor;
    vec3 fp = ro + rd * tFloor;
    float dField = mapSculpt(fp, iTime, useSmooth).x;
    float iso = smoothstep(0.018, 0.002, abs(fract(dField * 8.0) - 0.5) / 8.0);
    float band = smoothstep(0.45, 0.05, abs(dField));
    vec3 floorCol = vec3(0.10, 0.11, 0.14) * exp(-length(fp.xz) * 0.28);
    if (useSmooth) {
      floorCol += vec3(0.18, 0.68, 0.88) * iso * band * P_BAND_VIS * 0.85;
    }
    float softSh = smoothstep(0.05, 0.55, length(fp.xz));
    col = floorCol * (0.45 + 0.55 * softSh);
  }

  // Raymarch captured SDF + CSG sculpt
  float t = 0.0;
  float matB = 0.0;
  bool hit = false;
  for (int i = 0; i < 64; i++) {
    vec2 r = mapSculpt(ro + rd * t, iTime, useSmooth);
    if (r.x < 0.0018) { hit = true; matB = r.y; break; }
    t += r.x * 0.82;
    if (t > min(bestT, 5.5)) break;
  }

  if (hit) {
    vec3 p = ro + rd * t;
    vec3 n = calcNormal(p, iTime, useSmooth);
    vec3 V = -rd;
    vec3 L1 = normalize(vec3(0.62, 0.75, 0.45));
    vec3 L2 = normalize(vec3(-0.68, 0.25, -0.52));

    vec3 marble = triplanarMarble(p, n);
    vec3 sculptMat = vec3(0.84, 0.42, 0.24);
    vec3 alb = mix(marble, sculptMat, matB);

    // Subtle NanoVDB voxel-leaf narrow-band contour lines along smooth-min fillet on right
    if (useSmooth && P_BAND_VIS > 0.02) {
      float seamZone = sin(matB * 3.14159265);
      float gridLines = smoothstep(0.92, 0.99, max(abs(sin(p.y * 42.0)), abs(sin(p.x * 42.0))));
      alb = mix(alb, vec3(0.28, 0.85, 0.96), seamZone * gridLines * P_BAND_VIS * 0.55);
    }

    float ao = clamp(mapSculpt(p + n * 0.07, iTime, useSmooth).x / 0.07, 0.22, 1.0);
    float ndl1 = max(dot(n, L1), 0.0);
    float ndl2 = max(dot(n, L2), 0.0);
    float spec = pow(max(dot(n, normalize(L1 + V)), 0.0), mix(36.0, 68.0, matB)) * 0.65;
    float rim = pow(1.0 - max(dot(n, V), 0.0), 3.2) * 0.32;
    col = alb * (vec3(1.45, 1.38, 1.28) * ndl1 + vec3(0.32, 0.48, 0.72) * ndl2 + vec3(0.18, 0.22, 0.28) * ao)
        + vec3(1.0, 0.96, 0.90) * spec + vec3(0.45, 0.68, 0.92) * rim;
  }

  col = acesTone(col);
  if (abs(uv.x) < 0.003) col = vec3(0.95, 0.93, 0.89);
  fragColor = vec4(pow(clamp(col, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}

Why they connect

Neuralangelo takes posed photos and outputs a neural sdf of the object. Sampling it into a narrow band gives a grid that NanoVDB takes as an sdf input and stores sparsely on the GPU, outputting the same sdf with fast hierarchical lookups. SDF Modeling: CSG and Smooth Minimum consumes that sdf like any analytic primitive: min, max and smooth-min combine it with spheres, boxes and noise, and the resulting sdf and normals go to a sphere tracer for display.

How to build it

Train Neuralangelo (or NeuS) on the capture, then evaluate its SDF on a narrow-band OpenVDB grid around the surface and convert it to NanoVDB. In a CUDA or Vulkan ray marcher, evaluate the grid with trilinear lookups; outside the band, return the distance to the grid's bounding box so steps stay safe. Combine with analytic primitives through smooth-min, using a step scale below one. Project the capture photos onto the surface (triplanar, or by nearest camera) for colour. Port the NanoVDB accessor to WGSL if a browser version is wanted.

Field marks

  1. Narrow-band fields are invalid far from the surface, so step lengths must be clamped.
  2. Smooth-min of sampled and analytic fields breaks the Lipschitz bound and causes missed hits.
  3. Neuralangelo's licence is non-commercial.
  4. The captured field carries no appearance, so colour must be added separately.

Prior art

No prior art found on 2026-11-29.

Searches run (4)
  • arXiv: all:"neural SDF" AND all:"sphere tracing" AND all:"CSG" → 0 results
  • GitHub repos: "neural SDF" "sphere tracing" CSG → 0 results
  • arXiv: all:"signed distance field" AND all:"smooth union" AND all:"reconstruction" → 0 results
  • GitHub repos: "signed distance field" "smooth union" reconstruction → 0 results