{
 "id": "nanovdb",
 "title": "NanoVDB",
 "aliases": [
  "GPU VDB"
 ],
 "domain": "volumes",
 "subdomain": "sparse volumes",
 "stage": "volume",
 "realtime": "realtime",
 "platforms": [
  "cuda",
  "desktop-gpu",
  "webgpu",
  "cpu"
 ],
 "year_introduced": 2021,
 "inputs": [
  "volume-density",
  "sdf"
 ],
 "outputs": [
  "volume-density",
  "sdf"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "A compact, read-only, pointer-free serialisation of an OpenVDB grid that can be copied to a GPU buffer and sampled from CUDA, GLSL, HLSL or OpenCL with the same hierarchical access.",
 "how_it_works": "OpenVDB's tree uses pointers and dynamic allocation, which GPUs cannot handle well. NanoVDB lays the same 4-level hierarchy (root, two internal levels, leaf) in a single linear memory blob, replacing pointers with byte offsets. The tree is read-only, so all structure is fixed at conversion time; leaf nodes hold bit masks of active voxels along with min and max values per node. The header stores a transform, a bounding box and a magic number for validation. A shader or kernel gets a root pointer, and an accessor walks offsets to a voxel; a cache of the last-visited nodes makes coherent traversals fast. The same header-only C++ code compiles for CPU, CUDA and other languages through a shared C-like API, and ray-grid intersection with a hierarchical DDA is included.",
 "when_to_use": "Choose it to ray-march or path-trace large sparse volumes (clouds, smoke caches, level sets) on the GPU without densifying them.\n\nPrefer `openvdb` for editing and simulation where topology changes. Prefer a dense 3D texture when the volume is small. Prefer `volume-ray-marching` on a plain texture in a WebGL page, since NanoVDB support in browsers is limited and typically needs a custom port.",
 "cost": {
  "class": "medium",
  "notes": "Memory is the active-voxel footprint; sampling costs a few dependent reads without a cache and fewer with an accessor."
 },
 "failure_modes": [
  "Read-only: any topology change requires re-conversion on the CPU",
  "Pointer-chasing in a deep tree gives divergent memory reads when neighbouring rays are incoherent",
  "Buffer alignment and endian assumptions break when the blob is mapped to non-native languages",
  "Precision loss if grids are quantised to 4, 8 or 16 bits to save memory",
  "Browser and WebGPU support is not first-party, so porting the accessor is needed"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/3450623.3464653",
   "type": "paper",
   "title": "NanoVDB: A GPU-Friendly and Portable VDB Data Structure For Real-Time Rendering And Simulation",
   "authors": [
    "Ken Museth"
   ],
   "year": 2021,
   "venue": "ACM SIGGRAPH 2021 Talks",
   "url": "https://doi.org/10.1145/3450623.3464653",
   "ids": {
    "doi": "10.1145/3450623.3464653"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450623.3464653",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450623.3464653",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450623.3464653",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450623.3464653",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/3450623.3464653",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "museth2021nanovdb"
  },
  {
   "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": "nanovdb-live",
   "title": "NanoVDB — GPU pointer-free sparse 8^3 leaf-tile bitmask & DDA skipping (left) vs volumetric raymarching (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_DENSITY": 1.55,
    "P_STEP_SKIP": 1,
    "P_ORBIT_SPEED": 0.38,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_DENSITY = 1.55; // P Volume Density [0.5, 3.0, 0.1]\nconst float P_STEP_SKIP = 1.00; // P Leaf Tile Vis [0.2, 1.6, 0.05]\nconst float P_ORBIT_SPEED = 0.38; // P Orbit Speed [0.0, 1.4, 0.05]\nconst float P_SPLIT = 0.48; // P Leaf Bricks / Volume [0.0, 1.0, 0.02]\n\nfloat hash31(vec3 p) {\n  p = fract(p * vec3(127.1, 311.7, 74.7));\n  p += dot(p, p.yzx + 19.19);\n  return fract((p.x + p.y) * p.z);\n}\n\nfloat noise3(vec3 p) {\n  vec3 i = floor(p);\n  vec3 f = fract(p);\n  f = f * f * (3.0 - 2.0 * f);\n  return mix(\n    mix(mix(hash31(i), hash31(i + vec3(1.0, 0.0, 0.0)), f.x),\n        mix(hash31(i + vec3(0.0, 1.0, 0.0)), hash31(i + vec3(1.0, 1.0, 0.0)), f.x), f.y),\n    mix(mix(hash31(i + vec3(0.0, 0.0, 1.0)), hash31(i + vec3(1.0, 0.0, 1.0)), f.x),\n        mix(hash31(i + vec3(0.0, 1.0, 1.0)), hash31(i + vec3(1.0, 1.0, 1.0)), f.x), f.y),\n    f.z\n  );\n}\n\nfloat fbm3(vec3 p) {\n  float v = 0.0, a = 0.5;\n  for (int i = 0; i < 3; i++) {\n    v += a * noise3(p);\n    p *= 2.05;\n    a *= 0.5;\n  }\n  return v;\n}\n\n// Sparse knotted curl plume SDF bounding support (only ~18% of bounding box is active!)\nfloat evalSparseDensity(vec3 p) {\n  vec2 q = vec2(length(p.xz) - 0.52, p.y - 0.16 * sin(atan(p.z, p.x) * 2.0 + iTime * 0.6));\n  float dTorus = length(q) - 0.28;\n  if (dTorus > 0.24) return 0.0;\n  float n = fbm3(p * 3.8 + vec3(0.0, -iTime * 0.45, 0.0));\n  return clamp((0.22 - dTorus) * 3.2 + (n - 0.52) * 1.15, 0.0, 1.0) * smoothstep(0.24, 0.02, dTorus);\n}\n\nvec2 intersectAABB(vec3 ro, vec3 rd, vec3 b) {\n  vec3 invR = 1.0 / (rd + vec3(1e-6));\n  vec3 t0 = (-b - ro) * invR;\n  vec3 t1 = (b - ro) * invR;\n  vec3 tMin = min(t0, t1);\n  vec3 tMax = max(t0, t1);\n  float tN = max(max(tMin.x, tMin.y), tMin.z);\n  float tF = min(min(tMax.x, tMax.y), tMax.z);\n  return vec2(tN, tF);\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 showVolume = sx >= split;\n\n  float densScale = clamp(P_DENSITY, 0.3, 3.5);\n  float tileVis = clamp(P_STEP_SKIP, 0.1, 2.0);\n  float orb = iTime * max(P_ORBIT_SPEED, 0.0) + 0.4;\n\n  vec3 ro = vec3(2.15 * sin(orb), 0.72, 2.15 * 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.46 + ri * uv.x + up * uv.y);\n\n  vec3 col = mix(vec3(0.03, 0.045, 0.075), vec3(0.09, 0.13, 0.21), smoothstep(-0.4, 0.6, rd.y));\n  vec3 boxRad = vec3(0.95, 0.65, 0.95);\n  vec2 hit = intersectAABB(ro, rd, boxRad);\n\n  if (hit.y > max(hit.x, 0.0)) {\n    float t0 = max(hit.x, 0.05);\n    float t1 = hit.y;\n    vec3 sunDir = normalize(vec3(0.65, 0.78, 0.42));\n\n    if (!showVolume) {\n      // Left: NanoVDB hierarchical sparse 8^3 leaf-tile DDA occupancy visualization\n      float gridRes = 5.0; // coarse leaf-brick grid inside bounding domain\n      float trans = 1.0;\n      vec3 acc = vec3(0.0);\n      const int STEPS = 44;\n      float dt = (t1 - t0) / float(STEPS);\n      for (int i = 0; i < STEPS; i++) {\n        vec3 mp = ro + rd * (t0 + (float(i) + 0.5) * dt);\n        vec3 cellId = floor(mp * gridRes);\n        vec3 cellCenter = (cellId + 0.5) / gridRes;\n        // Bitmask occupancy check at NanoVDB leaf tile center\n        float tileDens = evalSparseDensity(cellCenter);\n        if (tileDens > 0.02) {\n          vec3 f = abs(fract(mp * gridRes) - 0.5);\n          float edge = smoothstep(0.055, 0.015, min(min(0.5 - f.x, 0.5 - f.y), 0.5 - f.z));\n          vec3 tileCol = mix(vec3(0.12, 0.62, 0.95), vec3(0.98, 0.58, 0.16), tileDens);\n          float a = clamp((0.18 + 0.75 * edge) * tileVis * dt * 4.5, 0.0, 0.95);\n          acc += trans * (tileCol * (0.45 + 1.15 * edge)) * a;\n          trans *= (1.0 - a);\n          if (trans < 0.04) break;\n        }\n      }\n      // Subtle outer root-node bounding box frame\n      vec3 ep = abs(abs(ro + rd * t0) - boxRad);\n      float rootWire = smoothstep(0.022, 0.005, min(max(ep.x, ep.y), min(max(ep.y, ep.z), max(ep.z, ep.x))));\n      col = col * trans + acc + vec3(0.35, 0.85, 1.0) * rootWire * 0.55;\n    } else {\n      // Right: Full NanoVDB pointer-free GPU volumetric raymarching with Henyey-Greenstein scattering\n      float trans = 1.0;\n      vec3 volAcc = vec3(0.0);\n      const int STEPS = 42;\n      float dt = (t1 - t0) / float(STEPS);\n      float hg = 0.25 + 0.75 * pow(max(dot(rd, sunDir), 0.0), 4.0);\n      for (int i = 0; i < STEPS; i++) {\n        vec3 mp = ro + rd * (t0 + (float(i) + 0.5) * dt);\n        float d = evalSparseDensity(mp);\n        if (d > 0.01) {\n          // 4-step shadow march along sun direction\n          float shAcc = 0.0;\n          for (int s = 1; s <= 4; s++) {\n            shAcc += evalSparseDensity(mp + sunDir * (float(s) * 0.11));\n          }\n          float lTrans = exp(-shAcc * densScale * 0.65);\n          vec3 scatterCol = mix(vec3(0.18, 0.34, 0.56), vec3(1.55, 1.18, 0.76), lTrans) * (0.55 + 0.75 * hg);\n          float ext = d * densScale * 3.4;\n          float stepT = exp(-ext * dt);\n          volAcc += trans * scatterCol * (1.0 - stepT);\n          trans *= stepT;\n          if (trans < 0.02) break;\n        }\n      }\n      col = col * trans + volAcc;\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": "nanovdb",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:17.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6668,
      "std": 0.2204,
      "min": 0.2189,
      "max": 0.9132
     },
     "image": "/specimens/nanovdb-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "openvdb",
  "volume-ray-marching",
  "delta-tracking"
 ],
 "extends": [
  "openvdb"
 ],
 "supersedes": [],
 "combines_with": [
  {
   "id": "volume-ray-marching",
   "why": "Ray-grid traversal with DDA skips empty nodes while stepping through density."
  },
  {
   "id": "openvdb",
   "why": "Provides the source grids to be converted and uploaded."
  }
 ],
 "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/nanovdb.json"
 },
 "solves": [
  "need to render large sparse volumes on the gpu",
  "openvdb can't be sampled in a shader",
  "dense 3d textures use too much memory for smoke caches",
  "want gpu access to a production volume grid"
 ],
 "authority": "Museth, 2021",
 "url": "https://texelatlas.vercel.app/t/nanovdb/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 349.64,
  "tier": "extreme",
  "p50_ms": 11.5032,
  "p95_ms": 11.7392,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 16,
  "preset_id": "nanovdb-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 331.64,
   "tier": "extreme",
   "p50_ms": 5.2731,
   "p95_ms": 5.3515,
   "speedup_x": 2.18,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 273.01,
   "tier": "extreme",
   "p50_ms": 7.8628,
   "p95_ms": 8.0135,
   "speedup_x": 1.46,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}