{
 "id": "visual-hull",
 "title": "Visual Hull (Shape from Silhouette)",
 "aliases": [
  "shape-from-silhouette",
  "space carving (silhouette)"
 ],
 "domain": "capture",
 "subdomain": "silhouette reconstruction",
 "stage": "capture",
 "realtime": "interactive",
 "platforms": [
  "cpu",
  "cuda"
 ],
 "year_introduced": 1994,
 "inputs": [
  "photos",
  "camera-poses"
 ],
 "outputs": [
  "voxels",
  "mesh"
 ],
 "style": "photoreal",
 "dynamic": "both",
 "summary": "Reconstructs a conservative 3D shape as the intersection of the viewing cones back-projected from silhouettes in several calibrated views.",
 "how_it_works": "Segment the object in each calibrated image to get a binary silhouette. Every silhouette defines a cone from the camera centre through the object's outline, and the object must lie inside all of them. Voxel carving tests each voxel by projecting it into every view and discarding it if it falls outside any silhouette; polyhedral methods intersect the cones exactly. The result is the visual hull, the largest shape consistent with all silhouettes. It always contains the true object and cannot represent concavities invisible in silhouettes. More views tighten the hull. It runs in real time for multi-camera rigs, which is why it was used for live performance capture, and often serves as initialisation for photo-consistency refinement.",
 "when_to_use": "Choose it for fast, robust coarse shape from calibrated multi-camera rigs or turntable captures with clean masks, e.g. initialising a mesh or bounding a neural field. Prefer `multi-view-stereo-patchmatch` or `neus` when concavities and surface detail matter. Use `segment-anything` or `sam2` to produce the masks it needs.",
 "cost": {
  "class": "cheap",
  "notes": "Voxel projection tests are embarrassingly parallel and cheap on GPU; dominated by segmentation quality, not compute."
 },
 "failure_modes": [
  "Concavities (bowls, eye sockets) are filled in because silhouettes cannot see them",
  "Few views leave phantom volumes (ghost blobs) outside the true shape",
  "A single bad mask carves a hole through the whole model since intersection is unforgiving",
  "Calibration error shaves thin parts such as limbs and fingers"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1109/34.273735",
   "type": "paper",
   "title": "The visual hull concept for silhouette-based image understanding",
   "authors": [
    "A. Laurentini"
   ],
   "year": 1994,
   "venue": "IEEE Transactions on Pattern Analysis and Machine Intelligence",
   "url": "https://doi.org/10.1109/34.273735",
   "ids": {
    "doi": "10.1109/34.273735"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/34.273735",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/34.273735",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/34.273735",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/34.273735",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/34.273735",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "laurentini1994visual"
  }
 ],
 "presets": [
  {
   "id": "visual-hull-live",
   "title": "Visual Hull (Shape from Silhouette) — 3-camera coarse intersection (left) vs N-camera carved hull (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_CAM_COUNT": 12,
    "P_CONE_VIS": 0.75,
    "P_ROT_SPEED": 0.65,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_CAM_COUNT = 12.0; // P Camera Count N [3.0, 18.0, 1.0]\nconst float P_CONE_VIS = 0.75; // P Camera Ring Vis [0.0, 1.5, 0.05]\nconst float P_ROT_SPEED = 0.65; // P Spin Speed [0.0, 2.2, 0.05]\nconst float P_SPLIT = 0.48; // P 3-Cam / N-Cam Split [0.0, 1.0, 0.02]\n\nmat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n\n// 2D projected silhouette SDF of a sculpted trophy/chalice seen from camera azimuth angle phi\n// Back-projecting each camera's silhouette creates a 3D generalized cylinder (viewing cone)!\n// Intersecting N viewing cones = max_k(sdSilhouette_k(p)) = EXACT Visual Hull!\nfloat silhouetteCone(vec3 q, float phi) {\n  // Project 3D point q into camera k's image plane (x_cam, y_cam)\n  float xCam = q.x * cos(phi) + q.z * sin(phi);\n  float yCam = q.y;\n\n  // True object silhouette profile: wide flared bowl at top, narrow stem, wide pedestal foot\n  float profileR = 0.24\n    + 0.24 * exp(-pow((yCam - 0.34) / 0.22, 2.0))\n    + 0.22 * exp(-pow((yCam + 0.44) / 0.14, 2.0))\n    - 0.11 * exp(-pow((yCam + 0.04) / 0.18, 2.0));\n  // Subtle non-axisymmetric handles protruding at phi=0 and phi=pi\n  float handleProj = abs(cos(phi)) * 0.18 * exp(-pow((yCam - 0.28) / 0.16, 2.0));\n  float halfW = profileR + handleProj;\n\n  float dX = abs(xCam) - halfW;\n  float dY = abs(yCam) - 0.56;\n  return max(dX, dY);\n}\n\n// Exact Visual Hull = intersection (max) of N back-projected viewing cones around the equator!\nfloat mapVisualHull(vec3 p, int nCams, float spin) {\n  vec3 q = p;\n  q.xz = rot2(spin * 0.55) * q.xz;\n  q.yz = rot2(0.32) * q.yz;\n\n  float dHull = -1e5;\n  for (int k = 0; k < 18; k++) {\n    if (k >= nCams) break;\n    float phi = float(k) / float(nCams) * 3.1415926;\n    dHull = max(dHull, silhouetteCone(q, phi));\n  }\n  return dHull * 0.85;\n}\n\nvec3 calcNormal(vec3 p, int nCams, float spin) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapVisualHull(p + e.xyy, nCams, spin) - mapVisualHull(p - e.xyy, nCams, spin),\n    mapVisualHull(p + e.yxy, nCams, spin) - mapVisualHull(p - e.yxy, nCams, spin),\n    mapVisualHull(p + e.yyx, nCams, spin) - mapVisualHull(p - e.yyx, nCams, spin)\n  ));\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool isMany = screenX >= split;\n  int nCams = isMany ? int(clamp(floor(P_CAM_COUNT + 0.5), 3.0, 18.0)) : 3;\n  float coneVis = clamp(P_CONE_VIS, 0.0, 1.5);\n  float spin = iTime * max(P_ROT_SPEED, 0.0);\n\n  vec3 ro = vec3(0.0, 0.36, 2.48);\n  vec3 ta = vec3(0.0, -0.02, 0.0);\n  vec3 fwd = normalize(ta - ro);\n  vec3 right = normalize(cross(fwd, vec3(0.0, 1.0, 0.0)));\n  vec3 up = cross(right, fwd);\n  vec3 rd = normalize(fwd * 1.52 + right * uv.x + up * uv.y);\n\n  vec3 col = mix(vec3(0.024, 0.034, 0.056), vec3(0.068, 0.088, 0.140), smoothstep(-0.55, 0.55, uv.y));\n\n  // Draw the calibrated multi-camera capture ring on floor plane y = -0.58\n  if (rd.y < -0.01) {\n    float tFlr = (-0.58 - ro.y) / rd.y;\n    if (tFlr > 0.0 && tFlr < 12.0) {\n      vec3 pf = ro + rd * tFlr;\n      float rFlr = length(pf.xz);\n      float ringLine = smoothstep(0.026, 0.006, abs(rFlr - 1.15));\n      col += vec3(0.24, 0.56, 0.88) * ringLine * 0.65 * min(coneVis, 1.2);\n\n      // Camera frustum markers around the capture ring (3 on left, N on right!)\n      vec3 qf = pf;\n      qf.xz = rot2(spin * 0.55) * qf.xz;\n      for (int k = 0; k < 18; k++) {\n        if (k >= nCams) break;\n        float phi = float(k) / float(nCams) * 6.2831853;\n        vec2 cPos = vec2(cos(phi), sin(phi)) * 1.15;\n        float dCam = length(qf.xz - cPos);\n        col += vec3(1.0, 0.84, 0.30) * smoothstep(0.065, 0.022, dCam) * 0.90 * min(coneVis, 1.2);\n        // Sightline ray from camera toward hull center\n        float proj = clamp(dot(qf.xz, cPos) / (1.15 * 1.15), 0.0, 1.0);\n        float dRay = length(qf.xz - cPos * proj);\n        col += vec3(0.20, 0.78, 0.94) * smoothstep(0.014, 0.003, dRay) * 0.25 * min(coneVis, 1.2);\n      }\n    }\n  }\n\n  // Raymarch the carved Visual Hull intersection of N silhouette cones\n  float t = 0.0;\n  bool hit = false;\n  for (int i = 0; i < 68; i++) {\n    float d = mapVisualHull(ro + rd * t, nCams, spin);\n    if (d < 0.002) { hit = true; break; }\n    t += d;\n    if (t > 8.0) break;\n  }\n\n  if (hit) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p, nCams, spin);\n\n    // Highlight polyhedral facet seams where different camera viewing cones intersect\n    vec3 nA = calcNormal(p + vec3(0.014, 0.0, 0.0), nCams, spin);\n    vec3 nB = calcNormal(p + vec3(0.0, 0.0, 0.014), nCams, spin);\n    float facetEdge = smoothstep(0.14, 0.48, (1.0 - dot(n, nA)) + (1.0 - dot(n, nB)));\n\n    vec3 l1 = normalize(vec3(0.58, 0.84, 0.52));\n    vec3 l2 = normalize(vec3(-0.70, -0.22, 0.50));\n    float diff = max(dot(n, l1), 0.0) * 0.85 + max(dot(n, l2), 0.0) * 0.26;\n    float spec = pow(max(dot(n, normalize(l1 - rd)), 0.0), 42.0);\n\n    vec3 alb = isMany ? vec3(0.20, 0.78, 0.74) : vec3(0.88, 0.54, 0.28);\n    col = alb * (0.28 + 0.82 * diff) + vec3(0.95) * spec * 0.45;\n    col = mix(col, vec3(1.0, 0.92, 0.45), facetEdge * 0.72);\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "visual-hull",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T19:53:37.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4752,
      "std": 0.2525,
      "min": 0.1816,
      "max": 0.9038
     },
     "image": "/specimens/visual-hull-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "multi-view-stereo-patchmatch",
  "neus",
  "segment-anything"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "segment-anything",
   "why": "SAM supplies per-view silhouettes that the hull intersects."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/capture/visual-hull.json"
 },
 "solves": [
  "need coarse shape from turntable photos with masks",
  "calibrated multi-camera rig should yield a quick 3d volume",
  "initialise a mesh from silhouettes",
  "bound a neural field with a robust rough shape",
  "shape from outlines in several views"
 ],
 "authority": "Laurentini, 1994",
 "url": "https://texelatlas.vercel.app/t/visual-hull/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 64.42,
  "tier": "extreme",
  "p50_ms": 1.9969,
  "p95_ms": 2.0548,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 36,
  "preset_id": "visual-hull-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 45.65,
   "tier": "heavy",
   "p50_ms": 0.7258,
   "p95_ms": 0.764,
   "speedup_x": 2.75,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 39.32,
   "tier": "heavy",
   "p50_ms": 1.1323,
   "p95_ms": 1.1534,
   "speedup_x": 1.76,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}