Texel A field guide to 3D techniques

NeuS × Extended Position-Based Dynamics

Deformable XPBD soft bodies carved straight from NeuS captures. Objects reconstructed as watertight neural signed distance fields via NeuS become immediately squishy, tearable, or elastic XPBD soft bodies without manual retopology or hand-authored collision cages.

Open in StudioReproduced36.8× · 1.14 ms

NeuSCapture · Offlinein: photos, camera-posesout: sdf, meshcompositeExtended Position-Based DynamicsSimulation · Real-timein: particlesout: particles, mesh

Verified proof

reproduced · 2026-12-01texel-lablicense MIT
Specimen render of NeuS SDF + XPBD soft bodies (left: rigid static NeuS capture, right: volume-preserving XPBD elastic squash)
Cross-proof specimen. NeuS SDF + XPBD soft bodies (left: rigid static NeuS capture, right: volume-preserving XPBD elastic squash). Verified WebGL2 proof · 2026-12-01

Split-screen WebGL2 proof comparing a static rigid NeuS-reconstructed neural SDF figurine (left) against an interior tetrahedralized XPBD soft body carved directly from the NeuS SDF with volume-preserving Neo-Hookean squash, jiggle, and ground-plane contact deformation (right).

Chromium Headless ANGLE/SwiftShader WebGL2 · 512x512 · converts a watertight NeuS neural SDF directly into a volume-preserving elastic XPBD soft body with interactive compliance and ground contact

Show GLSL proof (155 lines)
const float P_COMPLIANCE = 0.85; // P XPBD Softness [0.1, 1.6, 0.05]
const float P_VOL_KEEP = 0.95; // P Volume Conservation [0.2, 1.2, 0.05]
const float P_TET_LATTICE = 0.35; // P Interior Tet Cage [0.0, 1.0, 0.05]
const float P_BOUNCE_HZ = 1.00; // P Drop Frequency [0.3, 1.8, 0.05]

float smin(float a, float b, float k) {
  float h = clamp(0.5 + 0.5 * (b - a) / max(k, 1e-5), 0.0, 1.0);
  return mix(b, a, h) - k * h * (1.0 - h);
}

// Watertight NeuS-reconstructed organic gourd-duck sculpture SDF
float neusSDF(vec3 p) {
  float body = length((p - vec3(0.0, -0.14, 0.0)) * vec3(0.95, 1.05, 0.88)) - 0.52;
  float neck = length((p - vec3(0.0, 0.36, 0.08)) * vec3(1.18, 1.0, 1.12)) - 0.34;
  float crest = length((p - vec3(0.0, 0.58, 0.28)) * vec3(1.65, 1.85, 1.15)) - 0.17;
  float tail = length((p - vec3(0.0, 0.05, -0.48)) * vec3(1.35, 1.55, 0.95)) - 0.22;
  float d = smin(body, neck, 0.14);
  d = smin(d, crest, 0.08);
  d = smin(d, tail, 0.12);
  // Subtle captured organic ribs from multi-view NeuS geometry
  float a = atan(p.z, p.x);
  d += 0.012 * sin(a * 6.0) * smoothstep(-0.5, 0.1, p.y) * smoothstep(0.5, 0.0, p.y);
  return d;
}

// Inverse XPBD Neo-Hookean deformation mapping world point p back into rest NeuS SDF coordinates
vec3 invXPBDWarp(vec3 p, float t, out float strainEnergy) {
  float phase = t * 2.4 * P_BOUNCE_HZ;
  float bounce = abs(sin(phase));
  float floorY = -0.78;
  // Lift center during airborne phase, compress into floor during contact phase
  float lift = bounce * 0.46;
  float impact = pow(1.0 - bounce, 2.6) * P_COMPLIANCE;
  float ringOsc = sin(phase * 3.0) * exp(-bounce * 2.4) * 0.14 * P_COMPLIANCE;

  vec3 q = p - vec3(0.0, floorY + 0.60 + lift - impact * 0.18, 0.0);
  // Vertical squash lambda_y < 1 matched by radial Neo-Hookean bulge lambda_xz = 1/sqrt(lambda_y)
  float hWeight = clamp((0.65 - q.y) * 0.85, 0.15, 1.0);
  float lamY = clamp(1.0 - (impact * 0.36 + ringOsc * 0.25) * hWeight, 0.54, 1.25);
  float lamXZ = mix(1.0, 1.0 / sqrt(max(lamY, 0.35)), P_VOL_KEEP);
  // Phase-lagged elastic shear wave travelling up the neck
  float shearX = sin(phase * 2.0 - q.y * 2.6) * (0.14 * impact + 0.06 * P_COMPLIANCE) * smoothstep(-0.5, 0.55, q.y);
  q.x -= shearX;
  q.y /= lamY;
  q.xz /= lamXZ;
  strainEnergy = clamp(abs(1.0 - lamY) * 2.8 + abs(shearX) * 2.2, 0.0, 1.0);
  return q;
}

