@pmndrs/vdb 0.0.0-stage → 0.1.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 +137 -0
- package/LICENSE +21 -0
- package/README.md +448 -2
- package/THIRD_PARTY_NOTICES.md +147 -0
- package/dist/core/compute/atlas.d.ts +94 -0
- package/dist/core/compute/atlas.js +98 -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/pyramid.d.ts +105 -0
- package/dist/core/compute/pyramid.js +455 -0
- package/dist/core/compute/pyramid.js.map +1 -0
- package/dist/core/compute/shared.d.ts +115 -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 +71 -0
- package/dist/core/compute/stats.js +188 -0
- package/dist/core/compute/stats.js.map +1 -0
- package/dist/core/compute/value-transform.d.ts +23 -0
- package/dist/core/compute/value-transform.js +58 -0
- package/dist/core/compute/value-transform.js.map +1 -0
- package/dist/core/errors.d.ts +11 -0
- package/dist/core/errors.js +9 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +27 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +15 -0
- package/dist/core/internal.js +15 -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 +82 -0
- package/dist/core/pool/image-header.js +175 -0
- package/dist/core/pool/image-header.js.map +1 -0
- package/dist/core/pool/layout.d.ts +164 -0
- package/dist/core/pool/layout.js +267 -0
- package/dist/core/pool/layout.js.map +1 -0
- package/dist/core/pool/limits.d.ts +40 -0
- package/dist/core/pool/limits.js +79 -0
- package/dist/core/pool/limits.js.map +1 -0
- package/dist/core/pool/pool.d.ts +279 -0
- package/dist/core/pool/pool.js +953 -0
- package/dist/core/pool/pool.js.map +1 -0
- package/dist/core/source/dense.d.ts +19 -0
- package/dist/core/source/dense.js +287 -0
- package/dist/core/source/dense.js.map +1 -0
- package/dist/core/source/types.d.ts +63 -0
- package/dist/core/source/types.js +9 -0
- package/dist/core/source/types.js.map +1 -0
- package/dist/core/types.d.ts +28 -0
- package/dist/core/types.js +28 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wgsl/api.d.ts +41 -0
- package/dist/core/wgsl/api.js +463 -0
- package/dist/core/wgsl/api.js.map +1 -0
- package/dist/core/wgsl/generate.d.ts +82 -0
- package/dist/core/wgsl/generate.js +505 -0
- package/dist/core/wgsl/generate.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +54 -0
- package/dist/core/wgsl/level-set.js +194 -0
- package/dist/core/wgsl/level-set.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +330 -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 +104 -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 +162 -0
- package/dist/three/coarse-first.js +187 -0
- package/dist/three/coarse-first.js.map +1 -0
- package/dist/three/compute.d.ts +63 -0
- package/dist/three/compute.js +56 -0
- package/dist/three/compute.js.map +1 -0
- package/dist/three/device.d.ts +59 -0
- package/dist/three/device.js +59 -0
- package/dist/three/device.js.map +1 -0
- package/dist/three/frame/blackbody.d.ts +42 -0
- package/dist/three/frame/blackbody.js +74 -0
- package/dist/three/frame/blackbody.js.map +1 -0
- package/dist/three/frame/chunks.d.ts +157 -0
- package/dist/three/frame/chunks.js +559 -0
- package/dist/three/frame/chunks.js.map +1 -0
- package/dist/three/frame/density-material.d.ts +53 -0
- package/dist/three/frame/density-material.js +353 -0
- package/dist/three/frame/density-material.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +167 -0
- package/dist/three/frame/emission-light.js +655 -0
- package/dist/three/frame/emission-light.js.map +1 -0
- package/dist/three/frame/environment-grid-material.d.ts +21 -0
- package/dist/three/frame/environment-grid-material.js +184 -0
- package/dist/three/frame/environment-grid-material.js.map +1 -0
- package/dist/three/frame/environment-material.d.ts +22 -0
- package/dist/three/frame/environment-material.js +87 -0
- package/dist/three/frame/environment-material.js.map +1 -0
- package/dist/three/frame/grid-mip-material.d.ts +12 -0
- package/dist/three/frame/grid-mip-material.js +61 -0
- package/dist/three/frame/grid-mip-material.js.map +1 -0
- package/dist/three/frame/index.d.ts +39 -0
- package/dist/three/frame/index.js +35 -0
- package/dist/three/frame/index.js.map +1 -0
- package/dist/three/frame/inject-material.d.ts +56 -0
- package/dist/three/frame/inject-material.js +424 -0
- package/dist/three/frame/inject-material.js.map +1 -0
- package/dist/three/frame/integrate-material.d.ts +26 -0
- package/dist/three/frame/integrate-material.js +198 -0
- package/dist/three/frame/integrate-material.js.map +1 -0
- package/dist/three/frame/layout.d.ts +34 -0
- package/dist/three/frame/layout.js +48 -0
- package/dist/three/frame/layout.js.map +1 -0
- package/dist/three/frame/lighting-material.d.ts +41 -0
- package/dist/three/frame/lighting-material.js +257 -0
- package/dist/three/frame/lighting-material.js.map +1 -0
- package/dist/three/frame/lights.d.ts +11 -0
- package/dist/three/frame/lights.js +16 -0
- package/dist/three/frame/lights.js.map +1 -0
- package/dist/three/frame/medium.d.ts +21 -0
- package/dist/three/frame/medium.js +29 -0
- package/dist/three/frame/medium.js.map +1 -0
- package/dist/three/frame/neural.d.ts +14 -0
- package/dist/three/frame/neural.js +105 -0
- package/dist/three/frame/neural.js.map +1 -0
- package/dist/three/frame/phase.d.ts +44 -0
- package/dist/three/frame/phase.js +80 -0
- package/dist/three/frame/phase.js.map +1 -0
- package/dist/three/frame/renderer.d.ts +493 -0
- package/dist/three/frame/renderer.js +1498 -0
- package/dist/three/frame/renderer.js.map +1 -0
- package/dist/three/frame/shadow-density-material.d.ts +30 -0
- package/dist/three/frame/shadow-density-material.js +123 -0
- package/dist/three/frame/shadow-density-material.js.map +1 -0
- package/dist/three/frame/spectrum.d.ts +18 -0
- package/dist/three/frame/spectrum.js +36 -0
- package/dist/three/frame/spectrum.js.map +1 -0
- package/dist/three/frame/temporal-material.d.ts +29 -0
- package/dist/three/frame/temporal-material.js +152 -0
- package/dist/three/frame/temporal-material.js.map +1 -0
- package/dist/three/frame/three-internals.d.ts +65 -0
- package/dist/three/frame/three-internals.js +150 -0
- package/dist/three/frame/three-internals.js.map +1 -0
- package/dist/three/frame/transmittance-material.d.ts +31 -0
- package/dist/three/frame/transmittance-material.js +315 -0
- package/dist/three/frame/transmittance-material.js.map +1 -0
- package/dist/three/frame/view.d.ts +103 -0
- package/dist/three/frame/view.js +296 -0
- package/dist/three/frame/view.js.map +1 -0
- package/dist/three/frame/volume-shadow-material.d.ts +36 -0
- package/dist/three/frame/volume-shadow-material.js +128 -0
- package/dist/three/frame/volume-shadow-material.js.map +1 -0
- package/dist/three/frame/volume-shadows.d.ts +153 -0
- package/dist/three/frame/volume-shadows.js +756 -0
- package/dist/three/frame/volume-shadows.js.map +1 -0
- package/dist/three/frame/volume.d.ts +172 -0
- package/dist/three/frame/volume.js +256 -0
- package/dist/three/frame/volume.js.map +1 -0
- package/dist/three/grid-node.d.ts +196 -0
- package/dist/three/grid-node.js +510 -0
- package/dist/three/grid-node.js.map +1 -0
- package/dist/three/index.d.ts +43 -0
- package/dist/three/index.js +49 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/internal.d.ts +14 -0
- package/dist/three/internal.js +14 -0
- package/dist/three/internal.js.map +1 -0
- package/dist/three/level-set-material.d.ts +112 -0
- package/dist/three/level-set-material.js +204 -0
- package/dist/three/level-set-material.js.map +1 -0
- package/dist/three/material.d.ts +194 -0
- package/dist/three/material.js +359 -0
- package/dist/three/material.js.map +1 -0
- package/dist/three/points.d.ts +84 -0
- package/dist/three/points.js +130 -0
- package/dist/three/points.js.map +1 -0
- package/dist/three/sequence.d.ts +317 -0
- package/dist/three/sequence.js +526 -0
- package/dist/three/sequence.js.map +1 -0
- package/dist/three/sparse-source.d.ts +233 -0
- package/dist/three/sparse-source.js +876 -0
- package/dist/three/sparse-source.js.map +1 -0
- package/dist/three/volume-source.d.ts +167 -0
- package/dist/three/volume-source.js +353 -0
- package/dist/three/volume-source.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +97 -0
- package/dist/tools/cpu/compute.js +218 -0
- package/dist/tools/cpu/compute.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +72 -0
- package/dist/tools/cpu/level-set.js +261 -0
- package/dist/tools/cpu/level-set.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +206 -0
- package/dist/tools/cpu/march.js +575 -0
- package/dist/tools/cpu/march.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 +31 -0
- package/dist/tools/cpu/read-value.js +336 -0
- package/dist/tools/cpu/read-value.js.map +1 -0
- package/dist/tools/cpu/sample-trilinear.d.ts +30 -0
- package/dist/tools/cpu/sample-trilinear.js +156 -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 +1058 -0
- package/dist/tools/cpu/stride-tables.generated.js +1266 -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/errors.d.ts +57 -0
- package/dist/tools/errors.js +58 -0
- package/dist/tools/errors.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +42 -0
- package/dist/tools/frame/blackbody.js +116 -0
- package/dist/tools/frame/blackbody.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +128 -0
- package/dist/tools/frame/emission.js +282 -0
- package/dist/tools/frame/emission.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +105 -0
- package/dist/tools/frame/environment.js +268 -0
- package/dist/tools/frame/environment.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +302 -0
- package/dist/tools/frame/grid.js +703 -0
- package/dist/tools/frame/grid.js.map +1 -0
- package/dist/tools/frame/index.d.ts +136 -0
- package/dist/tools/frame/index.js +348 -0
- package/dist/tools/frame/index.js.map +1 -0
- package/dist/tools/frame/medium.d.ts +61 -0
- package/dist/tools/frame/medium.js +99 -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 +54 -0
- package/dist/tools/frame/mie.js +176 -0
- package/dist/tools/frame/mie.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +9 -0
- package/dist/tools/frame/neural-weights.js +245 -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/pyramid-layout.d.ts +38 -0
- package/dist/tools/frame/pyramid-layout.js +53 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -0
- package/dist/tools/frame/shadows.d.ts +80 -0
- package/dist/tools/frame/shadows.js +182 -0
- package/dist/tools/frame/shadows.js.map +1 -0
- package/dist/tools/frame/sparse.d.ts +65 -0
- package/dist/tools/frame/sparse.js +191 -0
- package/dist/tools/frame/sparse.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +203 -0
- package/dist/tools/frame/spectral.js +550 -0
- package/dist/tools/frame/spectral.js.map +1 -0
- package/dist/tools/index.d.ts +106 -0
- package/dist/tools/index.js +88 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal.d.ts +46 -0
- package/dist/tools/internal.js +31 -0
- package/dist/tools/internal.js.map +1 -0
- package/dist/tools/nanovdb/build-from-vdb.d.ts +50 -0
- package/dist/tools/nanovdb/build-from-vdb.js +92 -0
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
- package/dist/tools/nanovdb/bytes.d.ts +220 -0
- package/dist/tools/nanovdb/bytes.js +345 -0
- package/dist/tools/nanovdb/bytes.js.map +1 -0
- package/dist/tools/nanovdb/coarse-first.d.ts +62 -0
- package/dist/tools/nanovdb/coarse-first.js +86 -0
- package/dist/tools/nanovdb/coarse-first.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +32 -0
- package/dist/tools/nanovdb/index.js +24 -0
- package/dist/tools/nanovdb/index.js.map +1 -0
- package/dist/tools/nanovdb/inspect.d.ts +24 -0
- package/dist/tools/nanovdb/inspect.js +63 -0
- package/dist/tools/nanovdb/inspect.js.map +1 -0
- package/dist/tools/nanovdb/leaf-codec.d.ts +85 -0
- package/dist/tools/nanovdb/leaf-codec.js +320 -0
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
- package/dist/tools/nanovdb/quantize.d.ts +43 -0
- package/dist/tools/nanovdb/quantize.js +277 -0
- package/dist/tools/nanovdb/quantize.js.map +1 -0
- package/dist/tools/nanovdb/resample.d.ts +160 -0
- package/dist/tools/nanovdb/resample.js +679 -0
- package/dist/tools/nanovdb/resample.js.map +1 -0
- package/dist/tools/nanovdb/serialize.d.ts +145 -0
- package/dist/tools/nanovdb/serialize.js +395 -0
- package/dist/tools/nanovdb/serialize.js.map +1 -0
- package/dist/tools/nanovdb/stats.d.ts +58 -0
- package/dist/tools/nanovdb/stats.js +149 -0
- package/dist/tools/nanovdb/stats.js.map +1 -0
- package/dist/tools/nanovdb/transform.d.ts +26 -0
- package/dist/tools/nanovdb/transform.js +91 -0
- package/dist/tools/nanovdb/transform.js.map +1 -0
- package/dist/tools/nanovdb/tree.d.ts +175 -0
- package/dist/tools/nanovdb/tree.js +518 -0
- package/dist/tools/nanovdb/tree.js.map +1 -0
- package/dist/tools/nanovdb/write-nvdb.d.ts +39 -0
- package/dist/tools/nanovdb/write-nvdb.js +210 -0
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
- package/dist/tools/nvdb-file.d.ts +195 -0
- package/dist/tools/nvdb-file.js +606 -0
- package/dist/tools/nvdb-file.js.map +1 -0
- package/dist/tools/nvdb-stream.d.ts +138 -0
- package/dist/tools/nvdb-stream.js +365 -0
- package/dist/tools/nvdb-stream.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.d.ts +56 -0
- package/dist/tools/vdb/blosc.js +231 -0
- package/dist/tools/vdb/blosc.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +40 -0
- package/dist/tools/vdb/byte-reader.js +139 -0
- package/dist/tools/vdb/byte-reader.js.map +1 -0
- package/dist/tools/vdb/compression.d.ts +73 -0
- package/dist/tools/vdb/compression.js +249 -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 +147 -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 +3 -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/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 +25 -0
- package/dist/tools/vdb/parse.js +171 -0
- package/dist/tools/vdb/parse.js.map +1 -0
- package/dist/tools/vdb/point-render-data.d.ts +31 -0
- package/dist/tools/vdb/point-render-data.js +57 -0
- package/dist/tools/vdb/point-render-data.js.map +1 -0
- package/dist/tools/vdb/points.d.ts +160 -0
- package/dist/tools/vdb/points.js +794 -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 +138 -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 +116 -0
- package/dist/tools/wvdb/bake.js +311 -0
- package/dist/tools/wvdb/bake.js.map +1 -0
- package/dist/tools/wvdb/dense.d.ts +112 -0
- package/dist/tools/wvdb/dense.js +309 -0
- package/dist/tools/wvdb/dense.js.map +1 -0
- package/dist/tools/wvdb/format.d.ts +161 -0
- package/dist/tools/wvdb/format.js +303 -0
- package/dist/tools/wvdb/format.js.map +1 -0
- package/dist/tools/wvdb/index.d.ts +13 -0
- package/dist/tools/wvdb/index.js +14 -0
- package/dist/tools/wvdb/index.js.map +1 -0
- package/dist/tools/wvdb/level-set.d.ts +48 -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 +54 -0
- package/dist/tools/wvdb/nanovdb.js +60 -0
- package/dist/tools/wvdb/nanovdb.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +260 -0
- package/dist/tools/wvdb/read.js +743 -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 +127 -0
- package/dist/tools/wvdb/write.js +396 -0
- package/dist/tools/wvdb/write.js.map +1 -0
- package/package.json +82 -4
- package/vendor/LICENSE +201 -0
- package/vendor/NOTICE +19 -0
- package/vendor/VENDOR.md +85 -0
- package/vendor/pnanovdb.wgsl +1539 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@pmndrs/vdb` are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project follows
|
|
5
|
+
[Semantic Versioning](https://semver.org/) (while 0.x, minor releases may break).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-11-24
|
|
10
|
+
|
|
11
|
+
First public release (0.1.0). Our earlier v1 unscoped packages were never published (the npm `webvdb` package is mjurczyk's, not ours);
|
|
12
|
+
`@pmndrs/vdb` is the first published name. MIT licensed. Peer: `three` r187 (optional, only for `@pmndrs/vdb/three`).
|
|
13
|
+
The renderer, `.wvdb` format and level-set and point code derive from
|
|
14
|
+
[mjurczyk/openvdb](https://github.com/mjurczyk/openvdb) (MIT); the WGSL traversal derives from
|
|
15
|
+
emcfarlane/webgpu-nanovdb (Apache-2.0). See `THIRD_PARTY_NOTICES.md`.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
One package with three entry points plus `@pmndrs/vdb/pnanovdb.wgsl`: `@pmndrs/vdb` (engine-free WebGPU core),
|
|
20
|
+
`@pmndrs/vdb/tools` (pure-TS CPU tools, no GPU, no `three`) and `@pmndrs/vdb/three` (three.js adapter).
|
|
21
|
+
|
|
22
|
+
**Core (`@pmndrs/vdb`)**
|
|
23
|
+
|
|
24
|
+
- `VDBGridPool`: one storage buffer holding a grid table and any number of NanoVDB grid images (add, replace,
|
|
25
|
+
remove, setTransform, grow, version and revision counters, host-buffer mode, dispose) with a versioned GPU layout.
|
|
26
|
+
- Generated WGSL modules (`vdbModuleWgsl`, `vdbModuleEntries`, `vdbCheckModule`) per profile (`read`, `sample`,
|
|
27
|
+
`march`) for Float, Fp4, Fp8, Fp16 and FpN grids, every symbol prefixed `vdb`, slot and buffer binding modes, with
|
|
28
|
+
a size budget guarded in CI. Opt-in helpers: `fastTrilinear`, `levelSet`, `cellBoundTrilinear`, `hddaCellEnd`,
|
|
29
|
+
`rayClipSupport`, `nodeAverage`.
|
|
30
|
+
- GPU compute: `vdbGridStatsGpu`, `vdbDecodeToAtlasGpu`, the box pyramid `vdbCreateBoxPyramid`, and
|
|
31
|
+
`vdbApplyValueTransform`; `vdbDenseSource` for dense volume sources.
|
|
32
|
+
- `VDBError` with stable `code`s.
|
|
33
|
+
|
|
34
|
+
**Tools (`@pmndrs/vdb/tools`)**
|
|
35
|
+
|
|
36
|
+
- `parseVdb`: OpenVDB `.vdb` files including Blosc and zlib compression, active tiles, vector grids, point grids
|
|
37
|
+
and half-float storage.
|
|
38
|
+
- Build and quantize: `vdbBuildFromDense`, `buildFromVdb`, `vdbBuildFromLeavesDetailed`, `vdbQuantize` to Fp4, Fp8,
|
|
39
|
+
Fp16 and FpN; `vdbResampleGrid`, `vdbCollapseGrid`, `vdbTransform`, `vdbInspect`. `vdbBuildFromDense` and
|
|
40
|
+
`vdbBuildFromLeavesDetailed` take `voxelSize` as a number or `[x, y, z]` (an anisotropic, diagonal Map; G15a).
|
|
41
|
+
- `.nvdb`: `NvdbFile` (NONE and ZIP codecs), `NvdbStreamReader` / `readNvdbStream` (emits each grid as it
|
|
42
|
+
completes), `writeNvdb` (with the ZIP codec), and coarse-first baking with `vdbBakeCoarseFirst`.
|
|
43
|
+
- `.wvdb` (mjurczyk/openvdb spec): `readWvdb`, `writeWvdb`, `WvdbStreamReader`, `bakeWvdb`, and converters
|
|
44
|
+
(`vdbToWvdb`, `nvdbToWvdb`, `wvdbDenseToNvdb`).
|
|
45
|
+
- CPU reads, samplers, stats and atlas: `vdbReadValueCpu`, `vdbReadValueF32`, `vdbSampleTrilinear`,
|
|
46
|
+
`vdbSampleNearest`, `vdbGridStatsCpu`, `vdbDecodeToAtlasCpu`.
|
|
47
|
+
- Medium presets (`vdbFrameMediumPresets`, `vdbFrameMediumFromMeasurements`) and blackbody colours from an analytic
|
|
48
|
+
CIE 1931 fit (`vdbFrameBlackbodyColor`, `vdbCie1931Fit`).
|
|
49
|
+
- One error hierarchy: `VDBToolsError` with `VdbFormatError`, `NvdbFormatError`, `WvdbFormatError` and
|
|
50
|
+
`VDBUnsupportedError`.
|
|
51
|
+
|
|
52
|
+
**three.js adapter (`@pmndrs/vdb/three`)**
|
|
53
|
+
|
|
54
|
+
- `getDevice(renderer)` and `getGPUTexture` so tools share one GPU device; `VDBGridNode` with the `vdbSample` and
|
|
55
|
+
`vdbReadValue` TSL helpers.
|
|
56
|
+
- `VDBVolumeMaterial` (with `vdbProxyGeometry`), `VDBSequence` (frame playback on `pool.replace`), and compute
|
|
57
|
+
wrappers (`vdbGridStats`, `vdbDecodeToAtlas`).
|
|
58
|
+
- Coarse-first streaming: `vdbStreamCoarseFirst` and `vdbCoarseFirstApply`, with `bind` to update material, mesh and
|
|
59
|
+
node after each swap.
|
|
60
|
+
- Coarse-first into the froxel renderer without a rebuild (G16a): `vdbSparseSource(..., { followImage: true })`
|
|
61
|
+
re-reads its boxes and rebuilds its pyramid after a `pool.replace` changes the grid's box (boxes, sizes and LOD levels
|
|
62
|
+
are uniforms then), and a `VDBFrameVolume` whose box is the source's follows it. `VDBCoarseFirstEvent.types` lists
|
|
63
|
+
the family's grid types for `new VDBGridNode(renderer, pool, { types })`, so one node, source and volume take the
|
|
64
|
+
preview and the full grid with no shader or pipeline built at the swap.
|
|
65
|
+
- The froxel renderer, ported from mjurczyk/openvdb and re-based on the sparse pool: `VDBFrameVolume` and
|
|
66
|
+
`VDBFrameRenderer` (`vdbFrameRenderer`) with `'volume'` and `'frame'` lighting, temporal accumulation, phase
|
|
67
|
+
functions including Lorenz-Mie, multiple scattering (two-sided, octaves, neural), spectral media and measured
|
|
68
|
+
presets (`vdbFrameMedium`), mesh shadows, and emission light (`VDBFrameEmissionLight`, blackbody).
|
|
69
|
+
- Volume sources with LOD: `vdbDenseSource` / `vdbDenseTextures` (dense) and `vdbSparseSource` (coarse pyramid,
|
|
70
|
+
node-average LOD, optional HDDA empty-space skipping).
|
|
71
|
+
- `VDBLevelSetMaterial` (sphere-traced level-set surfaces lit by three's lights and shadows) and `VDBPoints`.
|
|
72
|
+
- Froxel renderer API (K5.9): one place for the phase (the renderer's `settings.phase*` is every volume's; a volume's
|
|
73
|
+
`phase*` props are optional `'volume'`-lighting overrides, `volume.getPhase()`); `volume.setMedium(name | props |
|
|
74
|
+
null)` applies a measured medium in one call (albedo, extinction spectrum, the renderer's phase, spectral on);
|
|
75
|
+
`densityMean` fixes the mean `normalizeDensity` divides by (one mean for a sequence); `volume.bbox` is the resolved
|
|
76
|
+
box; the volume follows a `source.replace()` by itself (`syncSource`, per draw).
|
|
77
|
+
- `VDBSequence<TFrame>` plays any frame type; `start({ source })` swaps dense `.wvdb` frames into a
|
|
78
|
+
`vdbDenseTextures` source. A dense `replace` reads a channel the frame lacks as its absent value (emission 0, mask
|
|
79
|
+
and albedo 1) and ignores a channel the source lacks. A `seek` while stopped shows the frame once decoded.
|
|
80
|
+
- `VDBSequence` frame range and ping-pong: `range: [start, end]` (inclusive; default all frames) limits playback, and
|
|
81
|
+
`loopMode: 'once' | 'repeat' | 'pingpong'` (default `'repeat'`) holds, wraps or turns around at the range end (each
|
|
82
|
+
end frame shown once per turn). `setRange()` / `setLoopMode()` change them while playing; the prefetch ring follows
|
|
83
|
+
the playback order. New types `VDBSequenceRange`, `VDBSequenceLoopMode`.
|
|
84
|
+
- `wvdbDenseToNvdb(...).sparseSourceOptions` (`@pmndrs/vdb/tools`): the index box, dense stats and box that line a
|
|
85
|
+
sparse copy of a `.wvdb` level up with the dense source, spread into `vdbSparseSource`.
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
|
|
89
|
+
- `vdbDecodeToAtlasGpu` / `vdbDecodeToAtlas` / `vdbDecodeToAtlasCpu` sample voxel centres: cell `i` reads index
|
|
90
|
+
position `min + (i + 0.5) * (max - min + 1) / n - 0.5`, so at full resolution it is voxel `min + i` (v1 sampled
|
|
91
|
+
half a voxel past, and the last cell read the background). Atlases span the box `[min - 0.5, max + 0.5]` instead
|
|
92
|
+
of `[min, max + 1]`.
|
|
93
|
+
- `VDBSequence` has one loop knob: the `loop: boolean` option and getter are gone; `loopMode: 'once' | 'repeat' |
|
|
94
|
+
'pingpong'` (default `'repeat'`, as `loop: true` was; `'once'` is the old `loop: false`, holding at the range end)
|
|
95
|
+
is settable while playing with `setLoopMode()`. A ping-pong keeps its direction across `stop()` / `resume()`,
|
|
96
|
+
`seek()` and `setRange()` (RV).
|
|
97
|
+
- `VDBVolumeUniforms` has `dispose()`: a sparse source's uniforms drop the listeners they registered on the source.
|
|
98
|
+
`VDBFrameVolume.dispose()` calls it; call it for uniforms you made with `vdbVolumeUniforms` (RV).
|
|
99
|
+
|
|
100
|
+
### Fixed
|
|
101
|
+
|
|
102
|
+
- `VDBSequence` ping-pong paused on the way back resumed forward, onto a frame its prefetch ring had evicted (a
|
|
103
|
+
stall and a dropped frame); it now resumes on the way back (RV).
|
|
104
|
+
- `VDBSequence`: a frame the clock made due, still decoding at `stop()`, was shown when its decode landed; now only a
|
|
105
|
+
frame asked for (`start`, `seek`, `setRange`, `setLoopMode`) lands while stopped (RV).
|
|
106
|
+
- `vdbSparseSource` with `followImage`: a new image whose grid type the `VDBGridNode` does not compile read 0 silently;
|
|
107
|
+
it now throws `VDB_TYPE_NOT_COMPILED` naming `VDBCoarseFirstEvent.types` as the fix (as does making a source over
|
|
108
|
+
such a grid) (RV).
|
|
109
|
+
- `vdbSparseSource` kept a stats listener (and, with `followImage`, a layout listener) for every `VDBFrameVolume` made
|
|
110
|
+
over it, for the source's lifetime (RV).
|
|
111
|
+
- `vdbSparseSource` with `followImage` destroyed the old pyramid textures at once on a swap (three r187's
|
|
112
|
+
`texture.dispose()` destroys the GPU texture), though a pass recorded in the same render could still bind them; they
|
|
113
|
+
are now destroyed once the queue's submitted work is done (RV).
|
|
114
|
+
- A `VDBFrameVolume` over a dense source kept the first frame's box: a `VDBSequence` frame with another `.wvdb` box was
|
|
115
|
+
stretched into it. The box now follows the frame's box unless the volume was given a `bbox`, as mjurczyk's WVDB
|
|
116
|
+
sequences give each frame its own box (RV).
|
|
117
|
+
- `wvdbDenseToNvdb` gave the grid one voxel size (the x side's), so a `.wvdb` level with non-cubic voxels (any
|
|
118
|
+
default bake: each side's texel count rounds on its own) read back shifted and stretched in world space. Each axis
|
|
119
|
+
now gets its own voxel size; smoke.vdb's default 128 bake measures 42.3% with `vdbResampleError` (was 45.4%; a
|
|
120
|
+
`dimensions: [128, 128, 128]` bake 37.4%, was 92.4%) (G15a).
|
|
121
|
+
- `VDBFrameVolume.densityScale` had no effect on a sparse source: the density uniform's per-render stats refresh
|
|
122
|
+
overwrote the per-draw value. A new mean from a replaced image is now applied once, when its readback lands (K5.9a).
|
|
123
|
+
- Mesh shadows with `multipleScattering: 'neural'` and temporal/jitter in `'frame'` lighting failed WGSL validation
|
|
124
|
+
in `VDBFrameTransmittanceMaterial` ("unresolved value 'nodeUniform0'"): the network's layout function is now built
|
|
125
|
+
per material build (K5.9b).
|
|
126
|
+
|
|
127
|
+
### Notes
|
|
128
|
+
|
|
129
|
+
- `vdbReadValueCpu` returns the exact f64 decode; `vdbReadValueF32` matches the GPU evaluation order. The two can
|
|
130
|
+
differ by 1 ulp on Fp grids.
|
|
131
|
+
- Public names follow D32: library API is `VDB*` / `VDB_*` / `vdb*`; anything bound to one file format keeps its
|
|
132
|
+
prefix (`Vdb*` for `.vdb`, `Nvdb*` for `.nvdb`, `Wvdb*` for `.wvdb`). Each entry point exports only the
|
|
133
|
+
user-facing API.
|
|
134
|
+
- The `majorant` WGSL profile is not in 0.1 (`VDB_BAD_OPTION`).
|
|
135
|
+
- `@webgpu/types` is a dependency so the shipped declarations type-check in your project.
|
|
136
|
+
- The vendored `pnanovdb.wgsl` keeps its Apache-2.0 licence and NOTICE, shipped in the package, as does
|
|
137
|
+
`THIRD_PARTY_NOTICES.md`.
|
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,449 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pmndrs/vdb
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sparse NanoVDB volumes on WebGPU: an engine-free WGSL core, pure-TypeScript CPU tools and a three.js adapter with a
|
|
4
|
+
froxel volume renderer, level sets and points. 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 | WebGPU, no engine |
|
|
11
|
+
| `@pmndrs/vdb/tools` | CPU side: `.nvdb` and `.wvdb` read/write, CPU reads (`vdbReadValueCpu`, `vdbSampleTrilinear`), `.vdb` parser, NanoVDB builder, quantizer, resampler | no |
|
|
12
|
+
| `@pmndrs/vdb/three` | the three.js / TSL adapter: `VDBGridNode` (a pool in three's node system), `VDBVolumeMaterial`, the froxel renderer (`VDBFrameVolume`, `VDBFrameRenderer`), `VDBLevelSetMaterial`, `VDBPoints`, `VDBSequence`, 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
|
+
## `@pmndrs/vdb` (core) and the raw WGSL module
|
|
24
|
+
|
|
25
|
+
The engine-free WebGPU layer: `VDBGridPool` (NanoVDB grids in one storage buffer on the host's `GPUDevice`), the
|
|
26
|
+
generated `vdb*` WGSL module for reading, sampling and marching them (`vdbModuleWgsl`), and GPU compute tools. It
|
|
27
|
+
knows nothing about three.js or any other engine. Loading `.nvdb` files is in `@pmndrs/vdb/tools` (`NvdbFile`).
|
|
28
|
+
|
|
29
|
+
### What's in the box
|
|
30
|
+
|
|
31
|
+
- **`vendor/pnanovdb.wgsl`** — a WGSL module with the NanoVDB root ->
|
|
32
|
+
upper -> lower -> leaf tree traversal, HDDA ray marching, and
|
|
33
|
+
Float/Fp4/Fp8/Fp16/FpN value decoders. Import it as raw text (`?raw` in Vite,
|
|
34
|
+
or read the file yourself) and splice it into your own shader.
|
|
35
|
+
- **`NvdbFile`** (`@pmndrs/vdb/tools`) — parses a `.nvdb` file (header + per-grid metadata +
|
|
36
|
+
grid images), handling the NONE/ZIP codecs.
|
|
37
|
+
- **A pure-TypeScript CPU reference** (`@pmndrs/vdb/tools`: `vdbReadValueCpu`, `vdbReadValueF32`,
|
|
38
|
+
`vdbSampleTrilinear`) — the exact same tree descent as the WGSL
|
|
39
|
+
module, so you can sanity-check GPU results or read voxels with no GPU
|
|
40
|
+
at all (Node, workers, tests).
|
|
41
|
+
|
|
42
|
+
### Quickstart: load a file and read a voxel
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { NvdbFile, vdbReadValueCpu } from "@pmndrs/vdb/tools";
|
|
46
|
+
|
|
47
|
+
const file = await NvdbFile.fromURL("/fixtures/sphere_fog_float.nvdb");
|
|
48
|
+
const gridImage = file.gridImage(0); // flat Uint32Array — the grid, as-is on disk
|
|
49
|
+
const meta = file.grids[0]!;
|
|
50
|
+
console.log(meta.name, meta.gridType, meta.voxelCount);
|
|
51
|
+
|
|
52
|
+
const { value, active } = vdbReadValueCpu(gridImage, [12, 4, -3]);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`gridImage` is a zero-copy view into the file's buffer when possible
|
|
56
|
+
(`file.isGridImageZeroCopy(0)` tells you which) — upload it straight into a GPU
|
|
57
|
+
`storage` buffer, no reshaping needed.
|
|
58
|
+
|
|
59
|
+
### Loading the raw WGSL module
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import pnanovdbSource from "@pmndrs/vdb/pnanovdb.wgsl?raw"; // Vite/bundler `?raw` import
|
|
63
|
+
// or, outside a bundler: fetch(import.meta.resolve("@pmndrs/vdb/pnanovdb.wgsl"))
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`pnanovdbSource` is the library's text, unmodified. It's a genuine C-style
|
|
67
|
+
library, not a drop-in snippet: its reads all bottom out in one function,
|
|
68
|
+
`pnanovdb_buf_read_uint32`, that expects the *consumer* to declare a
|
|
69
|
+
module-scope `var<storage, read> nanovdb_buffer: array<u32>` binding (see
|
|
70
|
+
`vendor/VENDOR.md` for the exact contract) — plus `pnanovdb_buf_t`/address
|
|
71
|
+
plumbing and (for point-sampling) an accessor struct. You rarely need it
|
|
72
|
+
directly: the core's generator (`vdbModuleWgsl`) builds a pool-aware `vdb*`
|
|
73
|
+
module from it. Integrations to copy from instead of re-deriving the binding:
|
|
74
|
+
|
|
75
|
+
- **`examples/src/demos/08-webgpu-smoke`**: raw WebGPU on the core
|
|
76
|
+
(`VDBGridPool` + `vdbModuleWgsl`), no engine.
|
|
77
|
+
- **`@pmndrs/vdb/three`** ([`src/three`](https://github.com/pmndrs/vdb/tree/main/packages/vdb/src/three)): `VDBGridNode` binds
|
|
78
|
+
the pool through three's node system (below).
|
|
79
|
+
- **`examples/src/demos/03-gpu-read`** is a from-scratch, heavily-commented
|
|
80
|
+
raw-WebGPU walkthrough (no three.js) that hand-derives a FLOAT-only
|
|
81
|
+
traversal function equivalent to this library's, teaching the byte
|
|
82
|
+
layout end to end.
|
|
83
|
+
|
|
84
|
+
### Supported grid types / codecs
|
|
85
|
+
|
|
86
|
+
| Grid type | Read (WGSL + CPU) | Notes |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `Float` | yes | lossless, 4 bytes/voxel |
|
|
89
|
+
| `Fp8` | yes | per-leaf min/quantum, 1 byte/voxel |
|
|
90
|
+
| `FpN` | yes | per-leaf variable bit-width (oracle-matched to native) |
|
|
91
|
+
| `Fp4`, `Fp16` | yes | per-leaf min/quantum |
|
|
92
|
+
| other `GridType`s | rejected | `NvdbFile` throws a clear "unsupported grid type" error |
|
|
93
|
+
|
|
94
|
+
| File codec | Support |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `NONE` | yes |
|
|
97
|
+
| `ZIP` (zlib, via `fflate`) | read and write (`writeNvdb(images, { codec: 'zip' })`) |
|
|
98
|
+
| `BLOSC` | not supported for `.nvdb`: throws; re-export with `nanovdb_convert --codec=zip` (Blosc inside `.vdb` files is supported) |
|
|
99
|
+
|
|
100
|
+
### The vendoring story
|
|
101
|
+
|
|
102
|
+
The WGSL module is not written from scratch: per
|
|
103
|
+
[decision D2](https://github.com/pmndrs/vdb/blob/main/docs/archive/v1/DECISIONS.md#d2--gpu-traversal-base), it's
|
|
104
|
+
**vendored as a pinned, audited fork** of
|
|
105
|
+
[emcfarlane/webgpu-nanovdb](https://github.com/emcfarlane/webgpu-nanovdb)'s
|
|
106
|
+
`pnanovdb.wgsl` — Apache-2.0, NOTICE preserved, every local change logged
|
|
107
|
+
in-tree. We're prepared to diverge permanently and happy to upstream
|
|
108
|
+
fixes if the author engages. Full pin/hash/diff-log details:
|
|
109
|
+
[`vendor/VENDOR.md`](./vendor/VENDOR.md).
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## `@pmndrs/vdb/tools`
|
|
113
|
+
|
|
114
|
+
The CPU half: parse `.vdb` containers, build
|
|
115
|
+
NanoVDB grid images (from a dense array or straight from a parsed `.vdb`),
|
|
116
|
+
quantize to Fp4/Fp8/Fp16/FpN, apply affine transforms, inspect memory layout, and
|
|
117
|
+
write `.nvdb` files — all **pure TypeScript, no WASM** (the one runtime dependency is
|
|
118
|
+
`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)).
|
|
119
|
+
WASM stays an optional escalation rung, adopted only on demonstrated need
|
|
120
|
+
— nothing in this package requires it.
|
|
121
|
+
|
|
122
|
+
### Quickstart: the demo 07 pipeline
|
|
123
|
+
|
|
124
|
+
The full authoring round-trip — generate/obtain voxels, build a NanoVDB
|
|
125
|
+
grid, optionally quantize, write a real `.nvdb` file — trimmed from
|
|
126
|
+
[`examples/src/demos/07-builder`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/07-builder):
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { vdbBuildFromDenseDetailed, vdbQuantize, writeNvdb } from "@pmndrs/vdb/tools";
|
|
130
|
+
|
|
131
|
+
const dim = 32;
|
|
132
|
+
const values = new Float32Array(dim * dim * dim); // fill with your density field
|
|
133
|
+
// ... write nonzero values into `values` at your active voxels ...
|
|
134
|
+
|
|
135
|
+
const built = vdbBuildFromDenseDetailed(values, [dim, dim, dim], {
|
|
136
|
+
gridName: "my_grid",
|
|
137
|
+
background: 0,
|
|
138
|
+
});
|
|
139
|
+
// built: { image: Uint32Array, voxelCount, indexBBox, worldBBox, voxelSize, nodeCounts }
|
|
140
|
+
|
|
141
|
+
const fp8Image = vdbQuantize(built.image, "fp8"); // or "fpn"; per-leaf min/quantum, native-exact rounding
|
|
142
|
+
|
|
143
|
+
const fileBuffer = writeNvdb([fp8Image]); // ArrayBuffer — a real NanoVDB2 file, ready to save/upload
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`fileBuffer` round-trips through `NvdbFile.fromArrayBuffer`
|
|
147
|
+
byte-for-byte (that loader is this subpath's read path, see above).
|
|
148
|
+
|
|
149
|
+
### Quickstart: parse a real `.vdb` and build NanoVDB from it
|
|
150
|
+
|
|
151
|
+
The drop-in-a-file pipeline, trimmed from
|
|
152
|
+
[`examples/src/demos/06-explorer`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/06-explorer):
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import { parseVdb, buildFromVdbDetailed, vdbInspect } from "@pmndrs/vdb/tools";
|
|
156
|
+
|
|
157
|
+
const buffer = await fetch("/fixtures/vdb-samples/utahteapot.vdb").then((r) => r.arrayBuffer());
|
|
158
|
+
const vdbFile = parseVdb(buffer); // { fileVersion, grids: VdbGrid[] }
|
|
159
|
+
|
|
160
|
+
const built = buildFromVdbDetailed(vdbFile.grids[0]!); // streams leaves, no dense allocation
|
|
161
|
+
const report = vdbInspect(built.image);
|
|
162
|
+
console.log(report.nodeCounts, report.memoryBreakdown);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`buildFromVdb`/`buildFromVdbDetailed` (float grids) stream the parser's leaves straight
|
|
166
|
+
into the NanoVDB serializer (proven on a 7M-voxel teapot with no dense
|
|
167
|
+
array), carrying the `.vdb` file's uniform scale+translate transform into
|
|
168
|
+
the NanoVDB `Map`.
|
|
169
|
+
|
|
170
|
+
### API surface
|
|
171
|
+
|
|
172
|
+
| Function | What it does |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `parseVdb(buffer)` | Reads a `.vdb` container: float, vec3 and point grids, 5-4-3 tree, uncompressed, zlib or Blosc, active tiles |
|
|
175
|
+
| `vdbBuildFromDense` / `vdbBuildFromDenseDetailed` | Dense `Float32Array` -> NanoVDB FLOAT grid image |
|
|
176
|
+
| `vdbBuildFromLeavesDetailed` | Lower-level: build from an already-leaf-shaped source (what `buildFromVdb` and `vdbQuantize` are built on) |
|
|
177
|
+
| `buildFromVdb` / `buildFromVdbDetailed` | Parsed `.vdb` grid -> NanoVDB FLOAT grid image, leaf-streamed |
|
|
178
|
+
| `vdbQuantize` / `vdbQuantizeDetailed` | FLOAT grid image -> Fp4/Fp8/Fp16/FpN (per-leaf min/quantum; FpN bit-width picked per leaf) |
|
|
179
|
+
| `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)) |
|
|
180
|
+
| `vdbInspect` | Node counts + memory-by-section breakdown, summing to the grid's total byte size |
|
|
181
|
+
| `writeNvdb` | Serializes one or more grid images into a `.nvdb` file `ArrayBuffer` (NanoVDB2, `io::Segment` layout; `{ codec: 'zip' }` for NanoVDB's ZIP codec) |
|
|
182
|
+
| `vdbBakeCoarseFirst` | Coarse-first `.nvdb`: a small preview grid (`<name>.lod48`, box, FpN) then the full grid, ZIP by default |
|
|
183
|
+
| `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 |
|
|
184
|
+
| `NvdbFile` | Reads a `.nvdb` held in memory or fetched (`fromArrayBuffer` / `fromURL`); there is no separate `readNvdb` |
|
|
185
|
+
|
|
186
|
+
### Supported `.vdb` subset
|
|
187
|
+
|
|
188
|
+
| | Support |
|
|
189
|
+
|---|---|
|
|
190
|
+
| Grid type | float, vec3 (`Vec3f`/`Vec3d`/`Vec3i`) and point data grids |
|
|
191
|
+
| Tree configuration | 5-4-3 (OpenVDB's default) |
|
|
192
|
+
| Compression | none, zlib, Blosc (LZ4 and zlib) |
|
|
193
|
+
| Half-float leaf storage | yes |
|
|
194
|
+
| Transform | uniform scale + translate (affine `Map`); non-uniform/rotated throws on `vdbTransform()`, parses fine on `parseVdb()`/`buildFromVdb()` |
|
|
195
|
+
|
|
196
|
+
### Native parity
|
|
197
|
+
|
|
198
|
+
Every function above is validated byte/value-wise against real
|
|
199
|
+
`nanovdb_convert`/OpenVDB output on the project's fixture corpus (four
|
|
200
|
+
openvdb.org samples + primitives). The one anchor that needs a native
|
|
201
|
+
machine to close out (this package's numbers already match at every
|
|
202
|
+
tested coordinate) is tracked in
|
|
203
|
+
[`docs/archive/handoffs/PHASE-5.md`](https://github.com/pmndrs/vdb/blob/main/docs/archive/handoffs/PHASE-5.md)
|
|
204
|
+
— see that doc for the full parity checklist and known semantic edge
|
|
205
|
+
cases (root background vs. near-field tile fill, active-tile compression,
|
|
206
|
+
CRC).
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
## `@pmndrs/vdb/three`
|
|
210
|
+
|
|
211
|
+
The three.js adapter over the engine-free core (D8), on three r187 (D23). The
|
|
212
|
+
grids live in a `VDBGridPool` on the renderer's `GPUDevice`; `VDBGridNode`
|
|
213
|
+
puts that pool into three's node system without copying it (three binds the
|
|
214
|
+
pool's own buffer); `VDBVolumeMaterial` raymarches one pooled grid, and
|
|
215
|
+
`VDBSequence` plays frames into one pool id.
|
|
216
|
+
|
|
217
|
+
### Quickstart: render a cloud
|
|
218
|
+
|
|
219
|
+
This mirrors [`examples/src/demos/02-cloud`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/02-cloud),
|
|
220
|
+
trimmed to the essentials (no camera controls, no live uniforms):
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
import * as THREE from "three/webgpu";
|
|
224
|
+
import { VDBGridPool } from "@pmndrs/vdb";
|
|
225
|
+
import { NvdbFile } from "@pmndrs/vdb/tools";
|
|
226
|
+
import { VDBGridNode, VDBVolumeMaterial, getDevice, vdbProxyGeometry } from "@pmndrs/vdb/three";
|
|
227
|
+
|
|
228
|
+
// The host owns the device: the pool's limits, passed to the renderer so the
|
|
229
|
+
// pool outlives renderer.dispose() (a renderer that made its own device destroys it).
|
|
230
|
+
const adapter = await navigator.gpu.requestAdapter();
|
|
231
|
+
const device = await adapter!.requestDevice({ requiredLimits: VDBGridPool.requiredLimits(adapter!) });
|
|
232
|
+
const renderer = new THREE.WebGPURenderer({ device, canvas });
|
|
233
|
+
await renderer.init();
|
|
234
|
+
|
|
235
|
+
const file = await NvdbFile.fromURL("/fixtures/wdas_cloud_quarter_fp8.nvdb");
|
|
236
|
+
const pool = await VDBGridPool.create(getDevice(renderer));
|
|
237
|
+
const id = pool.add(file.gridImage(0));
|
|
238
|
+
pool.flush(); // writes the grid (or record pool.update(encoder) into your own encoder)
|
|
239
|
+
|
|
240
|
+
// One VDBGridNode per pool, renderer and shader (one WGSL module per shader).
|
|
241
|
+
// The material needs the support-box ray clip helper.
|
|
242
|
+
const grids = new VDBGridNode(renderer, pool, { helpers: ["rayClipSupport"] });
|
|
243
|
+
const material = new VDBVolumeMaterial(renderer, grids, id, { densityScale: 40 });
|
|
244
|
+
const scene = new THREE.Scene();
|
|
245
|
+
scene.add(new THREE.Mesh(vdbProxyGeometry(pool.info(id)), material));
|
|
246
|
+
|
|
247
|
+
// Every frame: the pool's update first (submitted), then the node, then three.
|
|
248
|
+
pool.flush();
|
|
249
|
+
grids.update(); // rebinds only when a growth replaced pool.buffer
|
|
250
|
+
await renderer.renderAsync(scene, camera);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- **`VDBGridNode(renderer, pool, { types?, profile?, sampler?, isActive?, outside?, helpers?, name? })`**:
|
|
254
|
+
the module options minus the binding (three assigns it). `types` defaults to
|
|
255
|
+
the pool's types now; pass every type you will add (or
|
|
256
|
+
`VDB_ALL_SCALAR_TYPES`) when the pool fills later. TSL helpers:
|
|
257
|
+
`vdbSample(grids, id, position, { space: 'world' | 'index' })` and
|
|
258
|
+
`vdbReadValue(grids, id, ijk)`; or call the WGSL API from your own
|
|
259
|
+
`wgslFn(src, [grids.module])` (demo 01 does both). A node binds through the
|
|
260
|
+
renderer it was made with: a shader another renderer builds, or a shader
|
|
261
|
+
holding a second node's module, throws `VDB_BAD_OPTION` (make one node per
|
|
262
|
+
renderer; read every grid of a shader through one node, by id). The first
|
|
263
|
+
node on a renderer self-tests three's attribute internals before the pool's
|
|
264
|
+
buffer reaches three (`VDB_ENGINE_MISMATCH` if three would destroy it); a
|
|
265
|
+
three other than r187 warns once, and so does a renderer that made its own
|
|
266
|
+
device (its `dispose()` destroys the pool's buffer).
|
|
267
|
+
- **`VDBVolumeMaterial(renderer, grids, gridId, params)`**: needs a node with
|
|
268
|
+
profile `sample` or `march` and `helpers: ['rayClipSupport']`. The march is
|
|
269
|
+
one `wgslFn` over the public API: world ray to index space through the pool
|
|
270
|
+
record (`pool.setTransform` instances work), clipped to the trilinear
|
|
271
|
+
support box, fixed-step density with `vdbSample`, Henyey-Greenstein sun with
|
|
272
|
+
a shadow march, ambient, and a per-fragment sample budget. Every tunable is
|
|
273
|
+
a live uniform (`material.densityScale.value = 45`, `material.stepSize.value`,
|
|
274
|
+
`maxSteps`, `sunDirection`, `sunColor`, `sunIntensity`, `anisotropy`,
|
|
275
|
+
`shadowSteps`, `shadowDensity`, `ambient`, `jitter`); `gridId` is a `uint`
|
|
276
|
+
uniform when given as a number, so `material.gridId.value = other` switches
|
|
277
|
+
grids without a rebuild (give the mesh a new `vdbProxyGeometry` for the
|
|
278
|
+
other grid, and after `pool.setTransform`). Caps (`maxStepsCap`,
|
|
279
|
+
`shadowStepsCap`, `sampleBudgetCap`) are compiled in. The march runs in index
|
|
280
|
+
space: `stepSize` is in index voxels and opacity integrates per index voxel,
|
|
281
|
+
so scaling a grid with `setTransform` changes its size on screen, not its
|
|
282
|
+
opacity. Perspective cameras only. `grids` must come from the same renderer.
|
|
283
|
+
- **`vdbProxyGeometry(pool.info(id), { pad? })`**: the world box to put the
|
|
284
|
+
material on (add the mesh with an identity transform). `pad: 1` also covers
|
|
285
|
+
the min-side half voxel of the trilinear support.
|
|
286
|
+
- **`getDevice(renderer)`, `getGPUTexture(renderer, texture)`**: the raw
|
|
287
|
+
WebGPU handles, as in `@pmndrs/upscaler` and `@pmndrs/denoiser`.
|
|
288
|
+
- Gone since v1: `NanoVDBGrid` (use `pool.info(id)` and `vdbProxyGeometry`),
|
|
289
|
+
`NanoVDBVolumeMaterial` (use `VDBVolumeMaterial`), `NanoVDBSequence` (use
|
|
290
|
+
`VDBSequence`), `assembleVolumeWgsl`/`rewriteBufferGlobal`, and the
|
|
291
|
+
`createVolumeRenderer` bootstrap with `computeRequiredLimits`/`nextPow2`
|
|
292
|
+
(create the device yourself with `VDBGridPool.requiredLimits(adapter)`, as
|
|
293
|
+
in the quickstart).
|
|
294
|
+
|
|
295
|
+
### Compute utilities
|
|
296
|
+
|
|
297
|
+
Compute passes over a grid in a `VDBGridPool` (K2.3). The engine-free core
|
|
298
|
+
records into your encoder and hands back a readback you resolve after
|
|
299
|
+
submitting; the three wrappers take the renderer and return promises:
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
import { VDBGridPool, vdbGridStatsGpu, vdbDecodeToAtlasGpu, vdbApplyValueTransform } from "@pmndrs/vdb";
|
|
303
|
+
|
|
304
|
+
const id = pool.add(image);
|
|
305
|
+
pool.update(encoder); // or pool.flush()
|
|
306
|
+
const stats = vdbGridStatsGpu(device, pool, id, { encoder, histogramBins: 256 });
|
|
307
|
+
const atlas = vdbDecodeToAtlasGpu(device, pool, id, { encoder, maxDim: 128, format: "uint8" });
|
|
308
|
+
device.queue.submit([encoder.finish()]);
|
|
309
|
+
// With your encoder, say it was submitted before reading (read() earlier rejects with VDB_BAD_OPTION):
|
|
310
|
+
await stats.submitted().read(); // { min, max, mean, histogram, activeVoxelCount, usedAtomicFastPath, range }
|
|
311
|
+
await atlas.submitted().read(); // { data: Uint8Array | Float32Array, dims, range }; atlas.buffer is the raw f32 GPU output
|
|
312
|
+
|
|
313
|
+
// Per-voxel edits run on the CPU (the pool is read-only to shaders) and are staged with pool.replace:
|
|
314
|
+
vdbApplyValueTransform(pool, id, image, "double"); // or (v) => v * 2; Float grids only
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import { vdbGridStats, vdbDecodeToAtlas } from "@pmndrs/vdb/three";
|
|
319
|
+
|
|
320
|
+
const stats = await vdbGridStats(renderer, pool, id);
|
|
321
|
+
const { data, dims, range, texture } = await vdbDecodeToAtlas(renderer, pool, id, { maxDim: 128 }); // texture: Data3DTexture
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The three wrappers submit their own encoder. The value transform has no three
|
|
325
|
+
wrapper: call the core `vdbApplyValueTransform`.
|
|
326
|
+
|
|
327
|
+
Each tool frees only the buffers it allocated (in `read()` or `dispose()`).
|
|
328
|
+
`vdbGridStatsGpu` bins over the grid's root min/max statistics (a grid with a
|
|
329
|
+
negative root min takes the dump path, 8 B per bbox voxel, and is refused up
|
|
330
|
+
front when that exceeds the device's buffer limits); `vdbDecodeToAtlasGpu`
|
|
331
|
+
normalizes to them by default. Atlas cell `i` of an axis with `n` cells over `[min, max]` samples index position
|
|
332
|
+
`min + (i + 0.5) * (max - min + 1) / n - 0.5`, so at full resolution cell `i` is
|
|
333
|
+
voxel `min + i` (the last cell is `max`); the texture spans the voxel-centred box
|
|
334
|
+
`[min - 0.5, max + 0.5]`. `vdbApplyValueTransform` rewrites leaf values
|
|
335
|
+
(not tiles) and does not recompute the image's statistics. CPU versions live in
|
|
336
|
+
`@pmndrs/vdb/tools` (`vdbGridStatsCpu`, `vdbDecodeToAtlasCpu`). See
|
|
337
|
+
[`examples/src/demos/04-atlas-fallback`](https://github.com/pmndrs/vdb/tree/main/examples/src/demos/04-atlas-fallback)
|
|
338
|
+
for the atlas fallback path through a stock `Data3DTexture`.
|
|
339
|
+
|
|
340
|
+
### Coarse-first loading: `vdbStreamCoarseFirst`
|
|
341
|
+
|
|
342
|
+
A file baked with `vdbBakeCoarseFirst` (`@pmndrs/vdb/tools`) holds a ~12 KiB preview grid before the full grid
|
|
343
|
+
([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
|
|
344
|
+
preview to the pool with the full grid's size reserved, and replaces it in place when the full grid is in:
|
|
345
|
+
|
|
346
|
+
```ts
|
|
347
|
+
import { vdbStreamCoarseFirst } from "@pmndrs/vdb/three";
|
|
348
|
+
|
|
349
|
+
const { id } = await vdbStreamCoarseFirst(pool, await fetch("/smoke.coarse.nvdb"), {
|
|
350
|
+
// After each swap: densityScale = base x voxelRatio (the material marches in index voxels), the proxy box
|
|
351
|
+
// from pool.info(id), pool.flush() + grids.update(), and `majorant(event)` re-applied (replace drops it).
|
|
352
|
+
bind: { material, mesh, grids },
|
|
353
|
+
onGrid: (e) => console.log(e.final ? "full" : "preview"),
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Every `bind` member is optional. `vdbCoarseFirstApply(pool, event, bind)` is the same work for an async `onGrid`.
|
|
358
|
+
Call `pool.update(encoder)` / `pool.flush()` and `grids.update()` in your frame loop as usual.
|
|
359
|
+
|
|
360
|
+
### Sequences: `VDBSequence`
|
|
361
|
+
|
|
362
|
+
`VDBSequence` plays per-frame `.nvdb` URLs into ONE pool grid with
|
|
363
|
+
`pool.replace(id, frame)`: no material rebuild, no shader recompile, and with
|
|
364
|
+
the capacity reserved, no buffer move either:
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
import { VDBSequence } from "@pmndrs/vdb/three";
|
|
368
|
+
|
|
369
|
+
// Reserve room for the largest frame: every replace then writes in place
|
|
370
|
+
// (no pool.version change, no VDBGridNode rebind, no new bind group).
|
|
371
|
+
const id = pool.add(firstFrame, { capacity: largestFrameBytes });
|
|
372
|
+
const material = new VDBVolumeMaterial(renderer, grids, id);
|
|
373
|
+
|
|
374
|
+
const sequence = new VDBSequence({
|
|
375
|
+
urls: (i) => `/fixtures/embergen/pack/frame_${i}.nvdb`,
|
|
376
|
+
frameCount: 48,
|
|
377
|
+
fps: 24,
|
|
378
|
+
loopMode: "repeat", // or "pingpong", or "once" (hold the last frame); setLoopMode() changes it while playing
|
|
379
|
+
});
|
|
380
|
+
await sequence.preload();
|
|
381
|
+
sequence.start({ pool, id });
|
|
382
|
+
// each animation frame:
|
|
383
|
+
sequence.update(performance.now()); // may pool.replace(id, frame)
|
|
384
|
+
pool.flush(); // or pool.update(encoder) in your encoder, submitted before three renders
|
|
385
|
+
grids.update();
|
|
386
|
+
await renderer.renderAsync(scene, camera);
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
A frame larger than the reserved capacity still plays: the pool moves it and
|
|
390
|
+
may grow, which is why `grids.update()` runs after the pool's update every
|
|
391
|
+
frame. The sequence never blocks the render loop: if a frame isn't decoded
|
|
392
|
+
when its time comes, it holds the last frame, counts a stall, and keeps going
|
|
393
|
+
(`sequence.stats`: `frame`, `decodedAhead`, `stalls`, `swaps`, `replaceMs`,
|
|
394
|
+
`failed`). A frame whose loader rejects fires `onError` once and is not
|
|
395
|
+
retried until `seek()` or `start()`; playback skips it. After `dispose()`,
|
|
396
|
+
late decodes are dropped and `start`/`seek`/`resume`/`preload` throw
|
|
397
|
+
`VDB_DISPOSED`.
|
|
398
|
+
|
|
399
|
+
Frame arrays are held by reference: the pool keeps an image until the update
|
|
400
|
+
that writes it, and until `pool.settled()` resolves while a growth is
|
|
401
|
+
unconfirmed. The player never writes into them; a custom `loader` that
|
|
402
|
+
recycles frame buffers must not reuse one before `await pool.settled()` after
|
|
403
|
+
the update that wrote it.
|
|
404
|
+
|
|
405
|
+
### The froxel volume renderer
|
|
406
|
+
|
|
407
|
+
`VDBFrameVolume` and `VDBFrameRenderer` (ported from mjurczyk/openvdb, re-based on the sparse pool) render volumes
|
|
408
|
+
through a froxel grid with `'volume'` or `'frame'` lighting, temporal accumulation, phase functions (including
|
|
409
|
+
Lorenz-Mie), multiple scattering (two-sided, octaves, neural), spectral media and measured presets, mesh shadows and an
|
|
410
|
+
emission light. Volume sources are dense (`vdbDenseTextures`) or sparse (`vdbSparseSource`, with LOD). See
|
|
411
|
+
[docs/site/three/frame-renderer.mdx](https://github.com/pmndrs/vdb/blob/main/docs/site/three/frame-renderer.mdx).
|
|
412
|
+
|
|
413
|
+
### Level sets and points
|
|
414
|
+
|
|
415
|
+
`VDBLevelSetMaterial` sphere-traces a level-set grid as a lit mesh surface (three's lights, shadows and depth).
|
|
416
|
+
`VDBPoints` draws a `.vdb` point grid (`vdbPointRenderData`) as instanced sprites.
|
|
417
|
+
|
|
418
|
+
### `.wvdb`
|
|
419
|
+
|
|
420
|
+
`@pmndrs/vdb/tools` reads and writes mjurczyk/openvdb's `.wvdb` format (`readWvdb`, `writeWvdb`, `WvdbStreamReader`,
|
|
421
|
+
`bakeWvdb`) and converts to and from NanoVDB (`vdbToWvdb`, `nvdbToWvdb`, `wvdbDenseToNvdb`). See
|
|
422
|
+
[docs/site/formats/nvdb-vs-wvdb.mdx](https://github.com/pmndrs/vdb/blob/main/docs/site/formats/nvdb-vs-wvdb.mdx).
|
|
423
|
+
|
|
424
|
+
### Device ownership (D8)
|
|
425
|
+
|
|
426
|
+
The host creates the `GPUDevice` (with `VDBGridPool.requiredLimits(adapter)`)
|
|
427
|
+
and passes it to `WebGPURenderer({ device })`; the pool and every other pmndrs
|
|
428
|
+
tool take `getDevice(renderer)`. A renderer built without `{ device }` owns
|
|
429
|
+
its device and destroys it, with the pool's buffer, in `renderer.dispose()`.
|
|
430
|
+
|
|
431
|
+
## Third-party code
|
|
432
|
+
|
|
433
|
+
This package is MIT (see [LICENSE](./LICENSE)). The vendored `pnanovdb.wgsl` and `PNanoVDB.h` are Apache-2.0.
|
|
434
|
+
The published package ships `vendor/NOTICE` and `vendor/LICENSE` (Apache-2.0) alongside the vendored WGSL, and
|
|
435
|
+
they must stay in the package and any redistribution. The `.wvdb` code, the froxel renderer, level sets and points port logic from
|
|
436
|
+
mjurczyk/openvdb (MIT). Test fixtures are CC0, and `fflate` is an MIT runtime dependency. The full list, with
|
|
437
|
+
licences and file locations, is in [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) (shipped in the package).
|
|
438
|
+
|
|
439
|
+
## Packaging note (for contributors)
|
|
440
|
+
|
|
441
|
+
The published export map points only at built `dist/` output (`dist/{core,tools,three}`, one `tsc` build).
|
|
442
|
+
Workspace Vite/Vitest/TypeScript configs alias `@pmndrs/vdb`, `@pmndrs/vdb/tools`, `@pmndrs/vdb/three` and
|
|
443
|
+
`@pmndrs/vdb/pnanovdb.wgsl` to `src/` for source-level development without exposing TypeScript source paths
|
|
444
|
+
to npm consumers.
|
|
445
|
+
|
|
446
|
+
Each subpath's `index.ts` is its public API, frozen by `test/api-surface.test.ts` (an export-list snapshot
|
|
447
|
+
and the D32 naming rule). Test oracles and other internals live in `src/{core,tools,three}/internal.ts`, which
|
|
448
|
+
re-exports the public API and is imported by path from tests, harnesses and scripts; it is never a package
|
|
449
|
+
export.
|