{
 "id": "openvdb",
 "title": "OpenVDB",
 "aliases": [
  "VDB"
 ],
 "domain": "volumes",
 "subdomain": "sparse volumes",
 "stage": "volume",
 "realtime": "offline",
 "platforms": [
  "cpu",
  "houdini",
  "blender",
  "cuda"
 ],
 "year_introduced": 2013,
 "inputs": [
  "volume-density",
  "sdf"
 ],
 "outputs": [
  "volume-density",
  "sdf"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "A hierarchical, sparse volume data structure with a shallow B+tree-like layout, fast random access and a toolkit for level sets, fluids, smoke and clouds.",
 "how_it_works": "A VDB grid is a tree with a small fixed depth and large branching factors (typically 5-4-3 log2 per level giving 4096-wide, 128-wide and 8-wide cubes). Voxels outside the narrow band or at background value are not allocated: inactive space is represented by a single tile value at a coarse level. Because the tree is shallow, any voxel is reached in at most three hops, and an accessor caches the last-visited nodes so coherent access (stencil loops, ray marching) is effectively constant time. A transform maps the index space to world space, and the same structure stores floats, vectors, level sets and masks. Tools include resampling, CSG on level sets, fluid advection, meshing and fast ray tracing with a hierarchical DDA.",
 "when_to_use": "Choose it as the interchange and storage format for production volumes (smoke, fire, clouds, SDFs) and for offline or interactive CPU tools such as Houdini and Blender.\n\nPrefer `nanovdb` when you need to render the same grids on the GPU, as it is a flattened read-only variant. Prefer a dense 3D texture for small volumes that fit in memory and are sampled by `volume-ray-marching` in a shader.",
 "cost": {
  "class": "offline",
  "notes": "Designed for CPU throughput on huge sparse grids; memory scales with active voxels, not bounding box."
 },
 "failure_modes": [
  "Pointer-based tree does not map directly onto GPUs; needs conversion",
  "Insertion and deletion of nodes during parallel updates need care (topology changes are not thread-safe)",
  "Trilinear sampling across tile boundaries can show seams if the background value is not consistent",
  "Very dense volumes lose the memory advantage and can be slower than a flat array",
  "Level-set values outside the narrow band are clamped, so distances far from the surface are not meaningful"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/2487228.2487235",
   "type": "paper",
   "title": "VDB",
   "authors": [
    "Ken Museth"
   ],
   "year": 2013,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/2487228.2487235",
   "ids": {
    "doi": "10.1145/2487228.2487235"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2487228.2487235",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2487228.2487235",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2487228.2487235",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2487228.2487235",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/2487228.2487235",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "museth2013item"
  },
  {
   "role": "implementation",
   "key": "gh:academysoftwarefoundation/openvdb",
   "type": "code",
   "title": "AcademySoftwareFoundation/openvdb",
   "description": "OpenVDB - Sparse volume data structure and tools",
   "authors": [
    "AcademySoftwareFoundation"
   ],
   "year": 2013,
   "venue": "GitHub",
   "url": "https://github.com/AcademySoftwareFoundation/openvdb",
   "ids": {
    "repo": "AcademySoftwareFoundation/openvdb"
   },
   "license": "Apache-2.0",
   "extra": {
    "stars": 3561,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-25T17:22:01Z",
    "language": "C++",
    "homepage": "http://www.openvdb.org/",
    "license_name": "Apache License 2.0"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/AcademySoftwareFoundation/openvdb",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/AcademySoftwareFoundation/openvdb",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/AcademySoftwareFoundation/openvdb",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/AcademySoftwareFoundation/openvdb",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/AcademySoftwareFoundation/openvdb",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/AcademySoftwareFoundation/openvdb",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "academysoftwarefoundation2013academysoftwarefoundation"
  }
 ],
 "presets": [
  {
   "id": "openvdb-live",
   "title": "OpenVDB — sparse narrow-band level-set B+tree tiles & SDF slice (left) vs smooth CSG level-set surface (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_BAND_WIDTH": 0.16,
    "P_MORPH_AMT": 0.55,
    "P_SLICE_POS": 0,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_BAND_WIDTH = 0.16; // P Narrow Band Width [0.06, 0.32, 0.02]\nconst float P_MORPH_AMT = 0.55; // P CSG Morph [0.0, 1.0, 0.05]\nconst float P_SLICE_POS = 0.00; // P Slice Plane Z [-0.45, 0.45, 0.03]\nconst float P_SPLIT = 0.48; // P Narrow-Band / Mesh [0.0, 1.0, 0.02]\n\nfloat smin(float a, float b, float k) {\n  float h = clamp(0.5 + 0.5 * (b - a) / max(k, 1e-4), 0.0, 1.0);\n  return mix(b, a, h) - k * h * (1.0 - h);\n}\n\n// Organic OpenVDB CSG morphing level-set: torus blended with orbiting spheres & gyroid carving\nfloat mapLevelSet(vec3 p, float morph) {\n  vec2 q = vec2(length(p.xz) - 0.52, p.y);\n  float dTorus = length(q) - 0.22;\n  float ang = iTime * 0.75;\n  vec3 s1 = vec3(0.42 * cos(ang), 0.20 * sin(ang * 1.4), 0.42 * sin(ang));\n  vec3 s2 = vec3(-0.38 * cos(ang * 0.8), -0.18 * cos(ang), -0.38 * sin(ang * 0.8));\n  float dBlobs = smin(length(p - s1) - 0.24, length(p - s2) - 0.22, 0.22);\n  float dBase = smin(dTorus, dBlobs, 0.18 + 0.16 * morph);\n  // Subtle gyroid subtraction\n  float gyr = (sin(p.x * 11.0) * cos(p.y * 11.0) + sin(p.y * 11.0) * cos(p.z * 11.0) + sin(p.z * 11.0) * cos(p.x * 11.0)) * 0.045;\n  return max(dBase, -(gyr + 0.065 * (1.2 - morph * 0.5)));\n}\n\nvec3 calcNormal(vec3 p, float morph) {\n  vec2 e = vec2(0.0022, 0.0);\n  return normalize(vec3(\n    mapLevelSet(p + e.xyy, morph) - mapLevelSet(p - e.xyy, morph),\n    mapLevelSet(p + e.yxy, morph) - mapLevelSet(p - e.yxy, morph),\n    mapLevelSet(p + e.yyx, morph) - mapLevelSet(p - e.yyx, morph)\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 sx = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool showSurface = sx >= split;\n\n  float band = clamp(P_BAND_WIDTH, 0.04, 0.4);\n  float morph = clamp(P_MORPH_AMT, 0.0, 1.0);\n  float sliceZ = clamp(P_SLICE_POS, -0.5, 0.5);\n\n  vec3 col = mix(vec3(0.04, 0.055, 0.085), vec3(0.10, 0.14, 0.21), uv.y + 0.5);\n\n  if (!showSurface) {\n    // Left: 2D cross-section slice through OpenVDB sparse narrow-band level-set & 3-tier B+tree tile hierarchy!\n    vec2 sp = (uv + vec2(0.24, 0.0)) * 1.95;\n    vec3 p3 = vec3(sp.x, sp.y, sliceZ);\n    float phi = mapLevelSet(p3, morph);\n\n    // Check active narrow-band voxel & 8^3 leaf tile occupancy\n    float tileRes = 8.0;\n    vec3 tileCenter = (floor(p3 * tileRes) + 0.5) / tileRes;\n    float phiTile = mapLevelSet(tileCenter, morph);\n    bool activeTile = abs(phiTile) < band + 0.10;\n    bool activeVoxel = abs(phi) < band;\n\n    // Background inactive space (constant +/- background value, zero memory allocated!)\n    col = (phi < 0.0) ? vec3(0.05, 0.08, 0.14) : vec3(0.035, 0.045, 0.065);\n\n    // Active B+tree internal/leaf tile highlight\n    vec2 tg = abs(fract(sp * tileRes) - 0.5);\n    float tileEdge = smoothstep(0.05, 0.012, min(0.5 - tg.x, 0.5 - tg.y));\n    vec2 rootG = abs(fract(sp * 2.0) - 0.5);\n    float rootEdge = smoothstep(0.025, 0.006, min(0.5 - rootG.x, 0.5 - rootG.y));\n\n    if (activeTile) {\n      col = mix(col, vec3(0.10, 0.18, 0.28), 0.72);\n      col = mix(col, vec3(0.24, 0.78, 0.98), tileEdge * 0.52);\n    } else {\n      col = mix(col, vec3(0.12, 0.16, 0.22), rootEdge * 0.35);\n    }\n\n    // Active narrow-band SDF values with iso-distance contours\n    if (activeVoxel) {\n      float tBand = clamp(phi / max(band, 1e-4), -1.0, 1.0);\n      vec3 bandCol = (phi < 0.0) ? mix(vec3(0.98, 0.55, 0.18), vec3(0.42, 0.16, 0.48), -tBand)\n                                 : mix(vec3(0.18, 0.88, 0.96), vec3(0.10, 0.34, 0.58), tBand);\n      float contours = smoothstep(0.12, 0.02, abs(fract(phi * 28.0) - 0.5));\n      col = mix(bandCol * 0.88, vec3(1.0), contours * 0.28);\n    }\n\n    // Crisp zero-crossing iso-surface contour (phi == 0)\n    float zeroLine = smoothstep(0.018, 0.004, abs(phi));\n    col = mix(col, vec3(1.0, 0.98, 0.85), zeroLine);\n  } else {\n    // Right: Full 3D raymarched smooth OpenVDB CSG level-set surface\n    float orb = iTime * 0.36;\n    vec3 ro = vec3(2.05 * sin(orb), 0.58, 2.05 * cos(orb));\n    vec3 fw = normalize(-ro);\n    vec3 ri = normalize(cross(fw, vec3(0.0, 1.0, 0.0)));\n    vec3 up = cross(ri, fw);\n    vec3 rd = normalize(fw * 1.44 + ri * (uv.x - 0.14) + up * uv.y);\n\n    float t = 0.05;\n    bool hit = false;\n    for (int i = 0; i < 64; i++) {\n      float d = mapLevelSet(ro + rd * t, morph);\n      if (d < 0.002) { hit = true; break; }\n      t += d * 0.82;\n      if (t > 6.5) break;\n    }\n\n    if (hit) {\n      vec3 p = ro + rd * t;\n      vec3 n = calcNormal(p, morph);\n      vec3 v = -rd;\n      vec3 L1 = normalize(vec3(0.62, 0.78, 0.55));\n      vec3 L2 = normalize(vec3(-0.72, -0.25, -0.58));\n      vec3 H1 = normalize(L1 + v);\n      float ndl1 = max(dot(n, L1), 0.0);\n      float ndl2 = max(dot(n, L2), 0.0);\n      float spec = pow(max(dot(n, H1), 0.0), 48.0);\n      float fres = pow(1.0 - max(dot(n, v), 0.0), 3.0);\n\n      // Subtle translucent ceramic + subsurface warmth\n      vec3 baseC = mix(vec3(0.14, 0.58, 0.72), vec3(0.92, 0.46, 0.22), smoothstep(-0.35, 0.35, p.y));\n      col = baseC * (vec3(1.25, 1.15, 0.98) * ndl1 + vec3(0.32, 0.52, 0.85) * ndl2 * 0.55 + vec3(0.14, 0.18, 0.24))\n          + vec3(1.0, 0.95, 0.88) * spec * 0.85 + vec3(0.38, 0.88, 1.0) * fres * 0.38;\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(sx - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\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": "openvdb",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:20.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.5404,
      "std": 0.2525,
      "min": 0.2208,
      "max": 0.9403
     },
     "image": "/specimens/openvdb-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "nanovdb",
  "volume-ray-marching",
  "delta-tracking"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "nanovdb",
   "why": "Convert an OpenVDB grid to a flat NanoVDB buffer for GPU rendering."
  },
  {
   "id": "delta-tracking",
   "why": "Provides density and a max-grid used as the majorant."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/volumes/openvdb.json"
 },
 "solves": [
  "need to store smoke, fire or cloud volumes efficiently",
  "dense voxel grids waste memory",
  "exchange volumes between houdini and blender",
  "sparse level sets and fluid caches need a standard format"
 ],
 "authority": "Museth, 2013",
 "url": "https://texelatlas.vercel.app/t/openvdb/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 13,
  "tier": "moderate",
  "p50_ms": 0.4276,
  "p95_ms": 0.4507,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "openvdb-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 11.71,
   "tier": "moderate",
   "p50_ms": 0.1862,
   "p95_ms": 0.1887,
   "speedup_x": 2.3,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 8.72,
   "tier": "moderate",
   "p50_ms": 0.2511,
   "p95_ms": 0.2555,
   "speedup_x": 1.7,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}