@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
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# Third-party notices for `@pmndrs/vdb`
|
|
2
|
+
|
|
3
|
+
`@pmndrs/vdb` is MIT licensed (see [LICENSE](./LICENSE)). The components below are third-party code, data or
|
|
4
|
+
published formulas that the package contains, derives from or depends on, with their licences. The repository
|
|
5
|
+
copy of this list is [THIRD_PARTY.md](https://github.com/pmndrs/vdb/blob/main/THIRD_PARTY.md).
|
|
6
|
+
|
|
7
|
+
## mjurczyk/openvdb (MIT)
|
|
8
|
+
|
|
9
|
+
Parts of the `.wvdb` reader, writer and baker, the dense and sparse volume sources, the froxel renderer, level sets
|
|
10
|
+
and points are ported from [mjurczyk/openvdb](https://github.com/mjurczyk/openvdb) (pinned commit `75e7345`,
|
|
11
|
+
v0.26.0; later commits are noted per file). The froxel renderer's ports live in the core frame renderer
|
|
12
|
+
(`src/core/frame/`) and the `./three` adapter. The upstream repository has an MIT LICENSE file since v0.32.0 (before that its npm packages declared MIT and
|
|
13
|
+
the author had confirmed the licence); the copyright line below is his LICENSE's. This notice applies to the files listed below, each of which carries a header "Portions derived from
|
|
14
|
+
mjurczyk/openvdb (MIT)" (or "derived from") naming its upstream paths.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
MIT License
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2022-present mjurczyk
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
22
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
23
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
24
|
+
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
27
|
+
the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
30
|
+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
32
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
33
|
+
DEALINGS IN THE SOFTWARE.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Source files in this package that derive from it (paths are in the source tree; the package ships them compiled
|
|
37
|
+
under `dist/`):
|
|
38
|
+
|
|
39
|
+
- `src/core/compute/multi-scale.ts` (commit `4e2d46f`)
|
|
40
|
+
- `src/core/compute/pyramid.ts`
|
|
41
|
+
- `src/core/frame/emission.ts`
|
|
42
|
+
- `src/core/frame/phase.ts`
|
|
43
|
+
- `src/core/frame/renderer.ts` (also commits `4b5393d`, `92421cc`, v0.31.0)
|
|
44
|
+
- `src/core/frame/scattering.ts` (also commits `4e2d46f`, `92421cc`)
|
|
45
|
+
- `src/core/frame/settings.ts`
|
|
46
|
+
- `src/core/frame/shadows.ts` (also commits `62a6e3e`, `c13f2d5`)
|
|
47
|
+
- `src/core/frame/wgsl/chunks.ts`
|
|
48
|
+
- `src/core/frame/wgsl/emission.ts`
|
|
49
|
+
- `src/core/frame/wgsl/environment.ts`
|
|
50
|
+
- `src/core/frame/wgsl/gather.ts`
|
|
51
|
+
- `src/core/frame/wgsl/integrate.ts`
|
|
52
|
+
- `src/core/frame/wgsl/lighting.ts` (also commit `4b5393d`, v0.31.0)
|
|
53
|
+
- `src/core/frame/wgsl/resolve.ts`
|
|
54
|
+
- `src/core/frame/wgsl/shadows.ts` (also commit `62a6e3e`)
|
|
55
|
+
- `src/core/source/dense-fill.ts`
|
|
56
|
+
- `src/core/source/dense.ts`
|
|
57
|
+
- `src/core/source/sparse-wgsl.ts`
|
|
58
|
+
- `src/core/source/sparse.ts`
|
|
59
|
+
- `src/core/surface/level-set-wgsl.ts`
|
|
60
|
+
- `src/core/surface/points.ts`
|
|
61
|
+
- `src/core/wgsl/level-set.ts`
|
|
62
|
+
- `src/three/frame/core-integrate-material.ts`
|
|
63
|
+
- `src/three/frame/emission-light.ts`
|
|
64
|
+
- `src/three/frame/medium.ts`
|
|
65
|
+
- `src/three/frame/renderer.ts`
|
|
66
|
+
- `src/three/frame/spectrum.ts`
|
|
67
|
+
- `src/three/frame/volume-shadows.ts` (also commits `62a6e3e`, `c13f2d5`)
|
|
68
|
+
- `src/three/frame/volume.ts`
|
|
69
|
+
- `src/three/level-set-material.ts`
|
|
70
|
+
- `src/three/points.ts`
|
|
71
|
+
- `src/three/sparse-source.ts`
|
|
72
|
+
- `src/three/volume-source.ts`
|
|
73
|
+
- `src/tools/cpu/level-set.ts`
|
|
74
|
+
- `src/tools/cpu/points.ts`
|
|
75
|
+
- `src/tools/frame/blackbody.ts`
|
|
76
|
+
- `src/tools/frame/emission.ts`
|
|
77
|
+
- `src/tools/frame/environment-gpu.ts`
|
|
78
|
+
- `src/tools/frame/environment.ts`
|
|
79
|
+
- `src/tools/frame/froxel.ts`
|
|
80
|
+
- `src/tools/frame/grid.ts`
|
|
81
|
+
- `src/tools/frame/index.ts`
|
|
82
|
+
- `src/tools/frame/medium.ts`
|
|
83
|
+
- `src/tools/frame/mie-table.ts` (generated by our port of his table generator, see below)
|
|
84
|
+
- `src/tools/frame/mie.ts`
|
|
85
|
+
- `src/tools/frame/mlp.ts`
|
|
86
|
+
- `src/tools/frame/multi-scale.ts` (commit `4e2d46f`)
|
|
87
|
+
- `src/tools/frame/neural.ts`
|
|
88
|
+
- `src/tools/frame/pyramid-layout.ts`
|
|
89
|
+
- `src/tools/frame/shadows.ts`
|
|
90
|
+
- `src/tools/frame/sparse.ts`
|
|
91
|
+
- `src/tools/frame/spectral-stack.ts`
|
|
92
|
+
- `src/tools/frame/spectral.ts`
|
|
93
|
+
- `src/tools/frame/stack.ts`
|
|
94
|
+
- `src/tools/frame/view.ts`
|
|
95
|
+
- `src/tools/vdb/point-render-data.ts`
|
|
96
|
+
- `src/tools/vdb/points.ts`
|
|
97
|
+
- `src/tools/wvdb/bake.ts`
|
|
98
|
+
- `src/tools/wvdb/dense.ts`
|
|
99
|
+
- `src/tools/wvdb/format.ts`
|
|
100
|
+
- `src/tools/wvdb/index.ts`
|
|
101
|
+
- `src/tools/wvdb/level-set.ts`
|
|
102
|
+
- `src/tools/wvdb/partial.ts`
|
|
103
|
+
- `src/tools/wvdb/read.ts`
|
|
104
|
+
- `src/tools/wvdb/write.ts`
|
|
105
|
+
|
|
106
|
+
`src/tools/frame/mie-table.ts` is the output of our port of his Mie table generator (after Bohren and Huffman's
|
|
107
|
+
BHMIE). The numbers are identical to his tables, but the file is generated, not copied.
|
|
108
|
+
|
|
109
|
+
### Neural indirect-light weights
|
|
110
|
+
|
|
111
|
+
`src/tools/frame/neural-weights.ts` holds the weights of the default `multipleScattering: 'neural'` network. They are
|
|
112
|
+
ours (MIT): trained by `scripts/k6/neural/` (derived from his training scripts, MIT as above) on procedural media
|
|
113
|
+
generated by our code only; no third-party volume data was read. Swap them with `VDBFrameRenderer.mlp`, or leave them
|
|
114
|
+
out (`null`: `'neural'` then runs as 1D diffusion). His own weights are no longer shipped.
|
|
115
|
+
|
|
116
|
+
## @pmndrs/bvh (MIT)
|
|
117
|
+
|
|
118
|
+
The WGSL name checker used by the tests, and the reserved-word list in `src/core/wgsl/reserved.ts` that it shares,
|
|
119
|
+
follow `@pmndrs/bvh` (`src/wgsl-names.ts`).
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
MIT License
|
|
123
|
+
|
|
124
|
+
Copyright (c) 2026 Dennis Smolek
|
|
125
|
+
|
|
126
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
127
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
128
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
129
|
+
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
130
|
+
|
|
131
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
132
|
+
the Software.
|
|
133
|
+
|
|
134
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
135
|
+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
136
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
137
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
138
|
+
DEALINGS IN THE SOFTWARE.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## pmndrs/denoiser (MIT)
|
|
142
|
+
|
|
143
|
+
`src/tools/frame/mlp-tza.ts` reads and writes the `.tza` v2 weight container after `denoiser-core`'s `parseTZA`
|
|
144
|
+
(`packages/denoiser-core/src/tza.ts`), and `src/tools/frame/mlp.ts` (`vdbFrameMlpPack`) lays a dense layer out as
|
|
145
|
+
`denoiser-wgsl`'s `packWeights` / `packBias` do (`packages/denoiser-wgsl/src/conv.ts`, the one-tap case); the core's packed
|
|
146
|
+
MLP evaluator (`src/core/frame/wgsl/lighting.ts`, `mlpRuntime: 'packed'`) follows its `mat4x4 * vec4` layer math. Commit
|
|
147
|
+
`3ad5e98` of https://github.com/pmndrs/denoiser.
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
MIT License
|
|
151
|
+
|
|
152
|
+
Copyright (c) 2024 Dennis Smolek
|
|
153
|
+
|
|
154
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
155
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
156
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
157
|
+
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
158
|
+
|
|
159
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
160
|
+
the Software.
|
|
161
|
+
|
|
162
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
163
|
+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
164
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
165
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
166
|
+
DEALINGS IN THE SOFTWARE.
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Blosc: BloscLZ decoder and LZ4 frame writer (BSD-3-Clause), FastLZ (MIT)
|
|
170
|
+
|
|
171
|
+
The BloscLZ stream decoder in `src/tools/vdb/blosclz.ts` (reads Blosc frames written with the BloscLZ codec, such as
|
|
172
|
+
NVIDIA Warp's `.nvdb` files) is ported from the decoder OpenVDB v14.0.0 vendors
|
|
173
|
+
(`ext/blosc/openvdb/ext/blosc/blosclz.c`, extracted from c-blosc 1.21.6, BloscLZ 2.5.1), which is based on FastLZ.
|
|
174
|
+
The Blosc frame writer in `src/tools/vdb/blosc-write.ts` (`writeNvdb({ codec: 'blosc' })`) is ported from the
|
|
175
|
+
compression half of the Blosc OpenVDB v14.0.0 vendors (`ext/blosc/openvdb/ext/blosc/vdb_blosc.c`, c-blosc 1.21.6).
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
BSD License
|
|
179
|
+
|
|
180
|
+
For Blosc - A blocking, shuffling and lossless compression library
|
|
181
|
+
|
|
182
|
+
Copyright (c) 2009-2018 Francesc Alted <francesc@blosc.org>
|
|
183
|
+
Copyright (c) 2019-present Blosc Development Team <blosc@blosc.org>
|
|
184
|
+
|
|
185
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
186
|
+
are permitted provided that the following conditions are met:
|
|
187
|
+
|
|
188
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
189
|
+
list of conditions and the following disclaimer.
|
|
190
|
+
|
|
191
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
192
|
+
this list of conditions and the following disclaimer in the documentation
|
|
193
|
+
and/or other materials provided with the distribution.
|
|
194
|
+
|
|
195
|
+
* Neither the name Francesc Alted nor the names of its contributors may be used
|
|
196
|
+
to endorse or promote products derived from this software without specific
|
|
197
|
+
prior written permission.
|
|
198
|
+
|
|
199
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
200
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
201
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
202
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
203
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
204
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
205
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
206
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
207
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
208
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
FastLZ - Byte-aligned LZ77 compression library
|
|
213
|
+
Copyright (C) 2005-2020 Ariya Hidayat <ariya.hidayat@gmail.com>
|
|
214
|
+
|
|
215
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
216
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
217
|
+
in the Software without restriction, including without limitation the rights
|
|
218
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
219
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
220
|
+
furnished to do so, subject to the following conditions:
|
|
221
|
+
|
|
222
|
+
The above copyright notice and this permission notice shall be included in
|
|
223
|
+
all copies or substantial portions of the Software.
|
|
224
|
+
|
|
225
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
226
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
227
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
228
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
229
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
230
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
231
|
+
THE SOFTWARE.
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## LZ4 (BSD-2-Clause)
|
|
235
|
+
|
|
236
|
+
The LZ4 block compressor in `src/tools/vdb/lz4.ts` (used by `writeNvdb({ codec: 'blosc' })`) is ported from
|
|
237
|
+
`LZ4_compress_generic` of the LZ4 library OpenVDB v14.0.0 vendors (`ext/blosc/openvdb/ext/blosc/lz4/lz4.c`, LZ4 1.9.4).
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
LZ4 Library
|
|
241
|
+
Copyright (c) 2011-2020, Yann Collet
|
|
242
|
+
All rights reserved.
|
|
243
|
+
|
|
244
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
245
|
+
are permitted provided that the following conditions are met:
|
|
246
|
+
|
|
247
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
248
|
+
list of conditions and the following disclaimer.
|
|
249
|
+
|
|
250
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
251
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
252
|
+
other materials provided with the distribution.
|
|
253
|
+
|
|
254
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
255
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
256
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
257
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
258
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
259
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
260
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
261
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
262
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
263
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## three.js (MIT)
|
|
267
|
+
|
|
268
|
+
`src/tools/frame/spectral.ts` re-implements three.js's `getShIrradianceAt` (the L2 spherical-harmonics irradiance of
|
|
269
|
+
a light probe) as an f64 CPU twin used to test the passes. Copyright (c) 2010-2026 three.js authors, MIT. three is a
|
|
270
|
+
peer dependency and is not bundled.
|
|
271
|
+
|
|
272
|
+
`src/three/level-set-physical-material.ts` ports three.js r187's screen-space refraction from
|
|
273
|
+
`src/nodes/functions/PhysicalLightingModel.js` (`getVolumeTransmissionRay`, `applyIorToRoughness`,
|
|
274
|
+
`getTransmissionSample`, `volumeAttenuation`, `getIBLVolumeRefraction`), started at a traced surface's hit instead of
|
|
275
|
+
the mesh position (G13a). Copyright (c) 2010-2026 three.js authors, MIT.
|
|
276
|
+
|
|
277
|
+
## Wyman, Sloan and Shirley, 2013 (published formula)
|
|
278
|
+
|
|
279
|
+
Blackbody emission colours (`vdbCie1931Fit`, `src/tools/frame/blackbody.ts`) use the multi-lobe piecewise Gaussian
|
|
280
|
+
fit of the CIE 1931 2-degree colour matching functions from C. Wyman, P.-P. Sloan and P. Shirley, "Simple Analytic
|
|
281
|
+
Approximations to the CIE XYZ Color Matching Functions", Journal of Computer Graphics Techniques 2(2), 1-11, 2013
|
|
282
|
+
(https://jcgt.org/published/0002/02/01/), Equation 4 and Table 1. Only the published formula and coefficients are
|
|
283
|
+
used; no code or data was copied. The tabulated CIE data (CC BY-SA 4.0) is not part of this package.
|
|
284
|
+
|
|
285
|
+
## Vendored `pnanovdb.wgsl` (Apache-2.0)
|
|
286
|
+
|
|
287
|
+
`vendor/pnanovdb.wgsl` (also `@pmndrs/vdb/pnanovdb.wgsl`, and the source of the generated WGSL modules) is a
|
|
288
|
+
vendored, extended fork of emcfarlane's WGSL port of NanoVDB's `PNanoVDB.h` (OpenVDB, Apache-2.0). The original
|
|
289
|
+
copyright and attribution are in [vendor/NOTICE](./vendor/NOTICE), the licence text is
|
|
290
|
+
[vendor/LICENSE](./vendor/LICENSE), and every local change is logged in [vendor/VENDOR.md](./vendor/VENDOR.md).
|
|
291
|
+
These files must stay with any redistribution of the WGSL. The lean reader (`src/core/wgsl/lean.ts`, `reader: 'lean'`)
|
|
292
|
+
is written for this package but derives its node layout, root key and leaf decoders from the same `PNanoVDB.h`; the
|
|
293
|
+
modules it generates carry the same SPDX banner and the same notice applies.
|
|
294
|
+
|
|
295
|
+
## NanoVDB `math/HalfLite.h` (Apache-2.0; derived from Imath, BSD-3-Clause)
|
|
296
|
+
|
|
297
|
+
`src/tools/nanovdb/half.ts` (`vdbFloatToHalf`, `vdbHalfToFloat`) ports the binary16 conversions of OpenVDB's
|
|
298
|
+
`nanovdb/nanovdb/math/HalfLite.h` (v14.0.0; Copyright Contributors to the OpenVDB Project, Apache-2.0), which derive
|
|
299
|
+
from Imath's `imath_half_to_float` / `imath_float_to_half` (`Imath/half.h`; Copyright Contributors to the OpenEXR
|
|
300
|
+
Project, BSD-3-Clause; primary original authors Florian Kainz and Rod Bogart). The Apache-2.0 text is
|
|
301
|
+
[vendor/LICENSE](./vendor/LICENSE). The BSD-3-Clause terms: redistributions must retain the copyright notice above,
|
|
302
|
+
this list of conditions and the disclaimer; neither the name of the copyright holder nor the names of its contributors
|
|
303
|
+
may be used to endorse or promote products derived from this software without prior written permission; the software
|
|
304
|
+
is provided "as is", without any express or implied warranties, and in no event shall the copyright holder or
|
|
305
|
+
contributors be liable for any damages arising from its use.
|
|
306
|
+
|
|
307
|
+
## fflate (MIT, runtime dependency)
|
|
308
|
+
|
|
309
|
+
[fflate](https://github.com/101arrowz/fflate), Copyright (c) 2023 Arjun Barrett, provides zlib in
|
|
310
|
+
`@pmndrs/vdb/tools`. It is installed as a dependency, not bundled.
|
|
311
|
+
|
|
312
|
+
## @webgpu/types (BSD-3-Clause, runtime dependency)
|
|
313
|
+
|
|
314
|
+
[@webgpu/types](https://github.com/gpuweb/types) provides the `GPUDevice` and related declarations that the shipped
|
|
315
|
+
`.d.ts` files reference. It is installed as a dependency, not bundled.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `decodeToAtlas`: dense decode of one pool grid's index bbox into a flat f32
|
|
3
|
+
* array (x fastest), recorded into the host's encoder (K2.3, ported from v1
|
|
4
|
+
* `three/compute.ts`). CPU twin: `vdbDecodeToAtlasCpu` + `atlasFromRaw` in
|
|
5
|
+
* `@pmndrs/vdb/tools`.
|
|
6
|
+
*
|
|
7
|
+
* One thread per output voxel samples the index bbox at the voxel-centre
|
|
8
|
+
* position of its cell (below) with `vdbReadValue(floor(p + 0.5))`
|
|
9
|
+
* (`'nearest'`) or `vdbSample` (`'trilinear'`, the vendored trilinear,
|
|
10
|
+
* `outside: 'background'`).
|
|
11
|
+
*
|
|
12
|
+
* **Sampling convention (K2.6; voxel centres).** NanoVDB voxel centres sit at
|
|
13
|
+
* integer index coordinates, and the bbox `[min, max]` (inclusive) holds
|
|
14
|
+
* `size = max - min + 1` voxels, i.e. the cells `[min - 0.5, max + 0.5]`.
|
|
15
|
+
* Cell `i` of an axis with `n` cells over `[min, max]` samples the index-space
|
|
16
|
+
* position
|
|
17
|
+
*
|
|
18
|
+
* p = min + (i + 0.5) * (max - min + 1) / n - 0.5
|
|
19
|
+
*
|
|
20
|
+
* (the centre of the i-th of `n` equal slices of `[min - 0.5, max + 0.5]`).
|
|
21
|
+
* At full resolution (`n == size`) that is `p = min + i`: `'nearest'` reads
|
|
22
|
+
* exactly voxel `min + i` (the last cell is voxel `max`) and `'trilinear'`
|
|
23
|
+
* reads that voxel's value unblended. Downsampled, each cell samples the
|
|
24
|
+
* centre of its slice. The atlas is a texture over the voxel-centred box
|
|
25
|
+
* `[min - 0.5, max + 0.5]`: texel `i`'s centre `(i + 0.5) / n` maps to `p`
|
|
26
|
+
* above. (Before K2.6 this was v1's `min + (i + 0.5) / n * size`, half a voxel
|
|
27
|
+
* past the centres.) The GPU writes raw f32; normalizing and quantizing to
|
|
28
|
+
* `uint8` happen on the CPU after readback, as in v1.
|
|
29
|
+
*
|
|
30
|
+
* The raw buffer is also the GPU-side output: with `readback: false` the
|
|
31
|
+
* host keeps `buffer` (`STORAGE | COPY_SRC`, `dims` product f32s) for its own
|
|
32
|
+
* passes and calls `dispose()` when done.
|
|
33
|
+
*/
|
|
34
|
+
import type { VDBGridPool } from "../pool/pool.js";
|
|
35
|
+
import { type VDBReadback } from "./shared.js";
|
|
36
|
+
import { type VDBAtlasFilter, type VDBAtlasFormat } from "../../tools/cpu/compute.js";
|
|
37
|
+
export type { VDBAtlasFilter, VDBAtlasFormat };
|
|
38
|
+
/** Options of {@link vdbDecodeToAtlas} (v1's, plus `encoder` and `readback`). */
|
|
39
|
+
export interface VDBDecodeToAtlasOptions {
|
|
40
|
+
/** Per-axis output resolution cap (a literal clamp, not a proportional downscale). Default 256. */
|
|
41
|
+
maxDim?: number;
|
|
42
|
+
/** Default `'trilinear'`. */
|
|
43
|
+
filter?: VDBAtlasFilter;
|
|
44
|
+
/** Element type of `read()`'s `data`. Default `'uint8'`. */
|
|
45
|
+
format?: VDBAtlasFormat;
|
|
46
|
+
/** Map `range` to `[0, 1]` (`float32`) or `[0, 255]` (`uint8`) in `read()`. Default `true`. */
|
|
47
|
+
normalize?: boolean;
|
|
48
|
+
/** Normalization range. Default: the grid's root min/max statistics (`pool.info(id).rootMin/rootMax`). */
|
|
49
|
+
range?: {
|
|
50
|
+
min: number;
|
|
51
|
+
max: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Record into this encoder. The host submits it, then calls
|
|
55
|
+
* `job.submitted().read()` (`read()` before `submitted()` rejects with
|
|
56
|
+
* `VDB_BAD_OPTION`). Omitted: the tool submits its own.
|
|
57
|
+
*/
|
|
58
|
+
encoder?: GPUCommandEncoder;
|
|
59
|
+
/** `false`: no readback; keep `buffer` for GPU use and `dispose()` it. Default `true`. */
|
|
60
|
+
readback?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** What `read()` resolves with (v1's `DecodeToAtlasResult`). */
|
|
63
|
+
export interface VDBAtlas {
|
|
64
|
+
/** `dims` product values, x fastest. */
|
|
65
|
+
data: Uint8Array | Float32Array;
|
|
66
|
+
/** Output size per axis in cells (the grid's index box, capped by `maxDim`). */
|
|
67
|
+
dims: [number, number, number];
|
|
68
|
+
/** The range used for normalization (echoed so the caller can undo it). */
|
|
69
|
+
range: {
|
|
70
|
+
min: number;
|
|
71
|
+
max: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** The pending atlas: a {@link VDBReadback} plus the GPU output. */
|
|
75
|
+
export interface VDBAtlasReadback extends VDBReadback<VDBAtlas> {
|
|
76
|
+
/** Output size per axis in cells. */
|
|
77
|
+
readonly dims: [number, number, number];
|
|
78
|
+
/** The normalization range (the option, or the grid's root min/max). */
|
|
79
|
+
readonly range: {
|
|
80
|
+
min: number;
|
|
81
|
+
max: number;
|
|
82
|
+
};
|
|
83
|
+
/** Raw f32 values on the GPU (`STORAGE | COPY_SRC`); freed by `read()` / `dispose()`. */
|
|
84
|
+
readonly buffer: GPUBuffer;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Records the decode of grid `gridId` of `pool` and returns a
|
|
88
|
+
* {@link VDBAtlasReadback}: `const { data, dims } = await decodeToAtlas(device, pool, id).read()`
|
|
89
|
+
* (with a host encoder: submit it, then `await job.submitted().read()`).
|
|
90
|
+
* Cell `i` samples index position `min + (i + 0.5) * size / n - 0.5`, voxel
|
|
91
|
+
* centres at full resolution (see the file comment).
|
|
92
|
+
*
|
|
93
|
+
* The grid must be resident and the pool must live on `device` (as for
|
|
94
|
+
* `gridStats`). The tool frees only its own parameter, output and readback
|
|
95
|
+
* buffers.
|
|
96
|
+
*
|
|
97
|
+
* @param device The host's `GPUDevice`; the pool must live on it.
|
|
98
|
+
* @param pool The pool that holds the grid.
|
|
99
|
+
* @param gridId The grid's pool id; it must be resident.
|
|
100
|
+
* @param options Resolution, filter, format, normalization and encoder ({@link VDBDecodeToAtlasOptions}).
|
|
101
|
+
*/
|
|
102
|
+
export declare function vdbDecodeToAtlas(device: GPUDevice, pool: VDBGridPool, gridId: number, options?: VDBDecodeToAtlasOptions): VDBAtlasReadback;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { VDBError } from "../errors.js";
|
|
2
|
+
import { checkPositiveInt, checkTarget, ComputeJob, createInitialized, hostEncoder, kernelPipeline, packParams, USAGE, workgroups, WORKGROUP_AXIS, } from "./shared.js";
|
|
3
|
+
import { atlasDims, atlasFromRaw, bboxSize } from "../../tools/cpu/compute.js";
|
|
4
|
+
const W = WORKGROUP_AXIS;
|
|
5
|
+
const ATLAS = {
|
|
6
|
+
entryPoint: "csAtlas",
|
|
7
|
+
outputs: 1,
|
|
8
|
+
footer: /* wgsl */ `
|
|
9
|
+
@group(1) @binding(0) var<storage, read_write> csAtlasOut: array<f32>;
|
|
10
|
+
|
|
11
|
+
@compute @workgroup_size(${W}, ${W}, ${W})
|
|
12
|
+
fn csAtlas(@builtin(global_invocation_id) gid: vec3u) {
|
|
13
|
+
let dims = csParams.dims;
|
|
14
|
+
if any(gid >= dims) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
// Voxel-centre position: min + (i + 0.5) * size / dims - 0.5. Multiply
|
|
18
|
+
// before dividing and subtract the half voxel before adding min, so at
|
|
19
|
+
// full resolution the offset is exactly i (the CPU twin does the same).
|
|
20
|
+
let pos = vec3f(csParams.regionMin) + ((vec3f(gid) + vec3f(0.5)) * vec3f(csParams.regionSize) / vec3f(dims) - vec3f(0.5));
|
|
21
|
+
var acc = vdbAccessorInit(csParams.grid);
|
|
22
|
+
var value: f32;
|
|
23
|
+
if csParams.filterMode == 1u {
|
|
24
|
+
value = vdbSample(&acc, pos);
|
|
25
|
+
} else {
|
|
26
|
+
value = vdbReadValue(&acc, vec3i(floor(pos + vec3f(0.5))));
|
|
27
|
+
}
|
|
28
|
+
csAtlasOut[gid.x + gid.y * dims.x + gid.z * dims.x * dims.y] = value;
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
};
|
|
32
|
+
const WHERE = "decodeToAtlas";
|
|
33
|
+
function checkAtlasOptions(o) {
|
|
34
|
+
checkPositiveInt(WHERE, "maxDim", o.maxDim ?? 256);
|
|
35
|
+
if (o.filter !== undefined && o.filter !== "nearest" && o.filter !== "trilinear") {
|
|
36
|
+
throw new VDBError("VDB_BAD_OPTION", `${WHERE}: filter must be "nearest" or "trilinear", got ${JSON.stringify(o.filter)}.`);
|
|
37
|
+
}
|
|
38
|
+
if (o.format !== undefined && o.format !== "uint8" && o.format !== "float32") {
|
|
39
|
+
throw new VDBError("VDB_BAD_OPTION", `${WHERE}: format must be "uint8" or "float32", got ${JSON.stringify(o.format)}.`);
|
|
40
|
+
}
|
|
41
|
+
if (o.range !== undefined && !(Number.isFinite(o.range?.min) && Number.isFinite(o.range?.max))) {
|
|
42
|
+
throw new VDBError("VDB_BAD_OPTION", `${WHERE}: range must be { min, max } with finite numbers, got ${JSON.stringify(o.range)}.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Records the decode of grid `gridId` of `pool` and returns a
|
|
47
|
+
* {@link VDBAtlasReadback}: `const { data, dims } = await decodeToAtlas(device, pool, id).read()`
|
|
48
|
+
* (with a host encoder: submit it, then `await job.submitted().read()`).
|
|
49
|
+
* Cell `i` samples index position `min + (i + 0.5) * size / n - 0.5`, voxel
|
|
50
|
+
* centres at full resolution (see the file comment).
|
|
51
|
+
*
|
|
52
|
+
* The grid must be resident and the pool must live on `device` (as for
|
|
53
|
+
* `gridStats`). The tool frees only its own parameter, output and readback
|
|
54
|
+
* buffers.
|
|
55
|
+
*
|
|
56
|
+
* @param device The host's `GPUDevice`; the pool must live on it.
|
|
57
|
+
* @param pool The pool that holds the grid.
|
|
58
|
+
* @param gridId The grid's pool id; it must be resident.
|
|
59
|
+
* @param options Resolution, filter, format, normalization and encoder ({@link VDBDecodeToAtlasOptions}).
|
|
60
|
+
*/
|
|
61
|
+
export function vdbDecodeToAtlas(device, pool, gridId, options = {}) {
|
|
62
|
+
checkAtlasOptions(options);
|
|
63
|
+
const info = checkTarget(WHERE, device, pool, gridId);
|
|
64
|
+
const maxDim = options.maxDim ?? 256;
|
|
65
|
+
const filter = options.filter ?? "trilinear";
|
|
66
|
+
const format = options.format ?? "uint8";
|
|
67
|
+
const normalize = options.normalize ?? true;
|
|
68
|
+
const range = options.range ? { min: options.range.min, max: options.range.max } : normalize ? { min: info.rootMin, max: info.rootMax } : { min: 0, max: 1 };
|
|
69
|
+
const regionSize = bboxSize(info.indexBBox);
|
|
70
|
+
const dims = atlasDims(info.indexBBox, maxDim);
|
|
71
|
+
const cached = kernelPipeline(device, ATLAS, info.type);
|
|
72
|
+
const params = createInitialized(device, "vdb decodeToAtlas params", USAGE.UNIFORM, new Uint8Array(packParams({ grid: gridId, filter: filter === "trilinear" ? 1 : 0, regionMin: info.indexBBox.min, regionSize, dims })));
|
|
73
|
+
const bytes = dims[0] * dims[1] * dims[2] * 4;
|
|
74
|
+
const out = device.createBuffer({ label: "vdb decodeToAtlas", size: bytes, usage: USAGE.STORAGE | USAGE.COPY_SRC });
|
|
75
|
+
const readback = options.readback ?? true;
|
|
76
|
+
const staging = readback ? device.createBuffer({ label: "vdb decodeToAtlas readback", size: bytes, usage: USAGE.MAP_READ | USAGE.COPY_DST }) : null;
|
|
77
|
+
const group0 = device.createBindGroup({ layout: cached.group0, entries: [pool.bindGroupEntry({ group: 0, firstBinding: 0 }), { binding: 1, resource: { buffer: params } }] });
|
|
78
|
+
const group1 = device.createBindGroup({ layout: cached.group1, entries: [{ binding: 0, resource: { buffer: out } }] });
|
|
79
|
+
const host = hostEncoder(device, options.encoder, "vdb decodeToAtlas");
|
|
80
|
+
const pass = host.encoder.beginComputePass({ label: "vdb decodeToAtlas" });
|
|
81
|
+
pass.setPipeline(cached.pipeline);
|
|
82
|
+
pass.setBindGroup(0, group0);
|
|
83
|
+
pass.setBindGroup(1, group1);
|
|
84
|
+
pass.dispatchWorkgroups(...workgroups(dims));
|
|
85
|
+
pass.end();
|
|
86
|
+
if (staging)
|
|
87
|
+
host.encoder.copyBufferToBuffer(out, 0, staging, 0, bytes);
|
|
88
|
+
host.submit();
|
|
89
|
+
const finish = (raw) => ({ data: atlasFromRaw(new Float32Array(raw), { format, normalize, range }), dims: [...dims], range });
|
|
90
|
+
return new AtlasJob([params, out], staging, cached.error, finish, dims, range, out, host.selfSubmitted);
|
|
91
|
+
}
|
|
92
|
+
class AtlasJob extends ComputeJob {
|
|
93
|
+
dims;
|
|
94
|
+
range;
|
|
95
|
+
buffer;
|
|
96
|
+
constructor(owned, staging, error, finish, dims, range, buffer, selfSubmitted) {
|
|
97
|
+
super(WHERE, owned, staging, error, finish, selfSubmitted);
|
|
98
|
+
this.dims = dims;
|
|
99
|
+
this.range = range;
|
|
100
|
+
this.buffer = buffer;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=atlas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas.js","sourceRoot":"","sources":["../../../src/core/compute/atlas.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * `decodeToAtlas`: dense decode of one pool grid's index bbox into a flat f32\n * array (x fastest), recorded into the host's encoder (K2.3, ported from v1\n * `three/compute.ts`). CPU twin: `vdbDecodeToAtlasCpu` + `atlasFromRaw` in\n * `@pmndrs/vdb/tools`.\n *\n * One thread per output voxel samples the index bbox at the voxel-centre\n * position of its cell (below) with `vdbReadValue(floor(p + 0.5))`\n * (`'nearest'`) or `vdbSample` (`'trilinear'`, the vendored trilinear,\n * `outside: 'background'`).\n *\n * **Sampling convention (K2.6; voxel centres).** NanoVDB voxel centres sit at\n * integer index coordinates, and the bbox `[min, max]` (inclusive) holds\n * `size = max - min + 1` voxels, i.e. the cells `[min - 0.5, max + 0.5]`.\n * Cell `i` of an axis with `n` cells over `[min, max]` samples the index-space\n * position\n *\n * p = min + (i + 0.5) * (max - min + 1) / n - 0.5\n *\n * (the centre of the i-th of `n` equal slices of `[min - 0.5, max + 0.5]`).\n * At full resolution (`n == size`) that is `p = min + i`: `'nearest'` reads\n * exactly voxel `min + i` (the last cell is voxel `max`) and `'trilinear'`\n * reads that voxel's value unblended. Downsampled, each cell samples the\n * centre of its slice. The atlas is a texture over the voxel-centred box\n * `[min - 0.5, max + 0.5]`: texel `i`'s centre `(i + 0.5) / n` maps to `p`\n * above. (Before K2.6 this was v1's `min + (i + 0.5) / n * size`, half a voxel\n * past the centres.) The GPU writes raw f32; normalizing and quantizing to\n * `uint8` happen on the CPU after readback, as in v1.\n *\n * The raw buffer is also the GPU-side output: with `readback: false` the\n * host keeps `buffer` (`STORAGE | COPY_SRC`, `dims` product f32s) for its own\n * passes and calls `dispose()` when done.\n */\nimport type { VDBGridPool } from \"../pool/pool.js\";\nimport { VDBError } from \"../errors.js\";\nimport {\n checkPositiveInt,\n checkTarget,\n ComputeJob,\n createInitialized,\n hostEncoder,\n kernelPipeline,\n packParams,\n USAGE,\n workgroups,\n WORKGROUP_AXIS,\n type KernelSource,\n type VDBReadback,\n} from \"./shared.js\";\nimport { atlasDims, atlasFromRaw, bboxSize, type VDBAtlasFilter, type VDBAtlasFormat } from \"../../tools/cpu/compute.js\";\n\nexport type { VDBAtlasFilter, VDBAtlasFormat };\n\nconst W = WORKGROUP_AXIS;\n\nconst ATLAS: KernelSource = {\n entryPoint: \"csAtlas\",\n outputs: 1,\n footer: /* wgsl */ `\n@group(1) @binding(0) var<storage, read_write> csAtlasOut: array<f32>;\n\n@compute @workgroup_size(${W}, ${W}, ${W})\nfn csAtlas(@builtin(global_invocation_id) gid: vec3u) {\n let dims = csParams.dims;\n if any(gid >= dims) {\n return;\n }\n // Voxel-centre position: min + (i + 0.5) * size / dims - 0.5. Multiply\n // before dividing and subtract the half voxel before adding min, so at\n // full resolution the offset is exactly i (the CPU twin does the same).\n let pos = vec3f(csParams.regionMin) + ((vec3f(gid) + vec3f(0.5)) * vec3f(csParams.regionSize) / vec3f(dims) - vec3f(0.5));\n var acc = vdbAccessorInit(csParams.grid);\n var value: f32;\n if csParams.filterMode == 1u {\n value = vdbSample(&acc, pos);\n } else {\n value = vdbReadValue(&acc, vec3i(floor(pos + vec3f(0.5))));\n }\n csAtlasOut[gid.x + gid.y * dims.x + gid.z * dims.x * dims.y] = value;\n}\n`,\n};\n\n/** Options of {@link vdbDecodeToAtlas} (v1's, plus `encoder` and `readback`). */\nexport interface VDBDecodeToAtlasOptions {\n /** Per-axis output resolution cap (a literal clamp, not a proportional downscale). Default 256. */\n maxDim?: number;\n /** Default `'trilinear'`. */\n filter?: VDBAtlasFilter;\n /** Element type of `read()`'s `data`. Default `'uint8'`. */\n format?: VDBAtlasFormat;\n /** Map `range` to `[0, 1]` (`float32`) or `[0, 255]` (`uint8`) in `read()`. Default `true`. */\n normalize?: boolean;\n /** Normalization range. Default: the grid's root min/max statistics (`pool.info(id).rootMin/rootMax`). */\n range?: { min: number; max: number };\n /**\n * Record into this encoder. The host submits it, then calls\n * `job.submitted().read()` (`read()` before `submitted()` rejects with\n * `VDB_BAD_OPTION`). Omitted: the tool submits its own.\n */\n encoder?: GPUCommandEncoder;\n /** `false`: no readback; keep `buffer` for GPU use and `dispose()` it. Default `true`. */\n readback?: boolean;\n}\n\n/** What `read()` resolves with (v1's `DecodeToAtlasResult`). */\nexport interface VDBAtlas {\n /** `dims` product values, x fastest. */\n data: Uint8Array | Float32Array;\n /** Output size per axis in cells (the grid's index box, capped by `maxDim`). */\n dims: [number, number, number];\n /** The range used for normalization (echoed so the caller can undo it). */\n range: { min: number; max: number };\n}\n\n/** The pending atlas: a {@link VDBReadback} plus the GPU output. */\nexport interface VDBAtlasReadback extends VDBReadback<VDBAtlas> {\n /** Output size per axis in cells. */\n readonly dims: [number, number, number];\n /** The normalization range (the option, or the grid's root min/max). */\n readonly range: { min: number; max: number };\n /** Raw f32 values on the GPU (`STORAGE | COPY_SRC`); freed by `read()` / `dispose()`. */\n readonly buffer: GPUBuffer;\n}\n\nconst WHERE = \"decodeToAtlas\";\n\nfunction checkAtlasOptions(o: VDBDecodeToAtlasOptions): void {\n checkPositiveInt(WHERE, \"maxDim\", o.maxDim ?? 256);\n if (o.filter !== undefined && o.filter !== \"nearest\" && o.filter !== \"trilinear\") {\n throw new VDBError(\"VDB_BAD_OPTION\", `${WHERE}: filter must be \"nearest\" or \"trilinear\", got ${JSON.stringify(o.filter)}.`);\n }\n if (o.format !== undefined && o.format !== \"uint8\" && o.format !== \"float32\") {\n throw new VDBError(\"VDB_BAD_OPTION\", `${WHERE}: format must be \"uint8\" or \"float32\", got ${JSON.stringify(o.format)}.`);\n }\n if (o.range !== undefined && !(Number.isFinite(o.range?.min) && Number.isFinite(o.range?.max))) {\n throw new VDBError(\"VDB_BAD_OPTION\", `${WHERE}: range must be { min, max } with finite numbers, got ${JSON.stringify(o.range)}.`);\n }\n}\n\n/**\n * Records the decode of grid `gridId` of `pool` and returns a\n * {@link VDBAtlasReadback}: `const { data, dims } = await decodeToAtlas(device, pool, id).read()`\n * (with a host encoder: submit it, then `await job.submitted().read()`).\n * Cell `i` samples index position `min + (i + 0.5) * size / n - 0.5`, voxel\n * centres at full resolution (see the file comment).\n *\n * The grid must be resident and the pool must live on `device` (as for\n * `gridStats`). The tool frees only its own parameter, output and readback\n * buffers.\n *\n * @param device The host's `GPUDevice`; the pool must live on it.\n * @param pool The pool that holds the grid.\n * @param gridId The grid's pool id; it must be resident.\n * @param options Resolution, filter, format, normalization and encoder ({@link VDBDecodeToAtlasOptions}).\n */\nexport function vdbDecodeToAtlas(device: GPUDevice, pool: VDBGridPool, gridId: number, options: VDBDecodeToAtlasOptions = {}): VDBAtlasReadback {\n checkAtlasOptions(options);\n const info = checkTarget(WHERE, device, pool, gridId);\n const maxDim = options.maxDim ?? 256;\n const filter = options.filter ?? \"trilinear\";\n const format = options.format ?? \"uint8\";\n const normalize = options.normalize ?? true;\n const range = options.range ? { min: options.range.min, max: options.range.max } : normalize ? { min: info.rootMin, max: info.rootMax } : { min: 0, max: 1 };\n const regionSize = bboxSize(info.indexBBox);\n const dims = atlasDims(info.indexBBox, maxDim);\n const cached = kernelPipeline(device, ATLAS, info.type);\n\n const params = createInitialized(\n device,\n \"vdb decodeToAtlas params\",\n USAGE.UNIFORM,\n new Uint8Array(packParams({ grid: gridId, filter: filter === \"trilinear\" ? 1 : 0, regionMin: info.indexBBox.min, regionSize, dims })),\n );\n const bytes = dims[0] * dims[1] * dims[2] * 4;\n const out = device.createBuffer({ label: \"vdb decodeToAtlas\", size: bytes, usage: USAGE.STORAGE | USAGE.COPY_SRC });\n const readback = options.readback ?? true;\n const staging = readback ? device.createBuffer({ label: \"vdb decodeToAtlas readback\", size: bytes, usage: USAGE.MAP_READ | USAGE.COPY_DST }) : null;\n\n const group0 = device.createBindGroup({ layout: cached.group0, entries: [pool.bindGroupEntry({ group: 0, firstBinding: 0 }), { binding: 1, resource: { buffer: params } }] });\n const group1 = device.createBindGroup({ layout: cached.group1, entries: [{ binding: 0, resource: { buffer: out } }] });\n\n const host = hostEncoder(device, options.encoder, \"vdb decodeToAtlas\");\n const pass = host.encoder.beginComputePass({ label: \"vdb decodeToAtlas\" });\n pass.setPipeline(cached.pipeline);\n pass.setBindGroup(0, group0);\n pass.setBindGroup(1, group1);\n pass.dispatchWorkgroups(...workgroups(dims));\n pass.end();\n if (staging) host.encoder.copyBufferToBuffer(out, 0, staging, 0, bytes);\n host.submit();\n\n const finish = (raw: ArrayBuffer): VDBAtlas => ({ data: atlasFromRaw(new Float32Array(raw), { format, normalize, range }), dims: [...dims], range });\n return new AtlasJob([params, out], staging, cached.error, finish, dims, range, out, host.selfSubmitted);\n}\n\nclass AtlasJob extends ComputeJob<VDBAtlas> implements VDBAtlasReadback {\n constructor(\n owned: GPUBuffer[],\n staging: GPUBuffer | null,\n error: Promise<GPUError | null>,\n finish: (bytes: ArrayBuffer) => VDBAtlas,\n readonly dims: [number, number, number],\n readonly range: { min: number; max: number },\n readonly buffer: GPUBuffer,\n selfSubmitted: boolean,\n ) {\n super(WHERE, owned, staging, error, finish, selfSubmitted);\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core compute tools (K2.3): engine-free compute passes over pool grids,
|
|
3
|
+
* recorded into the host's encoder, plus the CPU value transform.
|
|
4
|
+
*/
|
|
5
|
+
export { vdbGridStats } from "./stats.js";
|
|
6
|
+
export type { VDBGridStats, VDBGridStatsOptions } from "./stats.js";
|
|
7
|
+
export { vdbDecodeToAtlas } from "./atlas.js";
|
|
8
|
+
export type { VDBAtlasFilter, VDBAtlasFormat, VDBAtlas, VDBAtlasReadback, VDBDecodeToAtlasOptions } from "./atlas.js";
|
|
9
|
+
export { vdbApplyValueTransform, VDB_VALUE_TRANSFORM_PRESETS } from "./value-transform.js";
|
|
10
|
+
export type { VDBValueTransform, VDBValueTransformPreset } from "./value-transform.js";
|
|
11
|
+
export type { VDBReadback } from "./shared.js";
|
|
12
|
+
export { boxPyramidWgsl, vdbCreateBoxPyramid } from "./pyramid.js";
|
|
13
|
+
export type { VDBBoxPyramid, VDBBoxPyramidOptions, VDBBoxPyramidRecordOptions } from "./pyramid.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core compute tools (K2.3): engine-free compute passes over pool grids,
|
|
3
|
+
* recorded into the host's encoder, plus the CPU value transform.
|
|
4
|
+
*/
|
|
5
|
+
export { vdbGridStats } from "./stats.js";
|
|
6
|
+
export { vdbDecodeToAtlas } from "./atlas.js";
|
|
7
|
+
export { vdbApplyValueTransform, VDB_VALUE_TRANSFORM_PRESETS } from "./value-transform.js";
|
|
8
|
+
export { boxPyramidWgsl, vdbCreateBoxPyramid } from "./pyramid.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/compute/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAG3F,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/**\n * Core compute tools (K2.3): engine-free compute passes over pool grids,\n * recorded into the host's encoder, plus the CPU value transform.\n */\nexport { vdbGridStats } from \"./stats.js\";\nexport type { VDBGridStats, VDBGridStatsOptions } from \"./stats.js\";\nexport { vdbDecodeToAtlas } from \"./atlas.js\";\nexport type { VDBAtlasFilter, VDBAtlasFormat, VDBAtlas, VDBAtlasReadback, VDBDecodeToAtlasOptions } from \"./atlas.js\";\nexport { vdbApplyValueTransform, VDB_VALUE_TRANSFORM_PRESETS } from \"./value-transform.js\";\nexport type { VDBValueTransform, VDBValueTransformPreset } from \"./value-transform.js\";\nexport type { VDBReadback } from \"./shared.js\";\nexport { boxPyramidWgsl, vdbCreateBoxPyramid } from \"./pyramid.js\";\nexport type { VDBBoxPyramid, VDBBoxPyramidOptions, VDBBoxPyramidRecordOptions } from \"./pyramid.js\";\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { VDBGridTypeName } from "../types.js";
|
|
2
|
+
/** Threads per workgroup (one workgroup per cell). */
|
|
3
|
+
export declare const MAJORANT_BUILD_THREADS = 64;
|
|
4
|
+
/** Bytes of `VdbMbParams`. */
|
|
5
|
+
export declare const MAJORANT_BUILD_PARAMS_BYTES = 96;
|
|
6
|
+
/** Largest brick the GPU builds: `(B + 1)³` taps per cell over 64 threads (B = 64: ~4.4k taps per thread). */
|
|
7
|
+
export declare const MAJORANT_BUILD_MAX_LOG2 = 6;
|
|
8
|
+
/** Flags of `VdbMbParams.flags`. */
|
|
9
|
+
export declare const MAJORANT_BUILD_FLAG: {
|
|
10
|
+
readonly zero: 1;
|
|
11
|
+
readonly pathtracer: 2;
|
|
12
|
+
readonly minima: 4;
|
|
13
|
+
};
|
|
14
|
+
/** What one build needs (the pool fills it from the grid's layout and placed range). */
|
|
15
|
+
export interface MajorantBuildParams {
|
|
16
|
+
grid: number;
|
|
17
|
+
/** Byte offset of the range in the pool buffer (32-aligned). */
|
|
18
|
+
rangeOffset: number;
|
|
19
|
+
brickLog2: number;
|
|
20
|
+
origin: readonly [number, number, number];
|
|
21
|
+
dims: readonly [number, number, number];
|
|
22
|
+
bboxMin: readonly [number, number, number];
|
|
23
|
+
bboxMax: readonly [number, number, number];
|
|
24
|
+
/** `align: 'pathtracer'`'s resolution (else unused). */
|
|
25
|
+
resolution: readonly [number, number, number];
|
|
26
|
+
zero: boolean;
|
|
27
|
+
pathtracer: boolean;
|
|
28
|
+
minima: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** The kernel's WGSL for grids of `type` (exported for tests and the WGSL patch harness). */
|
|
31
|
+
export declare function majorantBuildWgsl(type: VDBGridTypeName): string;
|
|
32
|
+
/** Packs `VdbMbParams` (see {@link majorantBuildWgsl}) and the dispatch size. */
|
|
33
|
+
export declare function packMajorantBuild(p: MajorantBuildParams, maxGroups?: number): {
|
|
34
|
+
params: ArrayBuffer;
|
|
35
|
+
groups: [number, number];
|
|
36
|
+
};
|
|
37
|
+
interface MajorantBuildPipeline {
|
|
38
|
+
pipeline: GPUComputePipeline;
|
|
39
|
+
layout: GPUBindGroupLayout;
|
|
40
|
+
/** Validation of the module and pipeline (null = valid). */
|
|
41
|
+
error: Promise<GPUError | null>;
|
|
42
|
+
}
|
|
43
|
+
/** The build pipeline for grids of `type` on `device`, made once per device and type. */
|
|
44
|
+
export declare function majorantBuildPipeline(device: GPUDevice, type: VDBGridTypeName): MajorantBuildPipeline;
|
|
45
|
+
export {};
|