float mapFigurine(vec3 p, float t, bool useXPBD, out vec3 restP, out float strain) {
  if (!useXPBD) {
    // Left baseline: rigid static NeuS capture translating without elastic deformation
    float phase = t * 2.4 * P_BOUNCE_HZ;
    float lift = abs(sin(phase)) * 0.46;
    restP = p - vec3(0.0, -0.18 + lift, 0.0);
    strain = 0.0;
    return neusSDF(restP);
  } else {
    restP = invXPBDWarp(p, t, strain);
    return neusSDF(restP) * 0.72;
  }
}

vec3 calcNormal(vec3 p, float t, bool useXPBD) {
  vec2 e = vec2(0.003, -0.003);
  vec3 rp; float st;
  return normalize(
    e.xyy * mapFigurine(p + e.xyy, t, useXPBD, rp, st) +
    e.yyx * mapFigurine(p + e.yyx, t, useXPBD, rp, st) +
    e.yxy * mapFigurine(p + e.yxy, t, useXPBD, rp, st) +
    e.xxx * mapFigurine(p + e.xxx, t, useXPBD, rp, st)
  );
}

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 res = max(iResolution.xy, vec2(1.0));
  vec2 uvN = fragCoord / res;
  float splitX = iMouse.z > 0.0 ? clamp(iMouse.x / res.x, 0.05, 0.95) : 0.5;
  bool useXPBD = uvN.x > splitX;

  vec2 p = (fragCoord - 0.5 * res) / res.y;
  float t = iTime;
  float camA = 0.35 * sin(t * 0.32) + 0.38;
  vec3 ro = vec3(sin(camA) * 2.65, 0.42, cos(camA) * 2.65);
  vec3 ta = vec3(0.0, -0.10, 0.0);
  vec3 fw = normalize(ta - ro);
  vec3 ri = normalize(cross(vec3(0.0, 1.0, 0.0), fw));
  vec3 up = cross(fw, ri);
  vec3 rd = normalize(fw * 1.65 + ri * p.x + up * p.y);

  vec3 bg = mix(vec3(0.07, 0.09, 0.13), vec3(0.16, 0.21, 0.29), clamp(p.y + 0.55, 0.0, 1.0));
  vec3 col = bg;
  vec3 L = normalize(vec3(0.62, 0.84, 0.44));

  // Studio floor at y = -0.78
  float tFloor = (-0.78 - ro.y) / (abs(rd.y) < 1e-5 ? 1e-5 : rd.y);
  float maxD = 12.0;
  if (tFloor > 0.01 && rd.y < -0.005) {
    maxD = min(maxD, tFloor);
    vec3 fp = ro + rd * tFloor;
    float chk = mod(floor(fp.x * 2.5) + floor(fp.z * 2.5), 2.0);
    vec3 fAlb = mix(vec3(0.22, 0.24, 0.28), vec3(0.32, 0.34, 0.38), chk);
    float ao = smoothstep(0.18, 1.15, length(fp.xz));
    col = mix(fAlb * (0.35 + 0.65 * ao), bg, 1.0 - exp(-tFloor * 0.14));
  }

  float d = 0.0;
  bool hit = false;
  vec3 hitRest = vec3(0.0);
  float hitStrain = 0.0;
  for (int i = 0; i < 68; i++) {
    vec3 rp; float st;
    float h = mapFigurine(ro + rd * d, t, useXPBD, rp, st);
    if (h < 0.002) {
      hit = true;
      hitRest = rp;
      hitStrain = st;
      break;
    }
    d += max(h, 0.006);
    if (d > maxD) break;
  }

  if (hit) {
    vec3 wp = ro + rd * d;
    vec3 N = calcNormal(wp, t, useXPBD);
    vec3 V = -rd;
    float ndl = max(dot(N, L), 0.0);
    float wrap = clamp((dot(N, L) + 0.35) / 1.35, 0.0, 1.0);
    float fres = 0.05 + 0.95 * pow(1.0 - max(dot(N, V), 0.0), 3.6);
    float spec = pow(max(dot(N, normalize(L + V)), 0.0), 56.0);

    // NeuS captured glazed ceramic/silicone albedo with subtle painted stripes
    float band = smoothstep(0.45, 0.55, sin(hitRest.y * 14.0) * 0.5 + 0.5);
    vec3 alb = mix(vec3(0.86, 0.62, 0.24), vec3(0.24, 0.56, 0.68), band * 0.45);
    if (useXPBD) {
      // Subtle elastic strain warmth + interior BCC tetrahedral lattice lines
      alb = mix(alb, vec3(0.95, 0.36, 0.26), hitStrain * 0.32);
      vec3 q = hitRest * 7.5;
      vec3 f = fract(q);
      float tetD = min(min(min(f.x, 1.0 - f.x), min(f.y, 1.0 - f.y)), min(abs(f.x - f.y), abs(f.y - f.z)) * 0.7071);
      float wire = smoothstep(0.055, 0.014, tetD);
      alb = mix(alb, vec3(0.92, 0.98, 1.0), wire * P_TET_LATTICE * 0.65);
    }
    col = alb * (vec3(0.18, 0.22, 0.30) + vec3(1.18, 1.06, 0.92) * wrap) + vec3(1.0, 0.96, 0.92) * (spec * 0.58 + fres * 0.28);
  }

  col = acesTone(col * 1.08);
  if (abs(fragCoord.x - splitX * res.x) < 1.0) 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

