@pmndrs/vdb 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +727 -0
- package/LICENSE +21 -0
- package/README.md +496 -2
- package/THIRD_PARTY_NOTICES.md +315 -0
- package/dist/core/compute/atlas.d.ts +102 -0
- package/dist/core/compute/atlas.js +103 -0
- package/dist/core/compute/atlas.js.map +1 -0
- package/dist/core/compute/index.d.ts +13 -0
- package/dist/core/compute/index.js +9 -0
- package/dist/core/compute/index.js.map +1 -0
- package/dist/core/compute/majorant-build.d.ts +45 -0
- package/dist/core/compute/majorant-build.js +193 -0
- package/dist/core/compute/majorant-build.js.map +1 -0
- package/dist/core/compute/multi-scale.d.ts +155 -0
- package/dist/core/compute/multi-scale.js +684 -0
- package/dist/core/compute/multi-scale.js.map +1 -0
- package/dist/core/compute/pyramid.d.ts +120 -0
- package/dist/core/compute/pyramid.js +468 -0
- package/dist/core/compute/pyramid.js.map +1 -0
- package/dist/core/compute/shared.d.ts +116 -0
- package/dist/core/compute/shared.js +211 -0
- package/dist/core/compute/shared.js.map +1 -0
- package/dist/core/compute/stats.d.ts +78 -0
- package/dist/core/compute/stats.js +193 -0
- package/dist/core/compute/stats.js.map +1 -0
- package/dist/core/compute/value-transform.d.ts +30 -0
- package/dist/core/compute/value-transform.js +64 -0
- package/dist/core/compute/value-transform.js.map +1 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.js +17 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/frame/emission.d.ts +85 -0
- package/dist/core/frame/emission.js +422 -0
- package/dist/core/frame/emission.js.map +1 -0
- package/dist/core/frame/environment.d.ts +47 -0
- package/dist/core/frame/environment.js +178 -0
- package/dist/core/frame/environment.js.map +1 -0
- package/dist/core/frame/index.d.ts +39 -0
- package/dist/core/frame/index.js +27 -0
- package/dist/core/frame/index.js.map +1 -0
- package/dist/core/frame/kernels.d.ts +115 -0
- package/dist/core/frame/kernels.js +496 -0
- package/dist/core/frame/kernels.js.map +1 -0
- package/dist/core/frame/limits.d.ts +67 -0
- package/dist/core/frame/limits.js +109 -0
- package/dist/core/frame/limits.js.map +1 -0
- package/dist/core/frame/phase.d.ts +17 -0
- package/dist/core/frame/phase.js +53 -0
- package/dist/core/frame/phase.js.map +1 -0
- package/dist/core/frame/pipelines.d.ts +49 -0
- package/dist/core/frame/pipelines.js +147 -0
- package/dist/core/frame/pipelines.js.map +1 -0
- package/dist/core/frame/renderer.d.ts +122 -0
- package/dist/core/frame/renderer.js +1712 -0
- package/dist/core/frame/renderer.js.map +1 -0
- package/dist/core/frame/resources.d.ts +71 -0
- package/dist/core/frame/resources.js +100 -0
- package/dist/core/frame/resources.js.map +1 -0
- package/dist/core/frame/scattering.d.ts +97 -0
- package/dist/core/frame/scattering.js +332 -0
- package/dist/core/frame/scattering.js.map +1 -0
- package/dist/core/frame/settings.d.ts +243 -0
- package/dist/core/frame/settings.js +67 -0
- package/dist/core/frame/settings.js.map +1 -0
- package/dist/core/frame/shadows.d.ts +55 -0
- package/dist/core/frame/shadows.js +460 -0
- package/dist/core/frame/shadows.js.map +1 -0
- package/dist/core/frame/types.d.ts +415 -0
- package/dist/core/frame/types.js +49 -0
- package/dist/core/frame/types.js.map +1 -0
- package/dist/core/frame/uniforms.d.ts +105 -0
- package/dist/core/frame/uniforms.js +276 -0
- package/dist/core/frame/uniforms.js.map +1 -0
- package/dist/core/frame/wgsl/chunks.d.ts +4 -0
- package/dist/core/frame/wgsl/chunks.js +728 -0
- package/dist/core/frame/wgsl/chunks.js.map +1 -0
- package/dist/core/frame/wgsl/emission.d.ts +82 -0
- package/dist/core/frame/wgsl/emission.js +353 -0
- package/dist/core/frame/wgsl/emission.js.map +1 -0
- package/dist/core/frame/wgsl/environment.d.ts +42 -0
- package/dist/core/frame/wgsl/environment.js +711 -0
- package/dist/core/frame/wgsl/environment.js.map +1 -0
- package/dist/core/frame/wgsl/gather.d.ts +55 -0
- package/dist/core/frame/wgsl/gather.js +850 -0
- package/dist/core/frame/wgsl/gather.js.map +1 -0
- package/dist/core/frame/wgsl/integrate.d.ts +78 -0
- package/dist/core/frame/wgsl/integrate.js +213 -0
- package/dist/core/frame/wgsl/integrate.js.map +1 -0
- package/dist/core/frame/wgsl/lighting.d.ts +103 -0
- package/dist/core/frame/wgsl/lighting.js +1636 -0
- package/dist/core/frame/wgsl/lighting.js.map +1 -0
- package/dist/core/frame/wgsl/occluders.d.ts +20 -0
- package/dist/core/frame/wgsl/occluders.js +95 -0
- package/dist/core/frame/wgsl/occluders.js.map +1 -0
- package/dist/core/frame/wgsl/resolve.d.ts +19 -0
- package/dist/core/frame/wgsl/resolve.js +205 -0
- package/dist/core/frame/wgsl/resolve.js.map +1 -0
- package/dist/core/frame/wgsl/shadows.d.ts +35 -0
- package/dist/core/frame/wgsl/shadows.js +328 -0
- package/dist/core/frame/wgsl/shadows.js.map +1 -0
- package/dist/core/half.d.ts +11 -0
- package/dist/core/half.js +22 -0
- package/dist/core/half.js.map +1 -0
- package/dist/core/index.d.ts +52 -0
- package/dist/core/index.js +46 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +31 -0
- package/dist/core/internal.js +32 -0
- package/dist/core/internal.js.map +1 -0
- package/dist/core/pool/affine.d.ts +34 -0
- package/dist/core/pool/affine.js +100 -0
- package/dist/core/pool/affine.js.map +1 -0
- package/dist/core/pool/allocator.d.ts +32 -0
- package/dist/core/pool/allocator.js +81 -0
- package/dist/core/pool/allocator.js.map +1 -0
- package/dist/core/pool/image-header.d.ts +93 -0
- package/dist/core/pool/image-header.js +194 -0
- package/dist/core/pool/image-header.js.map +1 -0
- package/dist/core/pool/layout.d.ts +198 -0
- package/dist/core/pool/layout.js +316 -0
- package/dist/core/pool/layout.js.map +1 -0
- package/dist/core/pool/limits.d.ts +41 -0
- package/dist/core/pool/limits.js +80 -0
- package/dist/core/pool/limits.js.map +1 -0
- package/dist/core/pool/pool.d.ts +384 -0
- package/dist/core/pool/pool.js +1184 -0
- package/dist/core/pool/pool.js.map +1 -0
- package/dist/core/reference/index.d.ts +6 -0
- package/dist/core/reference/index.js +7 -0
- package/dist/core/reference/index.js.map +1 -0
- package/dist/core/reference/renderer.d.ts +105 -0
- package/dist/core/reference/renderer.js +474 -0
- package/dist/core/reference/renderer.js.map +1 -0
- package/dist/core/reference/wgsl.d.ts +65 -0
- package/dist/core/reference/wgsl.js +803 -0
- package/dist/core/reference/wgsl.js.map +1 -0
- package/dist/core/sequence.d.ts +347 -0
- package/dist/core/sequence.js +548 -0
- package/dist/core/sequence.js.map +1 -0
- package/dist/core/source/brick-cache.d.ts +165 -0
- package/dist/core/source/brick-cache.js +627 -0
- package/dist/core/source/brick-cache.js.map +1 -0
- package/dist/core/source/dense-fill.d.ts +53 -0
- package/dist/core/source/dense-fill.js +377 -0
- package/dist/core/source/dense-fill.js.map +1 -0
- package/dist/core/source/dense.d.ts +50 -0
- package/dist/core/source/dense.js +384 -0
- package/dist/core/source/dense.js.map +1 -0
- package/dist/core/source/sparse-wgsl.d.ts +92 -0
- package/dist/core/source/sparse-wgsl.js +481 -0
- package/dist/core/source/sparse-wgsl.js.map +1 -0
- package/dist/core/source/sparse.d.ts +192 -0
- package/dist/core/source/sparse.js +762 -0
- package/dist/core/source/sparse.js.map +1 -0
- package/dist/core/source/types.d.ts +120 -0
- package/dist/core/source/types.js +9 -0
- package/dist/core/source/types.js.map +1 -0
- package/dist/core/surface/index.d.ts +10 -0
- package/dist/core/surface/index.js +9 -0
- package/dist/core/surface/index.js.map +1 -0
- package/dist/core/surface/level-set-pass.d.ts +140 -0
- package/dist/core/surface/level-set-pass.js +291 -0
- package/dist/core/surface/level-set-pass.js.map +1 -0
- package/dist/core/surface/level-set-wgsl.d.ts +46 -0
- package/dist/core/surface/level-set-wgsl.js +99 -0
- package/dist/core/surface/level-set-wgsl.js.map +1 -0
- package/dist/core/surface/points.d.ts +109 -0
- package/dist/core/surface/points.js +226 -0
- package/dist/core/surface/points.js.map +1 -0
- package/dist/core/types.d.ts +37 -0
- package/dist/core/types.js +32 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wgsl/api.d.ts +65 -0
- package/dist/core/wgsl/api.js +546 -0
- package/dist/core/wgsl/api.js.map +1 -0
- package/dist/core/wgsl/generate.d.ts +90 -0
- package/dist/core/wgsl/generate.js +678 -0
- package/dist/core/wgsl/generate.js.map +1 -0
- package/dist/core/wgsl/lean.d.ts +50 -0
- package/dist/core/wgsl/lean.js +327 -0
- package/dist/core/wgsl/lean.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +58 -0
- package/dist/core/wgsl/level-set.js +200 -0
- package/dist/core/wgsl/level-set.js.map +1 -0
- package/dist/core/wgsl/majorant.d.ts +62 -0
- package/dist/core/wgsl/majorant.js +381 -0
- package/dist/core/wgsl/majorant.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
- package/dist/core/wgsl/reserved.d.ts +9 -0
- package/dist/core/wgsl/reserved.js +26 -0
- package/dist/core/wgsl/reserved.js.map +1 -0
- package/dist/core/wgsl/types.d.ts +198 -0
- package/dist/core/wgsl/types.js +2 -0
- package/dist/core/wgsl/types.js.map +1 -0
- package/dist/three/coarse-first.d.ts +207 -0
- package/dist/three/coarse-first.js +205 -0
- package/dist/three/coarse-first.js.map +1 -0
- package/dist/three/compute.d.ts +73 -0
- package/dist/three/compute.js +66 -0
- package/dist/three/compute.js.map +1 -0
- package/dist/three/device.d.ts +66 -0
- package/dist/three/device.js +62 -0
- package/dist/three/device.js.map +1 -0
- package/dist/three/frame/core-environment.d.ts +38 -0
- package/dist/three/frame/core-environment.js +154 -0
- package/dist/three/frame/core-environment.js.map +1 -0
- package/dist/three/frame/core-integrate-material.d.ts +34 -0
- package/dist/three/frame/core-integrate-material.js +162 -0
- package/dist/three/frame/core-integrate-material.js.map +1 -0
- package/dist/three/frame/core-occluders.d.ts +53 -0
- package/dist/three/frame/core-occluders.js +193 -0
- package/dist/three/frame/core-occluders.js.map +1 -0
- package/dist/three/frame/core-structs.d.ts +34 -0
- package/dist/three/frame/core-structs.js +61 -0
- package/dist/three/frame/core-structs.js.map +1 -0
- package/dist/three/frame/core-textures.d.ts +41 -0
- package/dist/three/frame/core-textures.js +114 -0
- package/dist/three/frame/core-textures.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +117 -0
- package/dist/three/frame/emission-light.js +276 -0
- package/dist/three/frame/emission-light.js.map +1 -0
- package/dist/three/frame/index.d.ts +19 -0
- package/dist/three/frame/index.js +15 -0
- package/dist/three/frame/index.js.map +1 -0
- package/dist/three/frame/medium.d.ts +33 -0
- package/dist/three/frame/medium.js +29 -0
- package/dist/three/frame/medium.js.map +1 -0
- package/dist/three/frame/renderer.d.ts +97 -0
- package/dist/three/frame/renderer.js +480 -0
- package/dist/three/frame/renderer.js.map +1 -0
- package/dist/three/frame/spectrum.d.ts +4 -0
- package/dist/three/frame/spectrum.js +15 -0
- package/dist/three/frame/spectrum.js.map +1 -0
- package/dist/three/frame/three-internals.d.ts +60 -0
- package/dist/three/frame/three-internals.js +152 -0
- package/dist/three/frame/three-internals.js.map +1 -0
- package/dist/three/frame/volume-shadows.d.ts +139 -0
- package/dist/three/frame/volume-shadows.js +403 -0
- package/dist/three/frame/volume-shadows.js.map +1 -0
- package/dist/three/frame/volume.d.ts +230 -0
- package/dist/three/frame/volume.js +268 -0
- package/dist/three/frame/volume.js.map +1 -0
- package/dist/three/grid-node.d.ts +229 -0
- package/dist/three/grid-node.js +545 -0
- package/dist/three/grid-node.js.map +1 -0
- package/dist/three/index.d.ts +52 -0
- package/dist/three/index.js +58 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/internal.d.ts +20 -0
- package/dist/three/internal.js +18 -0
- package/dist/three/internal.js.map +1 -0
- package/dist/three/level-set-material.d.ts +185 -0
- package/dist/three/level-set-material.js +241 -0
- package/dist/three/level-set-material.js.map +1 -0
- package/dist/three/level-set-physical-material.d.ts +154 -0
- package/dist/three/level-set-physical-material.js +253 -0
- package/dist/three/level-set-physical-material.js.map +1 -0
- package/dist/three/level-set-velocity.d.ts +94 -0
- package/dist/three/level-set-velocity.js +208 -0
- package/dist/three/level-set-velocity.js.map +1 -0
- package/dist/three/material.d.ts +324 -0
- package/dist/three/material.js +502 -0
- package/dist/three/material.js.map +1 -0
- package/dist/three/points.d.ts +140 -0
- package/dist/three/points.js +261 -0
- package/dist/three/points.js.map +1 -0
- package/dist/three/sparse-source.d.ts +165 -0
- package/dist/three/sparse-source.js +405 -0
- package/dist/three/sparse-source.js.map +1 -0
- package/dist/three/volume-source.d.ts +22 -0
- package/dist/three/volume-source.js +110 -0
- package/dist/three/volume-source.js.map +1 -0
- package/dist/tools/cpu/brick-atlas.d.ts +36 -0
- package/dist/tools/cpu/brick-atlas.js +129 -0
- package/dist/tools/cpu/brick-atlas.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +116 -0
- package/dist/tools/cpu/compute.js +239 -0
- package/dist/tools/cpu/compute.js.map +1 -0
- package/dist/tools/cpu/lean-reads.d.ts +81 -0
- package/dist/tools/cpu/lean-reads.js +262 -0
- package/dist/tools/cpu/lean-reads.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +111 -0
- package/dist/tools/cpu/level-set.js +313 -0
- package/dist/tools/cpu/level-set.js.map +1 -0
- package/dist/tools/cpu/majorant.d.ts +265 -0
- package/dist/tools/cpu/majorant.js +541 -0
- package/dist/tools/cpu/majorant.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +297 -0
- package/dist/tools/cpu/march.js +726 -0
- package/dist/tools/cpu/march.js.map +1 -0
- package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
- package/dist/tools/cpu/mesh-decimate.js +1225 -0
- package/dist/tools/cpu/mesh-decimate.js.map +1 -0
- package/dist/tools/cpu/points.d.ts +29 -0
- package/dist/tools/cpu/points.js +38 -0
- package/dist/tools/cpu/points.js.map +1 -0
- package/dist/tools/cpu/probe-coords.d.ts +70 -0
- package/dist/tools/cpu/probe-coords.js +116 -0
- package/dist/tools/cpu/probe-coords.js.map +1 -0
- package/dist/tools/cpu/read-value.d.ts +44 -0
- package/dist/tools/cpu/read-value.js +351 -0
- package/dist/tools/cpu/read-value.js.map +1 -0
- package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
- package/dist/tools/cpu/sample-trilinear.js +168 -0
- package/dist/tools/cpu/sample-trilinear.js.map +1 -0
- package/dist/tools/cpu/stride-tables.d.ts +56 -0
- package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
- package/dist/tools/cpu/stride-tables.generated.js +1267 -0
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
- package/dist/tools/cpu/stride-tables.js +78 -0
- package/dist/tools/cpu/stride-tables.js.map +1 -0
- package/dist/tools/cpu/surface-nets.d.ts +90 -0
- package/dist/tools/cpu/surface-nets.js +597 -0
- package/dist/tools/cpu/surface-nets.js.map +1 -0
- package/dist/tools/errors.d.ts +66 -0
- package/dist/tools/errors.js +67 -0
- package/dist/tools/errors.js.map +1 -0
- package/dist/tools/frame/ambient.d.ts +98 -0
- package/dist/tools/frame/ambient.js +274 -0
- package/dist/tools/frame/ambient.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +57 -0
- package/dist/tools/frame/blackbody.js +151 -0
- package/dist/tools/frame/blackbody.js.map +1 -0
- package/dist/tools/frame/brick-cache.d.ts +165 -0
- package/dist/tools/frame/brick-cache.js +326 -0
- package/dist/tools/frame/brick-cache.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +137 -0
- package/dist/tools/frame/emission.js +290 -0
- package/dist/tools/frame/emission.js.map +1 -0
- package/dist/tools/frame/environment-gpu.d.ts +111 -0
- package/dist/tools/frame/environment-gpu.js +280 -0
- package/dist/tools/frame/environment-gpu.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +106 -0
- package/dist/tools/frame/environment.js +272 -0
- package/dist/tools/frame/environment.js.map +1 -0
- package/dist/tools/frame/froxel.d.ts +58 -0
- package/dist/tools/frame/froxel.js +115 -0
- package/dist/tools/frame/froxel.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +392 -0
- package/dist/tools/frame/grid.js +802 -0
- package/dist/tools/frame/grid.js.map +1 -0
- package/dist/tools/frame/index.d.ts +150 -0
- package/dist/tools/frame/index.js +389 -0
- package/dist/tools/frame/index.js.map +1 -0
- package/dist/tools/frame/medium.d.ts +77 -0
- package/dist/tools/frame/medium.js +101 -0
- package/dist/tools/frame/medium.js.map +1 -0
- package/dist/tools/frame/mie-table.d.ts +6 -0
- package/dist/tools/frame/mie-table.js +16 -0
- package/dist/tools/frame/mie-table.js.map +1 -0
- package/dist/tools/frame/mie.d.ts +63 -0
- package/dist/tools/frame/mie.js +194 -0
- package/dist/tools/frame/mie.js.map +1 -0
- package/dist/tools/frame/mlp-nn.d.ts +36 -0
- package/dist/tools/frame/mlp-nn.js +159 -0
- package/dist/tools/frame/mlp-nn.js.map +1 -0
- package/dist/tools/frame/mlp-tza.d.ts +29 -0
- package/dist/tools/frame/mlp-tza.js +186 -0
- package/dist/tools/frame/mlp-tza.js.map +1 -0
- package/dist/tools/frame/mlp.d.ts +183 -0
- package/dist/tools/frame/mlp.js +434 -0
- package/dist/tools/frame/mlp.js.map +1 -0
- package/dist/tools/frame/ms-exit.d.ts +42 -0
- package/dist/tools/frame/ms-exit.js +90 -0
- package/dist/tools/frame/ms-exit.js.map +1 -0
- package/dist/tools/frame/multi-scale.d.ts +152 -0
- package/dist/tools/frame/multi-scale.js +302 -0
- package/dist/tools/frame/multi-scale.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +10 -0
- package/dist/tools/frame/neural-weights.js +244 -0
- package/dist/tools/frame/neural-weights.js.map +1 -0
- package/dist/tools/frame/neural.d.ts +80 -0
- package/dist/tools/frame/neural.js +150 -0
- package/dist/tools/frame/neural.js.map +1 -0
- package/dist/tools/frame/occluders.d.ts +51 -0
- package/dist/tools/frame/occluders.js +72 -0
- package/dist/tools/frame/occluders.js.map +1 -0
- package/dist/tools/frame/pyramid-layout.d.ts +55 -0
- package/dist/tools/frame/pyramid-layout.js +100 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -0
- package/dist/tools/frame/shadows.d.ts +190 -0
- package/dist/tools/frame/shadows.js +468 -0
- package/dist/tools/frame/shadows.js.map +1 -0
- package/dist/tools/frame/sparse.d.ts +147 -0
- package/dist/tools/frame/sparse.js +432 -0
- package/dist/tools/frame/sparse.js.map +1 -0
- package/dist/tools/frame/spectral-stack.d.ts +159 -0
- package/dist/tools/frame/spectral-stack.js +391 -0
- package/dist/tools/frame/spectral-stack.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +222 -0
- package/dist/tools/frame/spectral.js +572 -0
- package/dist/tools/frame/spectral.js.map +1 -0
- package/dist/tools/frame/stack.d.ts +115 -0
- package/dist/tools/frame/stack.js +290 -0
- package/dist/tools/frame/stack.js.map +1 -0
- package/dist/tools/frame/view.d.ts +131 -0
- package/dist/tools/frame/view.js +337 -0
- package/dist/tools/frame/view.js.map +1 -0
- package/dist/tools/index.d.ts +157 -0
- package/dist/tools/index.js +132 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal.d.ts +87 -0
- package/dist/tools/internal.js +85 -0
- package/dist/tools/internal.js.map +1 -0
- package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
- package/dist/tools/nanovdb/build-from-vdb.js +100 -0
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
- package/dist/tools/nanovdb/bytes.d.ts +233 -0
- package/dist/tools/nanovdb/bytes.js +388 -0
- package/dist/tools/nanovdb/bytes.js.map +1 -0
- package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
- package/dist/tools/nanovdb/coarse-first.js +92 -0
- package/dist/tools/nanovdb/coarse-first.js.map +1 -0
- package/dist/tools/nanovdb/half.d.ts +22 -0
- package/dist/tools/nanovdb/half.js +73 -0
- package/dist/tools/nanovdb/half.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +34 -0
- package/dist/tools/nanovdb/index.js +25 -0
- package/dist/tools/nanovdb/index.js.map +1 -0
- package/dist/tools/nanovdb/inspect.d.ts +33 -0
- package/dist/tools/nanovdb/inspect.js +70 -0
- package/dist/tools/nanovdb/inspect.js.map +1 -0
- package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
- package/dist/tools/nanovdb/leaf-codec.js +356 -0
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
- package/dist/tools/nanovdb/quantize.d.ts +72 -0
- package/dist/tools/nanovdb/quantize.js +329 -0
- package/dist/tools/nanovdb/quantize.js.map +1 -0
- package/dist/tools/nanovdb/resample.d.ts +177 -0
- package/dist/tools/nanovdb/resample.js +692 -0
- package/dist/tools/nanovdb/resample.js.map +1 -0
- package/dist/tools/nanovdb/serialize.d.ts +176 -0
- package/dist/tools/nanovdb/serialize.js +439 -0
- package/dist/tools/nanovdb/serialize.js.map +1 -0
- package/dist/tools/nanovdb/stats.d.ts +87 -0
- package/dist/tools/nanovdb/stats.js +225 -0
- package/dist/tools/nanovdb/stats.js.map +1 -0
- package/dist/tools/nanovdb/transform.d.ts +30 -0
- package/dist/tools/nanovdb/transform.js +94 -0
- package/dist/tools/nanovdb/transform.js.map +1 -0
- package/dist/tools/nanovdb/tree.d.ts +186 -0
- package/dist/tools/nanovdb/tree.js +530 -0
- package/dist/tools/nanovdb/tree.js.map +1 -0
- package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
- package/dist/tools/nanovdb/write-nvdb.js +290 -0
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
- package/dist/tools/nvdb-file.d.ts +265 -0
- package/dist/tools/nvdb-file.js +763 -0
- package/dist/tools/nvdb-file.js.map +1 -0
- package/dist/tools/nvdb-stream.d.ts +154 -0
- package/dist/tools/nvdb-stream.js +409 -0
- package/dist/tools/nvdb-stream.js.map +1 -0
- package/dist/tools/reference/analytic.d.ts +41 -0
- package/dist/tools/reference/analytic.js +95 -0
- package/dist/tools/reference/analytic.js.map +1 -0
- package/dist/tools/reference/environment.d.ts +62 -0
- package/dist/tools/reference/environment.js +154 -0
- package/dist/tools/reference/environment.js.map +1 -0
- package/dist/tools/reference/index.d.ts +12 -0
- package/dist/tools/reference/index.js +13 -0
- package/dist/tools/reference/index.js.map +1 -0
- package/dist/tools/reference/media.d.ts +14 -0
- package/dist/tools/reference/media.js +30 -0
- package/dist/tools/reference/media.js.map +1 -0
- package/dist/tools/reference/rng.d.ts +20 -0
- package/dist/tools/reference/rng.js +30 -0
- package/dist/tools/reference/rng.js.map +1 -0
- package/dist/tools/reference/scene.d.ts +312 -0
- package/dist/tools/reference/scene.js +169 -0
- package/dist/tools/reference/scene.js.map +1 -0
- package/dist/tools/reference/tables.d.ts +98 -0
- package/dist/tools/reference/tables.js +264 -0
- package/dist/tools/reference/tables.js.map +1 -0
- package/dist/tools/reference/trace.d.ts +160 -0
- package/dist/tools/reference/trace.js +497 -0
- package/dist/tools/reference/trace.js.map +1 -0
- package/dist/tools/vdb/bit-utils.d.ts +20 -0
- package/dist/tools/vdb/bit-utils.js +42 -0
- package/dist/tools/vdb/bit-utils.js.map +1 -0
- package/dist/tools/vdb/blosc-write.d.ts +43 -0
- package/dist/tools/vdb/blosc-write.js +197 -0
- package/dist/tools/vdb/blosc-write.js.map +1 -0
- package/dist/tools/vdb/blosc.d.ts +86 -0
- package/dist/tools/vdb/blosc.js +287 -0
- package/dist/tools/vdb/blosc.js.map +1 -0
- package/dist/tools/vdb/blosclz.d.ts +33 -0
- package/dist/tools/vdb/blosclz.js +112 -0
- package/dist/tools/vdb/blosclz.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +50 -0
- package/dist/tools/vdb/byte-reader.js +161 -0
- package/dist/tools/vdb/byte-reader.js.map +1 -0
- package/dist/tools/vdb/compression.d.ts +81 -0
- package/dist/tools/vdb/compression.js +260 -0
- package/dist/tools/vdb/compression.js.map +1 -0
- package/dist/tools/vdb/errors.d.ts +10 -0
- package/dist/tools/vdb/errors.js +11 -0
- package/dist/tools/vdb/errors.js.map +1 -0
- package/dist/tools/vdb/grid.d.ts +37 -0
- package/dist/tools/vdb/grid.js +153 -0
- package/dist/tools/vdb/grid.js.map +1 -0
- package/dist/tools/vdb/half-float.d.ts +9 -0
- package/dist/tools/vdb/half-float.js +24 -0
- package/dist/tools/vdb/half-float.js.map +1 -0
- package/dist/tools/vdb/index.d.ts +4 -0
- package/dist/tools/vdb/index.js +3 -0
- package/dist/tools/vdb/index.js.map +1 -0
- package/dist/tools/vdb/inflate.d.ts +24 -0
- package/dist/tools/vdb/inflate.js +334 -0
- package/dist/tools/vdb/inflate.js.map +1 -0
- package/dist/tools/vdb/lz4.d.ts +30 -0
- package/dist/tools/vdb/lz4.js +228 -0
- package/dist/tools/vdb/lz4.js.map +1 -0
- package/dist/tools/vdb/metadata.d.ts +17 -0
- package/dist/tools/vdb/metadata.js +72 -0
- package/dist/tools/vdb/metadata.js.map +1 -0
- package/dist/tools/vdb/parse.d.ts +47 -0
- package/dist/tools/vdb/parse.js +241 -0
- package/dist/tools/vdb/parse.js.map +1 -0
- package/dist/tools/vdb/point-render-data.d.ts +79 -0
- package/dist/tools/vdb/point-render-data.js +137 -0
- package/dist/tools/vdb/point-render-data.js.map +1 -0
- package/dist/tools/vdb/points.d.ts +186 -0
- package/dist/tools/vdb/points.js +835 -0
- package/dist/tools/vdb/points.js.map +1 -0
- package/dist/tools/vdb/transform.d.ts +23 -0
- package/dist/tools/vdb/transform.js +54 -0
- package/dist/tools/vdb/transform.js.map +1 -0
- package/dist/tools/vdb/tree.d.ts +111 -0
- package/dist/tools/vdb/tree.js +228 -0
- package/dist/tools/vdb/tree.js.map +1 -0
- package/dist/tools/vdb/types.d.ts +195 -0
- package/dist/tools/vdb/types.js +3 -0
- package/dist/tools/vdb/types.js.map +1 -0
- package/dist/tools/wvdb/bake.d.ts +145 -0
- package/dist/tools/wvdb/bake.js +361 -0
- package/dist/tools/wvdb/bake.js.map +1 -0
- package/dist/tools/wvdb/dense.d.ts +191 -0
- package/dist/tools/wvdb/dense.js +368 -0
- package/dist/tools/wvdb/dense.js.map +1 -0
- package/dist/tools/wvdb/format.d.ts +220 -0
- package/dist/tools/wvdb/format.js +306 -0
- package/dist/tools/wvdb/format.js.map +1 -0
- package/dist/tools/wvdb/index.d.ts +14 -0
- package/dist/tools/wvdb/index.js +15 -0
- package/dist/tools/wvdb/index.js.map +1 -0
- package/dist/tools/wvdb/level-set.d.ts +56 -0
- package/dist/tools/wvdb/level-set.js +153 -0
- package/dist/tools/wvdb/level-set.js.map +1 -0
- package/dist/tools/wvdb/nanovdb.d.ts +59 -0
- package/dist/tools/wvdb/nanovdb.js +64 -0
- package/dist/tools/wvdb/nanovdb.js.map +1 -0
- package/dist/tools/wvdb/partial.d.ts +74 -0
- package/dist/tools/wvdb/partial.js +233 -0
- package/dist/tools/wvdb/partial.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +336 -0
- package/dist/tools/wvdb/read.js +766 -0
- package/dist/tools/wvdb/read.js.map +1 -0
- package/dist/tools/wvdb/sha256.d.ts +7 -0
- package/dist/tools/wvdb/sha256.js +76 -0
- package/dist/tools/wvdb/sha256.js.map +1 -0
- package/dist/tools/wvdb/write.d.ts +149 -0
- package/dist/tools/wvdb/write.js +403 -0
- package/dist/tools/wvdb/write.js.map +1 -0
- package/package.json +83 -4
- package/vendor/LICENSE +201 -0
- package/vendor/NOTICE +19 -0
- package/vendor/VENDOR.md +100 -0
- package/vendor/pnanovdb.wgsl +1577 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dennis Smolek and Poimandres contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,497 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pmndrs/vdb
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sparse NanoVDB volumes on WebGPU: an engine-free WGSL core with a compute froxel volume renderer, level-set and point
|
|
4
|
+
passes, pure-TypeScript CPU tools and a thin three.js adapter. One package, three subpaths.
|
|
5
|
+
|
|
6
|
+
[Docs](https://pmndrs.github.io/vdb/) · [Examples](https://pmndrs.github.io/vdb/examples/) · [GitHub](https://github.com/pmndrs/vdb) · [Changelog](./CHANGELOG.md)
|
|
7
|
+
|
|
8
|
+
| Import | What it is | Needs a GPU / three? |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `@pmndrs/vdb` | the engine-free WebGPU core: `VDBGridPool`, the generated `vdb*` WGSL module (`vdbModuleWgsl`), GPU compute tools, the froxel renderer (`vdbCreateFrameRenderer`), volume sources (`vdbSparseSource`, `vdbDenseSource`), level-set and point passes, `VDBSequence` | WebGPU, no engine |
|
|
11
|
+
| `@pmndrs/vdb/tools` | CPU side: `.nvdb` and `.wvdb` read/write, CPU reads (`vdbReadValueCpu`, `vdbSampleTrilinearCpu`), `.vdb` parser, NanoVDB builder, quantizer, resampler | no |
|
|
12
|
+
| `@pmndrs/vdb/three` | the three.js adapter: `VDBGridNode` (a pool in three's node system), `VDBVolumeMaterial`, `VDBFrameVolume` / `VDBFrameRenderer` (the core's froxel renderer on three's device), `VDBLevelSetMaterial` / `VDBLevelSetPhysicalMaterial`, `VDBPoints`, compute utilities | `three` (optional peer, `>=0.187.0 <0.188.0`) |
|
|
13
|
+
| `@pmndrs/vdb/pnanovdb.wgsl` | the raw WGSL text (use `?raw` in Vite) | no |
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @pmndrs/vdb # core + tools
|
|
17
|
+
npm install @pmndrs/vdb three # to use @pmndrs/vdb/three
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`three` is an optional peer dependency (r187 only). `@webgpu/types` and `fflate` are regular dependencies.
|
|
21
|
+
`core` and `tools` never import `three`.
|
|
22
|
+
|
|
23
|
+
Coming from 0.1? 0.2.0 moved the froxel renderer into the core, dropped the `Gpu` suffix from the core's names, added
|
|
24
|
+
`Cpu` to the tools' CPU readers and renamed several `@pmndrs/vdb/three` names; a few defaults change images
|
|
25
|
+
(`ambientOcclusion` and `occlusion` are on, `'neural'` uses our own weights):
|
|
26
|
+
[Migrating from 0.1 to 0.2](https://pmndrs.github.io/vdb/reference/migrating-0-2) and the
|
|
27
|
+
[changelog](./CHANGELOG.md).
|
|
28
|
+
|
|
29
|
+
## `@pmndrs/vdb` (core) and the raw WGSL module
|
|
30
|
+
|
|
31
|
+
The engine-free WebGPU layer: `VDBGridPool` (NanoVDB grids in one storage buffer on the host's `GPUDevice`), the
|
|
32
|
+
generated `vdb*` WGSL module for reading, sampling and marching them (`vdbModuleWgsl`), GPU compute tools, and since
|
|
33
|
+
0.2.0 the froxel volume renderer, its volume sources and the level-set and point passes. It knows nothing about
|
|
34
|
+
three.js or any other engine. Loading `.nvdb` files is in `@pmndrs/vdb/tools` (`NvdbFile`).
|
|
35
|
+
|
|
36
|
+
### The froxel renderer on raw WebGPU (0.2.0)
|
|
37
|
+
|
|
38
|
+
`vdbCreateFrameRenderer(device)` (`VDBFrameRenderer`) renders volumes through a froxel grid as WGSL compute
|
|
39
|
+
kernels: `'volume'` or `'frame'` lighting, temporal accumulation, phase functions (including Lorenz-Mie), multiple
|
|
40
|
+
scattering, spectral media, an environment, volume shadow maps for your meshes (volume → mesh), your depth maps
|
|
41
|
+
shadowing the volumes (mesh → volume) and an emission light. It takes your `GPUDevice`, records into your encoder
|
|
42
|
+
(`update(encoder, input)`, then `render(encoder, targets)` or `vdbFrameIntegrateWgsl` in your own pass), frees only
|
|
43
|
+
what it made and never submits. Sources: `vdbSparseSource` (every grid of a `VDBGridPool`, with LOD) and
|
|
44
|
+
`vdbDenseSource` (`.wvdb` textures). `vdbCreateLevelSetPass` and `vdbCreatePointPass` draw level sets and points
|
|
45
|
+
into your passes. Settings out of the device's range (`shadowResolution`, shadow map sizes) clamp with a one-time
|
|
46
|
+
warning. `multipleScattering` defaults to `'neural'` (our trained network, K6.N, on the core's EXPERIMENTAL generic MLP).
|
|
47
|
+
Demo 17 is a full raw-WebGPU page; see
|
|
48
|
+
[docs/site/core/rendering-without-three.mdx](https://github.com/pmndrs/vdb/blob/main/docs/site/core/rendering-without-three.mdx).
|
|
49
|
+
|
|
50
|
+
### Majorants and the lean reader (0.2.0)
|
|
51
|
+
|
|
52
|
+
For delta and ratio tracking, `vdbModuleWgsl({ profile: 'majorant' })` adds `vdbMajorantInit` / `vdbMajorantNext`: a
|
|
53
|
+
walk of piecewise-constant density bounds along a ray, over brick bounds built on the CPU (`vdbBrickMajorant`,
|
|
54
|
+
`@pmndrs/vdb/tools`) or on the GPU (`pool.buildMajorant(id)`). `reader: 'lean'` generates a compact reader with the
|
|
55
|
+
same API and values (about a fifth of the size for Float `read`). See
|
|
56
|
+
[docs/site/core/wgsl-module.mdx](https://github.com/pmndrs/vdb/blob/main/docs/site/core/wgsl-module.mdx).
|
|
57
|
+
|
|
58
|
+
### What's in the box
|
|
59
|
+
|
|
60
|
+
- **`vendor/pnanovdb.wgsl`** — a WGSL module with the NanoVDB root ->
|
|
61
|
+
upper -> lower -> leaf tree traversal, HDDA ray marching, and
|
|
62
|
+
Float/Fp4/Fp8/Fp16/FpN/Half value decoders. Import it as raw text (`?raw` in Vite,
|
|
63
|
+
or read the file yourself) and splice it into your own shader.
|
|
64
|
+
- **`NvdbFile`** (`@pmndrs/vdb/tools`) — parses a `.nvdb` file (header + per-grid metadata +
|
|
65
|
+
grid images), handling the NONE, ZIP and BLOSC codecs.
|
|
66
|
+
- **A pure-TypeScript CPU reference** (`@pmndrs/vdb/tools`: `vdbReadValueCpu`, `vdbReadValueF32Cpu`,
|
|
67
|
+
`vdbSampleTrilinearCpu`) — the exact same tree descent as the WGSL
|
|
68
|
+
module, so you can sanity-check GPU results or read voxels with no GPU
|
|
69
|
+
at all (Node, workers, tests).
|
|
70
|
+
|
|
71
|
+
### Quickstart: load a file and read a voxel
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { NvdbFile, vdbReadValueCpu } from "@pmndrs/vdb/tools";
|
|
75
|
+
|
|
76
|
+
const file = await NvdbFile.fromURL("/fixtures/sphere_fog_float.nvdb");
|
|
77
|
+
const gridImage = file.gridImage(0); // flat Uint32Array — the grid, as-is on disk
|
|
78
|
+
const meta = file.grids[0]!;
|
|
79
|
+
console.log(meta.name, meta.gridType, meta.voxelCount);
|
|
80
|
+
|
|
81
|
+
const { value, active } = vdbReadValueCpu(gridImage, [12, 4, -3]);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`gridImage` is a zero-copy view into the file's buffer when possible
|
|
85
|
+
(`file.isGridImageZeroCopy(0)` tells you which) — upload it straight into a GPU
|
|
86
|
+
`storage` buffer, no reshaping needed.
|
|
87
|
+
|
|
88
|
+
### Loading the raw WGSL module
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import pnanovdbSource from "@pmndrs/vdb/pnanovdb.wgsl?raw"; // Vite/bundler `?raw` import
|
|
92
|
+
// or, outside a bundler: fetch(import.meta.resolve("@pmndrs/vdb/pnanovdb.wgsl"))
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`pnanovdbSource` is the library's text, unmodified. It's a genuine C-style
|
|
96
|
+
library, not a drop-in snippet: its reads all bottom out in one function,
|
|
97
|
+
`pnanovdb_buf_read_uint32`, that expects the *consumer* to declare a
|
|
98
|
+
module-scope `var<storage, read> nanovdb_buffer: array<u32>` binding (see
|
|
99
|
+
`vendor/VENDOR.md` for the exact contract) — plus `pnanovdb_buf_t`/address
|
|
100
|
+
plumbing and (for point-sampling) an accessor struct. You rarely need it
|
|
101
|
+
directly: the core's generator (`vdbModuleWgsl`) builds a pool-aware `vdb*`
|
|
102
|
+
module from it. Integrations to copy from instead of re-deriving the binding:
|
|
103
|
+
|
|
104
|
+
- **`examples/src/demos/08-webgpu-smoke`**: raw WebGPU on the core
|
|
105
|
+
(`VDBGridPool` + `vdbModuleWgsl`), no engine.
|
|
106
|
+
- **`@pmndrs/vdb/three`** ([`src/three`](https://github.com/pmndrs/vdb/tree/main/packages/vdb/src/three)): `VDBGridNode` binds
|
|
107
|
+
the pool through three's node system (below).
|
|
108
|
+
- **`examples/src/demos/03-gpu-read`** is a from-scratch, heavily-commented
|
|
109
|
+
raw-WebGPU walkthrough (no three.js) that hand-derives a FLOAT-only
|
|
110
|
+
traversal function equivalent to this library's, teaching the byte
|
|
111
|
+
layout end to end.
|
|
112
|
+
|
|
113
|
+
### Supported grid types / codecs
|
|
114
|
+
|
|
115
|
+
| Grid type | Read (WGSL + CPU) | Notes |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `Float` | yes | lossless, 4 bytes/voxel |
|
|
118
|
+
| `Fp8` | yes | per-leaf min/quantum, 1 byte/voxel |
|
|
119
|
+
| `FpN` | yes | per-leaf variable bit-width (oracle-matched to native) |
|
|
120
|
+
| `Fp4`, `Fp16` | yes | per-leaf min/quantum |
|
|
121
|
+
| `Half` | yes | raw IEEE binary16, 2 bytes/voxel (NanoVDB 13.2+; matches native v14) |
|
|
122
|
+
| other `GridType`s | rejected | `NvdbFile` throws a clear "unsupported grid type" error |
|
|
123
|
+
|
|
124
|
+
| File codec | Support |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `NONE` | yes |
|
|
127
|
+
| `ZIP` (zlib, via `fflate`) | read and write (`writeNvdb(images, { codec: 'zip' })`) |
|
|
128
|
+
| `BLOSC` | read: NanoVDB's LZ4 frames (`nanovdb_convert -b/--blosc`, any chunking) and NVIDIA Warp's BloscLZ frames. Write: `writeNvdb(images, { codec: 'blosc' })`, LZ4 frames byte-identical to native NanoVDB v14's (0.2.0) |
|
|
129
|
+
|
|
130
|
+
### The vendoring story
|
|
131
|
+
|
|
132
|
+
The WGSL module is not written from scratch: per
|
|
133
|
+
[decision D2](https://github.com/pmndrs/vdb/blob/main/docs/archive/v1/DECISIONS.md#d2--gpu-traversal-base), it's
|
|
134
|
+
**vendored as a pinned, audited fork** of
|
|
135
|
+
[emcfarlane/webgpu-nanovdb](https://github.com/emcfarlane/webgpu-nanovdb)'s
|
|
136
|
+
`pnanovdb.wgsl` — Apache-2.0, NOTICE preserved, every local change logged
|
|
137
|
+
in-tree. We're prepared to diverge permanently and happy to upstream
|
|
138
|
+
fixes if the author engages. Full pin/hash/diff-log details:
|
|
139
|
+
[`vendor/VENDOR.md`](./vendor/VENDOR.md).
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## `@pmndrs/vdb/tools`
|
|
143
|
+
|
|
144
|
+
The CPU half: parse `.vdb` containers, build
|
|
145
|
+
NanoVDB grid images (from a dense array or straight from a parsed `.vdb`),
|
|
146
|
+
quantize to Fp4/Fp8/Fp16/FpN/Half, apply affine transforms, inspect memory layout, and
|
|
147
|
+
write `.nvdb` files — all **pure TypeScript, no WASM** (the one runtime dependency is
|
|
148
|
+
`fflate` for zlib; [decision D3](https://github.com/pmndrs/vdb/blob/main/docs/archive/v1/DECISIONS.md#d3--cpu-half-pure-typescript-first-wasm-as-targeted-escalation)).
|
|
149
|
+
WASM stays an optional escalation rung, adopted only on demonstrated need
|
|
150
|
+
— nothing in this package requires it.
|
|
151
|
+
|
|
152
|
+
### Quickstart: the demo 07 pipeline
|
|
153
|
+
|
|
154
|
+
The full authoring round-trip — generate/obtain voxels, build a NanoVDB
|
|
155
|
+
grid, optionally quantize, write a real `.nvdb` file — trimmed from
|
|
156
|
+
[`examples/src/demos/07-builder`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/07-builder):
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
import { vdbBuildFromDenseDetailed, vdbQuantize, writeNvdb } from "@pmndrs/vdb/tools";
|
|
160
|
+
|
|
161
|
+
const dim = 32;
|
|
162
|
+
const values = new Float32Array(dim * dim * dim); // fill with your density field
|
|
163
|
+
// ... write nonzero values into `values` at your active voxels ...
|
|
164
|
+
|
|
165
|
+
const built = vdbBuildFromDenseDetailed(values, [dim, dim, dim], {
|
|
166
|
+
gridName: "my_grid",
|
|
167
|
+
background: 0,
|
|
168
|
+
});
|
|
169
|
+
// built: { image: Uint32Array, voxelCount, indexBBox, worldBBox, voxelSize, nodeCounts }
|
|
170
|
+
|
|
171
|
+
const fp8Image = vdbQuantize(built.image, "fp8"); // or "fpn"; per-leaf min/quantum, native-exact rounding
|
|
172
|
+
|
|
173
|
+
const fileBuffer = writeNvdb([fp8Image]); // ArrayBuffer — a real NanoVDB2 file, ready to save/upload
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`fileBuffer` round-trips through `NvdbFile.fromArrayBuffer`
|
|
177
|
+
byte-for-byte (that loader is this subpath's read path, see above).
|
|
178
|
+
|
|
179
|
+
### Quickstart: parse a real `.vdb` and build NanoVDB from it
|
|
180
|
+
|
|
181
|
+
The drop-in-a-file pipeline, trimmed from
|
|
182
|
+
[`examples/src/demos/06-explorer`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/06-explorer):
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import { parseVdb, buildFromVdbDetailed, vdbInspect } from "@pmndrs/vdb/tools";
|
|
186
|
+
|
|
187
|
+
const buffer = await fetch("/fixtures/vdb-samples/utahteapot.vdb").then((r) => r.arrayBuffer());
|
|
188
|
+
const vdbFile = parseVdb(buffer); // { fileVersion, grids: VdbGrid[], descriptors: VdbGridDescriptor[] }
|
|
189
|
+
|
|
190
|
+
const built = buildFromVdbDetailed(vdbFile.grids[0]!); // streams leaves, no dense allocation
|
|
191
|
+
const report = vdbInspect(built.image);
|
|
192
|
+
console.log(report.nodeCounts, report.memoryBreakdown);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`buildFromVdb`/`buildFromVdbDetailed` (float grids) stream the parser's leaves straight
|
|
196
|
+
into the NanoVDB serializer (proven on a 7M-voxel teapot with no dense
|
|
197
|
+
array), carrying the `.vdb` file's uniform scale+translate transform into
|
|
198
|
+
the NanoVDB `Map`.
|
|
199
|
+
|
|
200
|
+
### API surface
|
|
201
|
+
|
|
202
|
+
| Function | What it does |
|
|
203
|
+
|---|---|
|
|
204
|
+
| `parseVdb(buffer, { select }?)` | Reads a `.vdb` container (file version 225 or older): float, half (as float), vec3 and point grids, 5-4-3 tree, uncompressed, zlib or Blosc, active tiles. `select(descriptor)` picks which grids to decode; `descriptors` lists every grid, an unsupported one reported rather than thrown |
|
|
205
|
+
| `vdbBuildFromDense` / `vdbBuildFromDenseDetailed` | Dense `Float32Array` -> NanoVDB FLOAT grid image |
|
|
206
|
+
| `vdbBuildFromLeavesDetailed` | Lower-level: build from an already-leaf-shaped source (what `buildFromVdb` and `vdbQuantize` are built on) |
|
|
207
|
+
| `buildFromVdb` / `buildFromVdbDetailed` | Parsed `.vdb` grid -> NanoVDB FLOAT grid image, leaf-streamed |
|
|
208
|
+
| `vdbQuantize` / `vdbQuantizeDetailed` | FLOAT grid image -> Fp4/Fp8/Fp16/FpN (per-leaf min/quantum; FpN bit-width picked per leaf) or Half (binary16) |
|
|
209
|
+
| `vdbTransform` | Metadata-only affine edit (uniform scale + translate) on a copy; throws with a GPU-resample pointer for rotation/shear ([D6](https://github.com/pmndrs/vdb/blob/main/docs/archive/v1/DECISIONS.md#d6--browser-first-companion-service-is-an-interim-crutch-to-eliminate)) |
|
|
210
|
+
| `vdbTreeNodes` | Generator over a scalar grid image's tree: leaves (origin, active voxel count), tiles (level, origin, size, value, active) and, on request, the upper and lower nodes |
|
|
211
|
+
| `vdbInspect` | Node counts + memory-by-section breakdown, summing to the grid's total byte size |
|
|
212
|
+
| `writeNvdb` | Serializes one or more grid images into a `.nvdb` file `ArrayBuffer` (NanoVDB2, `io::Segment` layout; `codec: 'zip'` or `'blosc'` for NanoVDB's codecs; `segments: 'per-grid'` writes one segment per grid, which native `io::readGrid(file, n)` needs) |
|
|
213
|
+
| `vdbBakeCoarseFirst` | Coarse-first `.nvdb`: a small preview grid (`<name>.lod48`, box, FpN) then the full grid, ZIP by default |
|
|
214
|
+
| `vdbLevelSetMesh` / `vdbLevelSetMeshChunks` | A triangle mesh of a level set's zero surface (surface nets over the sparse leaves), whole or in chunks, for collision and export |
|
|
215
|
+
| `vdbLevelSetMeshDecimate` | Fewer triangles for such a mesh or chunk: edge collapses kept within `error` voxels of the grid's iso surface (checked at sample points on each changed triangle); seams survive |
|
|
216
|
+
| `vdbBrickMajorant` / `vdbBrickAtlas` | Brick bounds for delta and ratio tracking (`pool.add(image, { majorant })`, the `majorant` WGSL profile), and pmndrs/pathtracer's sparse brick atlas |
|
|
217
|
+
| `vdbPointRenderData` | Positions, colours and other attributes of a parsed point grid as flat arrays for `VDBPoints` or the core point pass |
|
|
218
|
+
| `NvdbStreamReader` / `readNvdbStream` | Reads a `.nvdb` from pushed bytes or a stream, emitting each grid as soon as its data is complete; hostile-input checks before allocation |
|
|
219
|
+
| `NvdbFile` | Reads a `.nvdb` held in memory or fetched (`fromArrayBuffer` / `fromURL`); there is no separate `readNvdb` |
|
|
220
|
+
|
|
221
|
+
### Supported `.vdb` subset
|
|
222
|
+
|
|
223
|
+
| | Support |
|
|
224
|
+
|---|---|
|
|
225
|
+
| Grid type | float, half (`HalfGrid`, OpenVDB 13+; read as float, `gridType` keeps `Tree_half_5_4_3`), vec3 (`Vec3f`/`Vec3d`/`Vec3i`) and point data grids |
|
|
226
|
+
| Tree configuration | 5-4-3 (OpenVDB's default) |
|
|
227
|
+
| Compression | none, zlib, Blosc (LZ4, BloscLZ and zlib) |
|
|
228
|
+
| Half-float leaf storage | yes |
|
|
229
|
+
| File version | up to 225 (what OpenVDB v14 writes); a newer one throws `VDBUnsupportedError` |
|
|
230
|
+
| Transform | uniform scale + translate (affine `Map`); non-uniform/rotated throws on `vdbTransform()`, parses fine on `parseVdb()`/`buildFromVdb()` |
|
|
231
|
+
|
|
232
|
+
### Native parity
|
|
233
|
+
|
|
234
|
+
Every function above is validated byte/value-wise against real
|
|
235
|
+
`nanovdb_convert`/OpenVDB output on the project's fixture corpus (four
|
|
236
|
+
openvdb.org samples + primitives). The one anchor that needs a native
|
|
237
|
+
machine to close out (this package's numbers already match at every
|
|
238
|
+
tested coordinate) is tracked in
|
|
239
|
+
[`docs/archive/handoffs/PHASE-5.md`](https://github.com/pmndrs/vdb/blob/main/docs/archive/handoffs/PHASE-5.md)
|
|
240
|
+
— see that doc for the full parity checklist and known semantic edge
|
|
241
|
+
cases (root background vs. near-field tile fill, active-tile compression,
|
|
242
|
+
CRC).
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
## `@pmndrs/vdb/three`
|
|
246
|
+
|
|
247
|
+
The three.js adapter over the engine-free core (D8), on three r187 (D23). The
|
|
248
|
+
grids live in a `VDBGridPool` on the renderer's `GPUDevice`; `VDBGridNode`
|
|
249
|
+
puts that pool into three's node system without copying it (three binds the
|
|
250
|
+
pool's own buffer); `VDBVolumeMaterial` raymarches one pooled grid, and
|
|
251
|
+
`VDBSequence` (the core's, re-exported) plays frames into one pool id.
|
|
252
|
+
|
|
253
|
+
### Quickstart: render a cloud
|
|
254
|
+
|
|
255
|
+
This mirrors [`examples/src/demos/02-cloud`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/02-cloud),
|
|
256
|
+
trimmed to the essentials (no camera controls, no live uniforms):
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
import * as THREE from "three/webgpu";
|
|
260
|
+
import { VDBGridPool } from "@pmndrs/vdb";
|
|
261
|
+
import { NvdbFile } from "@pmndrs/vdb/tools";
|
|
262
|
+
import { VDBGridNode, VDBVolumeMaterial, getDevice, vdbProxyGeometry } from "@pmndrs/vdb/three";
|
|
263
|
+
|
|
264
|
+
// The host owns the device: the pool's limits, passed to the renderer so the
|
|
265
|
+
// pool outlives renderer.dispose() (a renderer that made its own device destroys it).
|
|
266
|
+
const adapter = await navigator.gpu.requestAdapter();
|
|
267
|
+
const device = await adapter!.requestDevice({ requiredLimits: VDBGridPool.requiredLimits(adapter!) });
|
|
268
|
+
const renderer = new THREE.WebGPURenderer({ device, canvas });
|
|
269
|
+
await renderer.init();
|
|
270
|
+
|
|
271
|
+
const file = await NvdbFile.fromURL("/fixtures/wdas_cloud_quarter_fp8.nvdb");
|
|
272
|
+
const pool = await VDBGridPool.create(getDevice(renderer));
|
|
273
|
+
const id = pool.add(file.gridImage(0));
|
|
274
|
+
pool.flush(); // writes the grid (or record pool.update(encoder) into your own encoder)
|
|
275
|
+
|
|
276
|
+
// One VDBGridNode per pool, renderer and shader (one WGSL module per shader).
|
|
277
|
+
// The material needs the support-box ray clip helper.
|
|
278
|
+
const grids = new VDBGridNode(renderer, pool, { helpers: ["rayClipSupport"] });
|
|
279
|
+
const material = new VDBVolumeMaterial(renderer, grids, id); // the defaults are sized to the grid
|
|
280
|
+
const scene = new THREE.Scene();
|
|
281
|
+
scene.add(new THREE.Mesh(vdbProxyGeometry(pool.info(id)), material));
|
|
282
|
+
|
|
283
|
+
// Every frame: the pool's update first (submitted), then the node, then three.
|
|
284
|
+
pool.flush();
|
|
285
|
+
grids.update(); // rebinds only when a growth replaced pool.buffer
|
|
286
|
+
await renderer.renderAsync(scene, camera);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
- **`VDBGridNode(renderer, pool, { types?, profile?, sampler?, isActive?, outside?, helpers?, name? })`**:
|
|
290
|
+
the module options minus the binding (three assigns it). `types` defaults to
|
|
291
|
+
the pool's types now; pass every type you will add (or
|
|
292
|
+
`VDB_ALL_SCALAR_TYPES`) when the pool fills later. TSL helpers:
|
|
293
|
+
`vdbSample(grids, id, position, { space: 'world' | 'index' })` and
|
|
294
|
+
`vdbReadValue(grids, id, ijk)`; or call the WGSL API from your own
|
|
295
|
+
`wgslFn(src, [grids.module])` (demo 01 does both). A node binds through the
|
|
296
|
+
renderer it was made with: a shader another renderer builds, or a shader
|
|
297
|
+
holding a second node's module, throws `VDB_BAD_OPTION` (make one node per
|
|
298
|
+
renderer; read every grid of a shader through one node, by id). The first
|
|
299
|
+
node on a renderer self-tests three's attribute internals before the pool's
|
|
300
|
+
buffer reaches three (`VDB_ENGINE_MISMATCH` if three would destroy it); a
|
|
301
|
+
three other than r187 warns once, and so does a renderer that made its own
|
|
302
|
+
device (its `dispose()` destroys the pool's buffer).
|
|
303
|
+
- **`VDBVolumeMaterial(renderer, grids, gridId, params)`**: needs a node with
|
|
304
|
+
profile `sample` or `march` and `helpers: ['rayClipSupport']`. The march is
|
|
305
|
+
one `wgslFn` over the public API: world ray to index space through the pool
|
|
306
|
+
record (`pool.setTransform` instances work), clipped to the trilinear
|
|
307
|
+
support box, fixed-step density with `vdbSample`, Henyey-Greenstein sun with
|
|
308
|
+
a shadow march, ambient, and a per-fragment sample budget. The defaults draw
|
|
309
|
+
a lit volume on any grid: `opticalDepth` (6) is the optical depth across the
|
|
310
|
+
grid's longest index side at its mean density (`densityReference`, read from
|
|
311
|
+
`pool.info(id).rootAverage` at each render), and the shadow ray spans
|
|
312
|
+
`shadowReach` (0.3) of that side. `densityScale` > 0 is the extinction per
|
|
313
|
+
index voxel instead (0.1's look: `{ densityScale: 40, sunIntensity: 3,
|
|
314
|
+
shadowReach: 0 }`). Every tunable is a live uniform
|
|
315
|
+
(`material.opticalDepth.value = 10`, `material.stepSize.value`,
|
|
316
|
+
`maxSteps`, `sunDirection`, `sunColor`, `sunIntensity`, `anisotropy`,
|
|
317
|
+
`shadowSteps`, `shadowDensity`, `shadowReach`, `ambient`, `jitter`); `gridId` is a `uint`
|
|
318
|
+
uniform when given as a number, so `material.gridId.value = other` switches
|
|
319
|
+
grids without a rebuild (give the mesh a new `vdbProxyGeometry` for the
|
|
320
|
+
other grid, and after `pool.setTransform`). Caps (`maxStepsCap`,
|
|
321
|
+
`shadowStepsCap`, `sampleBudgetCap`) are compiled in. The march runs in index
|
|
322
|
+
space: `stepSize` is in index voxels and the density is relative to the index
|
|
323
|
+
box (or per index voxel with `densityScale`), so scaling a grid with
|
|
324
|
+
`setTransform` changes its size on screen, not its opacity. Perspective cameras only. `grids` must come from the same renderer.
|
|
325
|
+
- **`vdbProxyGeometry(pool.info(id), { pad? })`**: the world box to put the
|
|
326
|
+
material on (add the mesh with an identity transform). `pad: 1` also covers
|
|
327
|
+
the min-side half voxel of the trilinear support.
|
|
328
|
+
- **`getDevice(renderer)`, `getGPUTexture(renderer, texture)`**: the raw
|
|
329
|
+
WebGPU handles, as in `@pmndrs/upscaler` and `@pmndrs/denoiser`.
|
|
330
|
+
- Gone since v1: `NanoVDBGrid` (use `pool.info(id)` and `vdbProxyGeometry`),
|
|
331
|
+
`NanoVDBVolumeMaterial` (use `VDBVolumeMaterial`), `NanoVDBSequence` (use
|
|
332
|
+
`VDBSequence`), `assembleVolumeWgsl`/`rewriteBufferGlobal`, and the
|
|
333
|
+
`createVolumeRenderer` bootstrap with `computeRequiredLimits`/`nextPow2`
|
|
334
|
+
(create the device yourself with `VDBGridPool.requiredLimits(adapter)`, as
|
|
335
|
+
in the quickstart).
|
|
336
|
+
|
|
337
|
+
### Compute utilities
|
|
338
|
+
|
|
339
|
+
Compute passes over a grid in a `VDBGridPool` (K2.3). The engine-free core
|
|
340
|
+
records into your encoder and hands back a readback you resolve after
|
|
341
|
+
submitting; the three wrappers take the renderer and return promises:
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
import { VDBGridPool, vdbGridStats, vdbDecodeToAtlas, vdbApplyValueTransform } from "@pmndrs/vdb";
|
|
345
|
+
|
|
346
|
+
const id = pool.add(image);
|
|
347
|
+
pool.update(encoder); // or pool.flush()
|
|
348
|
+
const stats = vdbGridStats(device, pool, id, { encoder, histogramBins: 256 });
|
|
349
|
+
const atlas = vdbDecodeToAtlas(device, pool, id, { encoder, maxDim: 128, format: "uint8" });
|
|
350
|
+
device.queue.submit([encoder.finish()]);
|
|
351
|
+
// With your encoder, say it was submitted before reading (read() earlier rejects with VDB_BAD_OPTION):
|
|
352
|
+
await stats.submitted().read(); // { min, max, mean, histogram, activeVoxelCount, usedAtomicFastPath, range }
|
|
353
|
+
await atlas.submitted().read(); // { data: Uint8Array | Float32Array, dims, range }; atlas.buffer is the raw f32 GPU output
|
|
354
|
+
|
|
355
|
+
// Per-voxel edits run on the CPU (the pool is read-only to shaders) and are staged with pool.replace:
|
|
356
|
+
vdbApplyValueTransform(pool, id, image, "double"); // or (v) => v * 2; Float grids only
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
import { vdbGridStats, vdbDecodeToAtlas } from "@pmndrs/vdb/three";
|
|
361
|
+
|
|
362
|
+
const stats = await vdbGridStats(renderer, pool, id);
|
|
363
|
+
const { data, dims, range, texture } = await vdbDecodeToAtlas(renderer, pool, id, { maxDim: 128 }); // texture: Data3DTexture
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
The three wrappers submit their own encoder. The value transform has no three
|
|
367
|
+
wrapper: call the core `vdbApplyValueTransform`.
|
|
368
|
+
|
|
369
|
+
Each tool frees only the buffers it allocated (in `read()` or `dispose()`).
|
|
370
|
+
`vdbGridStats` bins over the grid's root min/max statistics (a grid with a
|
|
371
|
+
negative root min takes the dump path, 8 B per bbox voxel, and is refused up
|
|
372
|
+
front when that exceeds the device's buffer limits); `vdbDecodeToAtlas`
|
|
373
|
+
normalizes to them by default. Atlas cell `i` of an axis with `n` cells over `[min, max]` samples index position
|
|
374
|
+
`min + (i + 0.5) * (max - min + 1) / n - 0.5`, so at full resolution cell `i` is
|
|
375
|
+
voxel `min + i` (the last cell is `max`); the texture spans the voxel-centred box
|
|
376
|
+
`[min - 0.5, max + 0.5]`. `vdbApplyValueTransform` rewrites leaf values
|
|
377
|
+
(not tiles) and does not recompute the image's statistics. CPU versions live in
|
|
378
|
+
`@pmndrs/vdb/tools` (`vdbGridStatsCpu`, `vdbDecodeToAtlasCpu`). See
|
|
379
|
+
[`examples/src/demos/04-atlas-fallback`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/04-atlas-fallback)
|
|
380
|
+
for the atlas fallback path through a stock `Data3DTexture`.
|
|
381
|
+
|
|
382
|
+
### Coarse-first loading: `vdbStreamCoarseFirst`
|
|
383
|
+
|
|
384
|
+
A file baked with `vdbBakeCoarseFirst` (`@pmndrs/vdb/tools`) holds a ~12 KiB preview grid before the full grid
|
|
385
|
+
([design note](https://github.com/pmndrs/vdb/blob/main/docs/dev/design/K4-5-coarse-first.md)). `vdbStreamCoarseFirst` reads the response body as it arrives, adds the
|
|
386
|
+
preview to the pool with the full grid's size reserved, and replaces it in place when the full grid is in:
|
|
387
|
+
|
|
388
|
+
```ts
|
|
389
|
+
import { vdbStreamCoarseFirst } from "@pmndrs/vdb/three";
|
|
390
|
+
|
|
391
|
+
const { id } = await vdbStreamCoarseFirst(pool, await fetch("/smoke.coarse.nvdb"), {
|
|
392
|
+
// After each swap: an explicit densityScale = base x voxelRatio (it is per index voxel), the proxy box
|
|
393
|
+
// from pool.info(id), pool.flush() + grids.update(), and `majorant(event)` re-applied (replace drops it).
|
|
394
|
+
bind: { material, mesh, grids },
|
|
395
|
+
onGrid: (e) => console.log(e.final ? "full" : "preview"),
|
|
396
|
+
});
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Every `bind` member is optional. `vdbCoarseFirstApply(pool, event, bind)` is the same work for an async `onGrid`.
|
|
400
|
+
Call `pool.update(encoder)` / `pool.flush()` and `grids.update()` in your frame loop as usual.
|
|
401
|
+
|
|
402
|
+
### Sequences: `VDBSequence`
|
|
403
|
+
|
|
404
|
+
`VDBSequence` plays per-frame `.nvdb` URLs into ONE pool grid with
|
|
405
|
+
`pool.replace(id, frame)`: no material rebuild, no shader recompile, and with
|
|
406
|
+
the capacity reserved, no buffer move either:
|
|
407
|
+
|
|
408
|
+
```ts
|
|
409
|
+
import { VDBSequence } from "@pmndrs/vdb/three";
|
|
410
|
+
|
|
411
|
+
// Reserve room for the largest frame: every replace then writes in place
|
|
412
|
+
// (no pool.version change, no VDBGridNode rebind, no new bind group).
|
|
413
|
+
const id = pool.add(firstFrame, { capacity: largestFrameBytes });
|
|
414
|
+
const material = new VDBVolumeMaterial(renderer, grids, id);
|
|
415
|
+
material.densityReferenceAuto = false; // keep the first frame's density scale for every frame
|
|
416
|
+
|
|
417
|
+
const sequence = new VDBSequence({
|
|
418
|
+
urls: (i) => `/fixtures/embergen/pack/frame_${i}.nvdb`,
|
|
419
|
+
frameCount: 48,
|
|
420
|
+
fps: 24,
|
|
421
|
+
loopMode: "repeat", // or "pingpong", or "once" (hold the last frame); setLoopMode() changes it while playing
|
|
422
|
+
});
|
|
423
|
+
await sequence.preload();
|
|
424
|
+
sequence.start({ pool, id });
|
|
425
|
+
// each animation frame:
|
|
426
|
+
sequence.update(performance.now()); // may pool.replace(id, frame)
|
|
427
|
+
pool.flush(); // or pool.update(encoder) in your encoder, submitted before three renders
|
|
428
|
+
grids.update();
|
|
429
|
+
await renderer.renderAsync(scene, camera);
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
A frame larger than the reserved capacity still plays: the pool moves it and
|
|
433
|
+
may grow, which is why `grids.update()` runs after the pool's update every
|
|
434
|
+
frame. The sequence never blocks the render loop: if a frame isn't decoded
|
|
435
|
+
when its time comes, it holds the last frame, counts a stall, and keeps going
|
|
436
|
+
(`sequence.stats`: `frame`, `decodedAhead`, `stalls`, `swaps`, `replaceMs`,
|
|
437
|
+
`failed`). A frame whose loader rejects fires `onError` once and is not
|
|
438
|
+
retried until `seek()` or `start()`; playback skips it. After `dispose()`,
|
|
439
|
+
late decodes are dropped and `start`/`seek`/`resume`/`preload` throw
|
|
440
|
+
`VDB_DISPOSED`.
|
|
441
|
+
|
|
442
|
+
Frame arrays are held by reference: the pool keeps an image until the update
|
|
443
|
+
that writes it, and until `pool.settled()` resolves while a growth is
|
|
444
|
+
unconfirmed. The player never writes into them; a custom `loader` that
|
|
445
|
+
recycles frame buffers must not reuse one before `await pool.settled()` after
|
|
446
|
+
the update that wrote it.
|
|
447
|
+
|
|
448
|
+
### The froxel volume renderer
|
|
449
|
+
|
|
450
|
+
`VDBFrameVolume` and `VDBFrameRenderer` (ported from mjurczyk/openvdb, re-based on the sparse pool) render volumes
|
|
451
|
+
through a froxel grid with `'volume'` or `'frame'` lighting, temporal accumulation, phase functions (including
|
|
452
|
+
Lorenz-Mie), multiple scattering (two-sided, octaves, neural, multi-scale), spectral media and measured presets, mesh
|
|
453
|
+
shadows both ways and an emission light. Since 0.2.0 every frame is drawn by the core's froxel renderer (above) on
|
|
454
|
+
three's device: `VDBFrameRenderer` is a thin adapter (`frameRenderer.core` is the `VDBFrameRenderer`), and its
|
|
455
|
+
`settings` are the core's `VDBFrameSettings`. Volume sources are dense (`vdbDenseTextures`) or sparse
|
|
456
|
+
(`vdbSparseSource`, with LOD). See
|
|
457
|
+
[docs/site/three/frame-renderer.mdx](https://github.com/pmndrs/vdb/blob/main/docs/site/three/frame-renderer.mdx).
|
|
458
|
+
|
|
459
|
+
### Level sets and points
|
|
460
|
+
|
|
461
|
+
`VDBLevelSetMaterial` sphere-traces a level-set grid as a lit mesh surface (three's lights, shadows and depth);
|
|
462
|
+
`VDBLevelSetPhysicalMaterial` is the same trace on three's physical material (transmissive glass, clearcoat).
|
|
463
|
+
`VDBPoints` draws a `.vdb` point grid (`vdbPointRenderData`) as instanced sprites, and streams `.wvdb` points LOD by
|
|
464
|
+
LOD (`VDBPoints.fromWvdbGrid`, `addWvdbLevel`).
|
|
465
|
+
|
|
466
|
+
### `.wvdb`
|
|
467
|
+
|
|
468
|
+
`@pmndrs/vdb/tools` reads and writes mjurczyk/openvdb's `.wvdb` format (`readWvdb`, `writeWvdb`, `WvdbStreamReader`,
|
|
469
|
+
`bakeWvdb`) and converts to and from NanoVDB (`vdbToWvdb`, `nvdbToWvdb`, `wvdbDenseToNvdb`). See
|
|
470
|
+
[docs/site/formats/nvdb-vs-wvdb.mdx](https://github.com/pmndrs/vdb/blob/main/docs/site/formats/nvdb-vs-wvdb.mdx).
|
|
471
|
+
|
|
472
|
+
### Device ownership (D8)
|
|
473
|
+
|
|
474
|
+
The host creates the `GPUDevice` (with `VDBGridPool.requiredLimits(adapter)`)
|
|
475
|
+
and passes it to `WebGPURenderer({ device })`; the pool and every other pmndrs
|
|
476
|
+
tool take `getDevice(renderer)`. A renderer built without `{ device }` owns
|
|
477
|
+
its device and destroys it, with the pool's buffer, in `renderer.dispose()`.
|
|
478
|
+
|
|
479
|
+
## Third-party code
|
|
480
|
+
|
|
481
|
+
This package is MIT (see [LICENSE](./LICENSE)). The vendored `pnanovdb.wgsl` and `PNanoVDB.h` are Apache-2.0.
|
|
482
|
+
The published package ships `vendor/NOTICE` and `vendor/LICENSE` (Apache-2.0) alongside the vendored WGSL, and
|
|
483
|
+
they must stay in the package and any redistribution. The `.wvdb` code, the froxel renderer, level sets and points port logic from
|
|
484
|
+
mjurczyk/openvdb (MIT). Test fixtures are CC0, and `fflate` is an MIT runtime dependency. The full list, with
|
|
485
|
+
licences and file locations, is in [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) (shipped in the package).
|
|
486
|
+
|
|
487
|
+
## Packaging note (for contributors)
|
|
488
|
+
|
|
489
|
+
The published export map points only at built `dist/` output (`dist/{core,tools,three}`, one `tsc` build).
|
|
490
|
+
Workspace Vite/Vitest/TypeScript configs alias `@pmndrs/vdb`, `@pmndrs/vdb/tools`, `@pmndrs/vdb/three` and
|
|
491
|
+
`@pmndrs/vdb/pnanovdb.wgsl` to `src/` for source-level development without exposing TypeScript source paths
|
|
492
|
+
to npm consumers.
|
|
493
|
+
|
|
494
|
+
Each subpath's `index.ts` is its public API, frozen by `test/api-surface.test.ts` (an export-list snapshot
|
|
495
|
+
and the D32 naming rule). Test oracles and other internals live in `src/{core,tools,three}/internal.ts`, which
|
|
496
|
+
re-exports the public API and is imported by path from tests, harnesses and scripts; it is never a package
|
|
497
|
+
export.
|