NeuS outputs a continuous neural sdf and an extracted watertight surface mesh from multi-view images. The hop to Extended Position-Based Dynamics is composite: sample the interior region where sdf < 0 on a body-centered cubic lattice to generate tetrahedral elements and simulation particles, assign inverse masses proportional to local cell volume, and bind the extracted NeuS surface vertices to enclosing tetrahedra via barycentric coordinates. At runtime, Extended Position-Based Dynamics projects distance and neo-Hookean volume-preservation constraints every substep and warps the visual surface mesh smoothly.

How to build it

Offline or during asset load, evaluate the NeuS SDF on a regular 3D grid, extract the zero-level isosurface, and keep interior grid points with sdf < -h as tetrahedral mesh vertices (or subdivide occupied cubes into 5-tet stencils). Store per-particle position, previous position, inverse mass, and rest-volume tetrahedron indices in flat buffers or float textures. Each frame run 4-8 XPBD substeps solving edge-stretch and tetrahedral volume constraints with compliance alpha = 1 / (k * dt^2) while resolving ground/obstacle collisions directly via SDF gradient queries. Skin the high-resolution NeuS surface vertices from their parent tetrahedron's deformed frame.

Field marks

  1. Thin appendages in the NeuS SDF can fall below the tetrahedral grid spacing and disconnect into floating simulation islands.
  2. Large aspect-ratio boundary tetrahedra invert easily under impact unless positive-volume clamping and substepping are enforced.
  3. Baked view-dependent highlights in the NeuS appearance field stay frozen on the deforming mesh unless shading is decoupled from static view directions.
  4. High-resolution tetrahedral lattices scale cubically in constraint count and quickly saturate mobile or WebGL2 vertex-update budgets.

Prior art

No prior art found on 2026-12-01.

Searches run (2)
  • arXiv: all:"NeuS" AND all:"XPBD"
  • GitHub repos: "NeuS" xpbd soft body