@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 @@
|
|
|
1
|
+
{"version":3,"file":"neural.js","sourceRoot":"","sources":["../../../src/tools/frame/neural.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2GAA2G;AAC3G,2GAA2G;AAC3G,gGAAgG;AAChG,qDAAqD;AACrD,4GAA4G;AAC5G,uFAAuF;AACvF,m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ACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AAC3H,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,UAAkB,EAAE,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,IAAI,KAAK,CAAC,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/frameNeuralChunks.js L14–129 (weight layout, dense layers, sampleLevel,\n// getLocalInputs, neuralLight), src/three-openvdb/frame/webgpu/FrameGridMipMaterial.js L10–66 (the 2x2x2\n// box mip of the last grid cascade), src/three-openvdb/frame/webgpu/FrameRenderer.js L647–699\n// (renderGridMips: level sizes and atlas layouts).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; f64 CPU twins of the TSL (test oracles); the network is a value\n// (VDBFrameNeuralNetwork) so the weights module (./neural-weights.ts, ours: K6.N, D36) can be swapped or left out.\n// Divergences: DIVERGES.md (K3.4 rows).\n\n/**\n * mjurczyk's `multipleScattering: 'neural'` (K3.4, R1 §5): a 20 → 32 → 32 → 1 MLP per shadow grid\n * voxel and light slot, run in the transmittance pass. Its inputs are 6 box mip levels of the last\n * shadow grid cascade sampled at the voxel and at ±h·2^k along the light, the slot's direct optical\n * depth and an albedo term; its output is the scattered light (total − direct) of the slot. This\n * module is engine-free: the network type, the forward pass, the feature sampling and the grid mip\n * pass as CPU twins of `@pmndrs/vdb/three` `frame/neural.ts` and `grid-mip-material.ts`.\n */\n\nimport type { Vec2, Vec3 } from \"./index.js\";\nimport { vdbFrameSampleGrid, vdbFrameSampleTiles, vdbFrameGridUvw, type VDBFrameAtlas, type VDBFrameGridLayout } from \"./grid.js\";\n\n/** A neural indirect network: weights in his vec4 layout (w1 rows, b1, w2 rows, b2, w3, b3.x). */\nexport interface VDBFrameNeuralNetwork {\n /** A label for errors and signatures. */\n name?: string;\n /** Mip levels of the inputs (his 6). */\n levels: number;\n /** Inputs (his 20 = 3 × levels + 2). */\n inputs: number;\n /** Units of each hidden layer (his 32; a multiple of 4). */\n hidden: number;\n weights: Float32Array;\n}\n\n/** vec4 offsets of the weight layout (frameNeuralChunks.js L20–26). */\nexport function vdbFrameNeuralLayout(network: Pick<VDBFrameNeuralNetwork, \"inputs\" | \"hidden\">) {\n const inputVectors = network.inputs / 4;\n const hiddenVectors = network.hidden / 4;\n const w1 = 0;\n const b1 = network.hidden * inputVectors;\n const w2 = b1 + hiddenVectors;\n const b2 = w2 + network.hidden * hiddenVectors;\n const w3 = b2 + hiddenVectors;\n const b3 = w3 + hiddenVectors;\n return { inputVectors, hiddenVectors, w1, b1, w2, b2, w3, b3, vectors: b3 + 1 };\n}\n\n/**\n * Checks a network the shaders can compile: 3 × levels + 2 inputs in vec4s, hidden a multiple of 4,\n * the weight count of the layout. Returns a reason, or null when it fits.\n */\nexport function vdbFrameNeuralCheck(network: VDBFrameNeuralNetwork): string | null {\n if (!(network.levels >= 2) || network.inputs !== 3 * network.levels + 2) return `inputs must be 3 × levels + 2 (levels ${network.levels}, inputs ${network.inputs})`;\n if (network.inputs % 4 !== 0 || network.hidden % 4 !== 0 || !(network.hidden > 0)) return `inputs and hidden must be multiples of 4 (inputs ${network.inputs}, hidden ${network.hidden})`;\n if (network.levels !== 6) return `the shader packs the inputs of 6 mip levels (levels ${network.levels})`;\n const { vectors } = vdbFrameNeuralLayout(network);\n if (network.weights.length !== vectors * 4) return `expected ${vectors * 4} weights, got ${network.weights.length}`;\n return null;\n}\n\n/**\n * The MLP forward pass of `neuralLight` (f64): two ReLU layers, a linear output, then exp(min(o, 4)).\n * `inputs` is the 20-vector in the shader's order (see {@link vdbFrameNeuralInputs}).\n */\nexport function vdbFrameNeuralForward(network: VDBFrameNeuralNetwork, inputs: ArrayLike<number>): number {\n const L = vdbFrameNeuralLayout(network);\n const w = network.weights;\n const dense = (x: ArrayLike<number>, weightOffset: number, biasOffset: number, units: number): Float64Array => {\n const out = new Float64Array(units);\n for (let j = 0; j < units; j++) {\n const row = (weightOffset + j * (x.length / 4)) * 4;\n let s = w[(biasOffset + (j >> 2)) * 4 + (j & 3)]!;\n for (let i = 0; i < x.length; i++) s += w[row + i]! * x[i]!;\n out[j] = Math.max(s, 0);\n }\n return out;\n };\n const h1 = dense(inputs, L.w1, L.b1, network.hidden);\n const h2 = dense(h1, L.w2, L.b2, network.hidden);\n let o = w[L.b3 * 4]!;\n for (let i = 0; i < network.hidden; i++) o += w[L.w3 * 4 + i]! * h2[i]!;\n return Math.exp(Math.min(o, 4.0));\n}\n\n/** One box mip level of the neural inputs: an RG atlas, its voxels per side and tile columns. */\nexport interface VDBFrameNeuralMip {\n atlas: VDBFrameAtlas;\n resolution: number;\n columns: number;\n}\n\n/**\n * sampleLevel: (extinction, absorption) of a mip level at a world position, in the last cascade (level 0 is\n * the grid atlas itself); linear filter, edge texels clamped; 0 outside the cascade's [0, 1]³.\n */\nexport function vdbFrameNeuralSampleLevel(grid: VDBFrameGridLayout, density: VDBFrameAtlas, mips: readonly VDBFrameNeuralMip[], level: number, world: Vec3): Vec2 {\n const cascade = grid.count - 1;\n const uvw = vdbFrameGridUvw(grid, cascade, world);\n if (Math.min(uvw[0], uvw[1], uvw[2]) < 0 || Math.max(uvw[0], uvw[1], uvw[2]) > 1) return [0, 0];\n const s = level === 0 ? vdbFrameSampleGrid(density, grid, cascade, uvw) : vdbFrameSampleTiles(mips[level - 1]!.atlas, mips[level - 1]!.resolution, 0, mips[level - 1]!.columns, uvw);\n return [s[0]!, s[1]!];\n}\n\n/** The largest voxel side of the last cascade (`unit` of his chunks). */\nexport const vdbFrameNeuralUnit = (grid: VDBFrameGridLayout): number => {\n const v = grid.gridVoxel[grid.count - 1]!;\n return Math.max(v[0], v[1], v[2]);\n};\n\n/**\n * The 20 network inputs at a world position for a light direction (getLocalInputs + neuralLight):\n * log(1 + σ h 2^k) at the position (k = 0..5), toward the light, away from it, then\n * log(1 + direct optical depth) and √(clamp(absorption / extinction)) of level 1 (0 where level 1 is empty).\n */\nexport function vdbFrameNeuralInputs(\n sampleLevel: (level: number, world: Vec3) => Vec2,\n levels: number,\n h: number,\n world: Vec3,\n direction: Vec3,\n opticalDepth: number,\n): number[] {\n const samples = Array.from({ length: levels }, (_, k) => sampleLevel(k, world));\n const local = samples.map((v, k) => Math.log(v[0] * (h * 2 ** k) + 1));\n const albedoSample = samples[1]!;\n const albedoInput = albedoSample[0] > 0 ? Math.sqrt(Math.min(1, Math.max(0, albedoSample[1] / Math.max(albedoSample[0], 1e-20)))) : 0;\n const toward: number[] = [];\n const away: number[] = [];\n for (let k = 0; k < levels; k++) {\n const length = h * 2 ** k;\n toward.push(Math.log(sampleLevel(k, [world[0] + direction[0] * length, world[1] + direction[1] * length, world[2] + direction[2] * length])[0] * length + 1));\n away.push(Math.log(sampleLevel(k, [world[0] - direction[0] * length, world[1] - direction[1] * length, world[2] - direction[2] * length])[0] * length + 1));\n }\n return [...local, ...toward, ...away, Math.log(opticalDepth + 1), albedoInput];\n}\n\n/** neuralLight: the network's scattered light (total − direct) of a slot at a world position. */\nexport function vdbFrameNeuralLight(network: VDBFrameNeuralNetwork, grid: VDBFrameGridLayout, density: VDBFrameAtlas, mips: readonly VDBFrameNeuralMip[], world: Vec3, direction: Vec3, opticalDepth: number): number {\n const sample = (level: number, p: Vec3) => vdbFrameNeuralSampleLevel(grid, density, mips, level, p);\n return vdbFrameNeuralForward(network, vdbFrameNeuralInputs(sample, network.levels, vdbFrameNeuralUnit(grid), world, direction, opticalDepth));\n}\n\n/** Atlas layout of a z-sliced grid (his core/frameLayout.js getAtlasLayout; the three adapter's `layout.ts`). */\nexport function vdbFrameTileAtlasLayout(width: number, height: number, depth: number): { columns: number; width: number; height: number } {\n const columns = Math.ceil(Math.sqrt((depth * height) / width));\n const rows = Math.ceil(depth / columns);\n return { columns, width: columns * width, height: rows * height };\n}\n\n/**\n * The grid mip pass (FrameGridMipMaterial) on the CPU: each texel of level k (resolution / 2^k voxels\n * per side, z slices in an atlas) is the mean of the 2 × 2 × 2 texels of level k − 1 (edges clamped).\n * `source` is the grid atlas (level 0: the last cascade's tiles from `tile`) or the level before.\n * Returns the RG atlas (bottom-first rows, as the shaders).\n */\nexport function vdbFrameGridMipLevel(source: VDBFrameAtlas, sourceResolution: number, sourceColumns: number, sourceTile: number, resolution: number): VDBFrameNeuralMip {\n const layout = vdbFrameTileAtlasLayout(resolution, resolution, resolution);\n const data = new Float32Array(layout.width * layout.height * 2);\n const last = sourceResolution - 1;\n const load = (x: number, y: number, z: number): Vec2 => {\n const tile = sourceTile + Math.min(z, last);\n const tx = (tile % sourceColumns) * sourceResolution + Math.min(x, last);\n const ty = Math.floor(tile / sourceColumns) * sourceResolution + Math.min(y, last);\n const o = (ty * source.width + tx) * source.channels;\n return [source.data[o]!, source.data[o + 1]!];\n };\n for (let py = 0; py < layout.height; py++) {\n for (let px = 0; px < layout.width; px++) {\n const tx = Math.floor(px / resolution);\n const ty = Math.floor(py / resolution);\n const z = ty * layout.columns + tx;\n const x = px - tx * resolution;\n const y = py - ty * resolution;\n let s0 = 0;\n let s1 = 0;\n for (let i = 0; i < 8; i++) {\n const v = load(x * 2 + (i & 1), y * 2 + ((i >> 1) & 1), z * 2 + ((i >> 2) & 1));\n s0 += v[0];\n s1 += v[1];\n }\n data[(py * layout.width + px) * 2] = s0 / 8;\n data[(py * layout.width + px) * 2 + 1] = s1 / 8;\n }\n }\n return { atlas: { data, width: layout.width, height: layout.height, channels: 2 }, resolution, columns: layout.columns };\n}\n\n/** Voxels per side of mip level k of a grid of `resolution` voxels (his `max(1, resolution >> k)`). */\nexport const vdbFrameNeuralMipResolution = (resolution: number, level: number): number => Math.max(1, resolution >> level);\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.5b: mesh → volume shadows, the CPU twin of the core's occluder lookup (`vdbFrameOccluderVisibility`,
|
|
3
|
+
* core/frame/wgsl/occluders.ts). A host depth shadow map (three's light shadow map, or any depth / r32float texture
|
|
4
|
+
* drawn with a known view-projection per layer) answers "is this world position lit by the light": the first layer
|
|
5
|
+
* whose clip volume holds the position is tested, with the host's bias, and filtered over its 2 × 2 nearest texels
|
|
6
|
+
* (bilinear percentage-closer filtering, the hardware comparison filter) or one texel. Positions outside every layer
|
|
7
|
+
* are lit (three's frustum rule). This is what volumetric fog in Unreal and Frostbite does per froxel (Hillaire 2015:
|
|
8
|
+
* the light's shadow map sampled at each froxel), here also per shadow-grid voxel and per 'volume' lit position.
|
|
9
|
+
*/
|
|
10
|
+
import type { Vec3 } from "./index.js";
|
|
11
|
+
/** One host depth map as the twin reads it. */
|
|
12
|
+
export interface VDBFrameOccluderCpu {
|
|
13
|
+
/** Per layer (cascade or cube face; ≤ 6): the view-projection the layer was drawn with (column-major, WebGPU depth [0, 1]). */
|
|
14
|
+
readonly viewProjection: readonly ArrayLike<number>[];
|
|
15
|
+
/** Added to the position's depth before the test (three's `shadow.bias` sign); subtracted with reversed depth. */
|
|
16
|
+
readonly bias: number;
|
|
17
|
+
/** The map stores 1 at the near plane (the test is `depth − bias ≥ stored`). */
|
|
18
|
+
readonly reversedDepth: boolean;
|
|
19
|
+
/** `'bilinear'`: 2 × 2 PCF with bilinear weights; `'nearest'`: one texel. */
|
|
20
|
+
readonly filter: "bilinear" | "nearest";
|
|
21
|
+
/** Texels across and up of every layer. */
|
|
22
|
+
readonly size: readonly [number, number];
|
|
23
|
+
/** The stored depth of texel (x, y) of `layer` (x right, y down from the top row, as `textureLoad`). */
|
|
24
|
+
depthAt(layer: number, x: number, y: number): number;
|
|
25
|
+
}
|
|
26
|
+
/** Most layers of one occluder map (a cube's 6 faces). */
|
|
27
|
+
export declare const VDB_FRAME_OCCLUDER_MAX_LAYERS = 6;
|
|
28
|
+
/** Most occluder maps one kernel binds (fixed slots). */
|
|
29
|
+
export declare const VDB_FRAME_MAX_OCCLUDERS = 4;
|
|
30
|
+
/**
|
|
31
|
+
* The layer that holds `world` and its map coordinates: the first layer (in order) whose clip volume contains the
|
|
32
|
+
* position (|x|, |y| ≤ 1, 0 ≤ z ≤ 1, w > 0), with uv (0 at the left / top) and the NDC depth. Null: outside every layer.
|
|
33
|
+
*/
|
|
34
|
+
export declare function vdbFrameOccluderLayer(viewProjection: readonly ArrayLike<number>[], world: Vec3): {
|
|
35
|
+
layer: number;
|
|
36
|
+
uv: [number, number];
|
|
37
|
+
depth: number;
|
|
38
|
+
} | null;
|
|
39
|
+
/**
|
|
40
|
+
* Visibility of `world` from the occluder's light, in [0, 1]: 1 lit, 0 behind an occluder (the twin of
|
|
41
|
+
* `vdbFrameOccluderVisibility`). A march from the position toward the light stops at the first occluder, so this is
|
|
42
|
+
* the march's transmittance factor.
|
|
43
|
+
*/
|
|
44
|
+
export declare function vdbFrameOccluderVisibility(o: VDBFrameOccluderCpu, world: Vec3): number;
|
|
45
|
+
/**
|
|
46
|
+
* The transmittance target's occluded total of one light slot (core transmittance kernel): the direct part stays
|
|
47
|
+
* unoccluded (the gather multiplies it by the visibility at its own, finer position) and the scattered part
|
|
48
|
+
* (total − direct) is multiplied by the voxel's visibility, so light diffusing into a mesh shadow is smooth at grid
|
|
49
|
+
* resolution.
|
|
50
|
+
*/
|
|
51
|
+
export declare function vdbFrameOccludedTotal(direct: number, total: number, visibility: number): number;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.5b: mesh → volume shadows, the CPU twin of the core's occluder lookup (`vdbFrameOccluderVisibility`,
|
|
3
|
+
* core/frame/wgsl/occluders.ts). A host depth shadow map (three's light shadow map, or any depth / r32float texture
|
|
4
|
+
* drawn with a known view-projection per layer) answers "is this world position lit by the light": the first layer
|
|
5
|
+
* whose clip volume holds the position is tested, with the host's bias, and filtered over its 2 × 2 nearest texels
|
|
6
|
+
* (bilinear percentage-closer filtering, the hardware comparison filter) or one texel. Positions outside every layer
|
|
7
|
+
* are lit (three's frustum rule). This is what volumetric fog in Unreal and Frostbite does per froxel (Hillaire 2015:
|
|
8
|
+
* the light's shadow map sampled at each froxel), here also per shadow-grid voxel and per 'volume' lit position.
|
|
9
|
+
*/
|
|
10
|
+
/** Most layers of one occluder map (a cube's 6 faces). */
|
|
11
|
+
export const VDB_FRAME_OCCLUDER_MAX_LAYERS = 6;
|
|
12
|
+
/** Most occluder maps one kernel binds (fixed slots). */
|
|
13
|
+
export const VDB_FRAME_MAX_OCCLUDERS = 4;
|
|
14
|
+
/** Clip coordinates of a world position (column-major 4 × 4). */
|
|
15
|
+
function clipOf(m, p) {
|
|
16
|
+
return [0, 1, 2, 3].map((r) => m[r] * p[0] + m[4 + r] * p[1] + m[8 + r] * p[2] + m[12 + r]);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The layer that holds `world` and its map coordinates: the first layer (in order) whose clip volume contains the
|
|
20
|
+
* position (|x|, |y| ≤ 1, 0 ≤ z ≤ 1, w > 0), with uv (0 at the left / top) and the NDC depth. Null: outside every layer.
|
|
21
|
+
*/
|
|
22
|
+
export function vdbFrameOccluderLayer(viewProjection, world) {
|
|
23
|
+
for (let layer = 0; layer < viewProjection.length; layer++) {
|
|
24
|
+
const c = clipOf(viewProjection[layer], world);
|
|
25
|
+
if (!(c[3] > 0))
|
|
26
|
+
continue;
|
|
27
|
+
const x = c[0] / c[3];
|
|
28
|
+
const y = c[1] / c[3];
|
|
29
|
+
const z = c[2] / c[3];
|
|
30
|
+
if (Math.abs(x) > 1 || Math.abs(y) > 1 || z < 0 || z > 1)
|
|
31
|
+
continue;
|
|
32
|
+
return { layer, uv: [x * 0.5 + 0.5, 0.5 - y * 0.5], depth: z };
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Visibility of `world` from the occluder's light, in [0, 1]: 1 lit, 0 behind an occluder (the twin of
|
|
38
|
+
* `vdbFrameOccluderVisibility`). A march from the position toward the light stops at the first occluder, so this is
|
|
39
|
+
* the march's transmittance factor.
|
|
40
|
+
*/
|
|
41
|
+
export function vdbFrameOccluderVisibility(o, world) {
|
|
42
|
+
const at = vdbFrameOccluderLayer(o.viewProjection, world);
|
|
43
|
+
if (!at)
|
|
44
|
+
return 1;
|
|
45
|
+
const reference = o.reversedDepth ? at.depth - o.bias : at.depth + o.bias;
|
|
46
|
+
const [w, h] = o.size;
|
|
47
|
+
const lit = (x, y) => {
|
|
48
|
+
const d = o.depthAt(at.layer, Math.min(Math.max(x, 0), w - 1), Math.min(Math.max(y, 0), h - 1));
|
|
49
|
+
return (o.reversedDepth ? reference >= d : reference <= d) ? 1 : 0;
|
|
50
|
+
};
|
|
51
|
+
if (o.filter === "nearest")
|
|
52
|
+
return lit(Math.floor(at.uv[0] * w), Math.floor(at.uv[1] * h));
|
|
53
|
+
const px = at.uv[0] * w - 0.5;
|
|
54
|
+
const py = at.uv[1] * h - 0.5;
|
|
55
|
+
const bx = Math.floor(px);
|
|
56
|
+
const by = Math.floor(py);
|
|
57
|
+
const fx = px - bx;
|
|
58
|
+
const fy = py - by;
|
|
59
|
+
const top = lit(bx, by) + (lit(bx + 1, by) - lit(bx, by)) * fx;
|
|
60
|
+
const bottom = lit(bx, by + 1) + (lit(bx + 1, by + 1) - lit(bx, by + 1)) * fx;
|
|
61
|
+
return top + (bottom - top) * fy;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The transmittance target's occluded total of one light slot (core transmittance kernel): the direct part stays
|
|
65
|
+
* unoccluded (the gather multiplies it by the visibility at its own, finer position) and the scattered part
|
|
66
|
+
* (total − direct) is multiplied by the voxel's visibility, so light diffusing into a mesh shadow is smooth at grid
|
|
67
|
+
* resolution.
|
|
68
|
+
*/
|
|
69
|
+
export function vdbFrameOccludedTotal(direct, total, visibility) {
|
|
70
|
+
return visibility < 1 ? direct + (total - direct) * visibility : total;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=occluders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"occluders.js","sourceRoot":"","sources":["../../../src/tools/frame/occluders.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAC/C,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,iEAAiE;AACjE,SAAS,MAAM,CAAC,CAAoB,EAAE,CAAO;IAC3C,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAE,CAAqC,CAAC;AACtI,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,cAA4C,EAAE,KAAW;IAC7F,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3D,MAAM,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAE,EAAE,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,SAAS;QAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,C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AG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAC9E,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,KAAa,EAAE,UAAkB;IACrF,OAAO,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC","sourcesContent":["/**\n * K6.5b: mesh → volume shadows, the CPU twin of the core's occluder lookup (`vdbFrameOccluderVisibility`,\n * core/frame/wgsl/occluders.ts). A host depth shadow map (three's light shadow map, or any depth / r32float texture\n * drawn with a known view-projection per layer) answers \"is this world position lit by the light\": the first layer\n * whose clip volume holds the position is tested, with the host's bias, and filtered over its 2 × 2 nearest texels\n * (bilinear percentage-closer filtering, the hardware comparison filter) or one texel. Positions outside every layer\n * are lit (three's frustum rule). This is what volumetric fog in Unreal and Frostbite does per froxel (Hillaire 2015:\n * the light's shadow map sampled at each froxel), here also per shadow-grid voxel and per 'volume' lit position.\n */\n\nimport type { Vec3 } from \"./index.js\";\n\n/** One host depth map as the twin reads it. */\nexport interface VDBFrameOccluderCpu {\n /** Per layer (cascade or cube face; ≤ 6): the view-projection the layer was drawn with (column-major, WebGPU depth [0, 1]). */\n readonly viewProjection: readonly ArrayLike<number>[];\n /** Added to the position's depth before the test (three's `shadow.bias` sign); subtracted with reversed depth. */\n readonly bias: number;\n /** The map stores 1 at the near plane (the test is `depth − bias ≥ stored`). */\n readonly reversedDepth: boolean;\n /** `'bilinear'`: 2 × 2 PCF with bilinear weights; `'nearest'`: one texel. */\n readonly filter: \"bilinear\" | \"nearest\";\n /** Texels across and up of every layer. */\n readonly size: readonly [number, number];\n /** The stored depth of texel (x, y) of `layer` (x right, y down from the top row, as `textureLoad`). */\n depthAt(layer: number, x: number, y: number): number;\n}\n\n/** Most layers of one occluder map (a cube's 6 faces). */\nexport const VDB_FRAME_OCCLUDER_MAX_LAYERS = 6;\n/** Most occluder maps one kernel binds (fixed slots). */\nexport const VDB_FRAME_MAX_OCCLUDERS = 4;\n\n/** Clip coordinates of a world position (column-major 4 × 4). */\nfunction clipOf(m: ArrayLike<number>, p: Vec3): [number, number, number, number] {\n return [0, 1, 2, 3].map((r) => m[r]! * p[0] + m[4 + r]! * p[1] + m[8 + r]! * p[2] + m[12 + r]!) as [number, number, number, number];\n}\n\n/**\n * The layer that holds `world` and its map coordinates: the first layer (in order) whose clip volume contains the\n * position (|x|, |y| ≤ 1, 0 ≤ z ≤ 1, w > 0), with uv (0 at the left / top) and the NDC depth. Null: outside every layer.\n */\nexport function vdbFrameOccluderLayer(viewProjection: readonly ArrayLike<number>[], world: Vec3): { layer: number; uv: [number, number]; depth: number } | null {\n for (let layer = 0; layer < viewProjection.length; layer++) {\n const c = clipOf(viewProjection[layer]!, world);\n if (!(c[3] > 0)) continue;\n const x = c[0] / c[3];\n const y = c[1] / c[3];\n const z = c[2] / c[3];\n if (Math.abs(x) > 1 || Math.abs(y) > 1 || z < 0 || z > 1) continue;\n return { layer, uv: [x * 0.5 + 0.5, 0.5 - y * 0.5], depth: z };\n }\n return null;\n}\n\n/**\n * Visibility of `world` from the occluder's light, in [0, 1]: 1 lit, 0 behind an occluder (the twin of\n * `vdbFrameOccluderVisibility`). A march from the position toward the light stops at the first occluder, so this is\n * the march's transmittance factor.\n */\nexport function vdbFrameOccluderVisibility(o: VDBFrameOccluderCpu, world: Vec3): number {\n const at = vdbFrameOccluderLayer(o.viewProjection, world);\n if (!at) return 1;\n const reference = o.reversedDepth ? at.depth - o.bias : at.depth + o.bias;\n const [w, h] = o.size;\n const lit = (x: number, y: number) => {\n const d = o.depthAt(at.layer, Math.min(Math.max(x, 0), w - 1), Math.min(Math.max(y, 0), h - 1));\n return (o.reversedDepth ? reference >= d : reference <= d) ? 1 : 0;\n };\n if (o.filter === \"nearest\") return lit(Math.floor(at.uv[0] * w), Math.floor(at.uv[1] * h));\n const px = at.uv[0] * w - 0.5;\n const py = at.uv[1] * h - 0.5;\n const bx = Math.floor(px);\n const by = Math.floor(py);\n const fx = px - bx;\n const fy = py - by;\n const top = lit(bx, by) + (lit(bx + 1, by) - lit(bx, by)) * fx;\n const bottom = lit(bx, by + 1) + (lit(bx + 1, by + 1) - lit(bx, by + 1)) * fx;\n return top + (bottom - top) * fy;\n}\n\n/**\n * The transmittance target's occluded total of one light slot (core transmittance kernel): the direct part stays\n * unoccluded (the gather multiplies it by the visibility at its own, finer position) and the scattered part\n * (total − direct) is multiplied by the voxel's visibility, so light diffusing into a mesh shadow is smooth at grid\n * resolution.\n */\nexport function vdbFrameOccludedTotal(direct: number, total: number, visibility: number): number {\n return visibility < 1 ? direct + (total - direct) * visibility : total;\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
type Vec3 = [number, number, number];
|
|
2
|
+
/** frameMipmaps.js L14 `getLevelSize`: ceil sizes. */
|
|
3
|
+
export declare const vdbPyramidLevelSize: (size: number, level: number) => number;
|
|
4
|
+
/** The base level of the coarse pyramid: max(1, ⌈log2(maxTexels / pyramidMax)⌉) (R1 §4.3). */
|
|
5
|
+
export declare function vdbPyramidBaseLevel(texels: readonly number[], pyramidMax?: number): number;
|
|
6
|
+
/** One level of the mip atlas: its x offset in the atlas and its size. */
|
|
7
|
+
export interface VDBPyramidAtlasLevel {
|
|
8
|
+
/** The level's x offset in texels. */
|
|
9
|
+
readonly offset: number;
|
|
10
|
+
/** The level's size in texels per axis. */
|
|
11
|
+
readonly dimensions: Vec3;
|
|
12
|
+
}
|
|
13
|
+
/** The layout of {@link vdbBoxPyramidLayout}. */
|
|
14
|
+
export interface VDBBoxPyramidLayout {
|
|
15
|
+
/** L₀: the base level in level-0 voxels (texel footprint 2^L₀). */
|
|
16
|
+
readonly level: number;
|
|
17
|
+
/** Voxels of the index box the pyramid covers. */
|
|
18
|
+
readonly texels: Vec3;
|
|
19
|
+
/** Texels of the base level, ⌈texels / 2^L₀⌉. */
|
|
20
|
+
readonly dimensions: Vec3;
|
|
21
|
+
/** His atlas of the levels above the base (null for a 1³ base). */
|
|
22
|
+
readonly atlas: {
|
|
23
|
+
readonly dimensions: Vec3;
|
|
24
|
+
readonly levels: readonly VDBPyramidAtlasLevel[];
|
|
25
|
+
} | null;
|
|
26
|
+
/** Total levels the source has: L₀ + atlas levels. */
|
|
27
|
+
readonly lodLevels: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The coarse pyramid's layout for an index box of `texels` voxels: L₀ (default
|
|
31
|
+
* {@link vdbPyramidBaseLevel}), the base size, and his atlas (frameMipmaps.js `buildAtlas` /
|
|
32
|
+
* `packAtlas`): n = ⌈log2(max base side)⌉ levels, each the ceil half of the one below, level l at
|
|
33
|
+
* x = atlasWidth − atlasWidth / 2^(l−1), atlasWidth = 2^max(⌈log2 width⌉, n), height and depth the
|
|
34
|
+
* first level's.
|
|
35
|
+
*/
|
|
36
|
+
export declare function vdbBoxPyramidLayout(texels: readonly number[], o?: {
|
|
37
|
+
pyramidMax?: number;
|
|
38
|
+
level?: number;
|
|
39
|
+
}): VDBBoxPyramidLayout;
|
|
40
|
+
/** The result of {@link vdbPackPyramidBlocks}. */
|
|
41
|
+
export interface VDBPyramidPacking {
|
|
42
|
+
/** Origin (texels) of each block, in input order. */
|
|
43
|
+
readonly origins: readonly Vec3[];
|
|
44
|
+
/** The smallest texture that holds every block (each axis ≥ 1). */
|
|
45
|
+
readonly size: Vec3;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* K6.7: packs 3D blocks (the coarse pyramids' bases and mip atlases of a sparse source's volumes) into one
|
|
49
|
+
* texture, deterministically from the input order: blocks go along x in rows, rows along y in layers, layers
|
|
50
|
+
* along z (a 3D shelf packer). Blocks never overlap, and no padding is needed: every read clamps to its block's
|
|
51
|
+
* half-texel box. Throws `VDB_BAD_OPTION` when a block or the result exceeds `max` per axis (WebGPU's
|
|
52
|
+
* `maxTextureDimension3D`, 2048 by default).
|
|
53
|
+
*/
|
|
54
|
+
export declare function vdbPackPyramidBlocks(blocks: readonly (readonly number[])[], max?: readonly number[]): VDBPyramidPacking;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/webgpu/frameMipmaps.js L14–106 (level sizes, the mip atlas layout).
|
|
3
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
4
|
+
// Changes: the layout alone (no data), shared by the CPU pyramid (`vdbBoxPyramid`) and the GPU build
|
|
5
|
+
// in the core (`vdbCreateBoxPyramid`, K3.2a).
|
|
6
|
+
/**
|
|
7
|
+
* The texel layout of the sparse source's coarse pyramid (K3.2 / K3.2a): the base level L₀ and its
|
|
8
|
+
* size, and his box mip atlas above it (levels 1..n side by side on x). Pure arithmetic, so the CPU
|
|
9
|
+
* build (`vdbBoxPyramid`) and the GPU build (core `vdbCreateBoxPyramid`) agree on every size and offset.
|
|
10
|
+
*/
|
|
11
|
+
import { VDBToolsError } from "../errors.js";
|
|
12
|
+
/** frameMipmaps.js L14 `getLevelSize`: ceil sizes. */
|
|
13
|
+
export const vdbPyramidLevelSize = (size, level) => Math.max(1, Math.ceil(size / 2 ** level));
|
|
14
|
+
/** The base level of the coarse pyramid: max(1, ⌈log2(maxTexels / pyramidMax)⌉) (R1 §4.3). */
|
|
15
|
+
export function vdbPyramidBaseLevel(texels, pyramidMax = 128) {
|
|
16
|
+
const maxTexels = Math.max(...texels, 1);
|
|
17
|
+
return Math.max(1, Math.ceil(Math.log2(maxTexels / Math.max(1, pyramidMax))));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The coarse pyramid's layout for an index box of `texels` voxels: L₀ (default
|
|
21
|
+
* {@link vdbPyramidBaseLevel}), the base size, and his atlas (frameMipmaps.js `buildAtlas` /
|
|
22
|
+
* `packAtlas`): n = ⌈log2(max base side)⌉ levels, each the ceil half of the one below, level l at
|
|
23
|
+
* x = atlasWidth − atlasWidth / 2^(l−1), atlasWidth = 2^max(⌈log2 width⌉, n), height and depth the
|
|
24
|
+
* first level's.
|
|
25
|
+
*/
|
|
26
|
+
export function vdbBoxPyramidLayout(texels, o = {}) {
|
|
27
|
+
const t = [texels[0], texels[1], texels[2]];
|
|
28
|
+
if (t.some((v) => !(v > 0) || !Number.isInteger(v)))
|
|
29
|
+
throw new VDBToolsError("VDB_BAD_OPTION", `vdbBoxPyramidLayout: texels must be positive integers, got ${JSON.stringify(texels)}`);
|
|
30
|
+
const level = o.level ?? vdbPyramidBaseLevel(t, o.pyramidMax ?? 128);
|
|
31
|
+
if (!Number.isInteger(level) || level < 0)
|
|
32
|
+
throw new VDBToolsError("VDB_BAD_OPTION", `vdbBoxPyramidLayout: level must be an integer >= 0, got ${level}`);
|
|
33
|
+
const dims = [vdbPyramidLevelSize(t[0], level), vdbPyramidLevelSize(t[1], level), vdbPyramidLevelSize(t[2], level)];
|
|
34
|
+
const [width, height, depth] = dims;
|
|
35
|
+
const count = Math.ceil(Math.log2(Math.max(width, height, depth, 1)));
|
|
36
|
+
if (count < 1)
|
|
37
|
+
return { level, texels: t, dimensions: dims, atlas: null, lodLevels: level };
|
|
38
|
+
const atlasWidth = 2 ** Math.max(Math.ceil(Math.log2(width)), count);
|
|
39
|
+
const levels = [];
|
|
40
|
+
let size = dims;
|
|
41
|
+
for (let index = 0; index < count; index++) {
|
|
42
|
+
size = [vdbPyramidLevelSize(size[0], 1), vdbPyramidLevelSize(size[1], 1), vdbPyramidLevelSize(size[2], 1)];
|
|
43
|
+
levels.push({ offset: atlasWidth - atlasWidth / 2 ** index, dimensions: size });
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
level,
|
|
47
|
+
texels: t,
|
|
48
|
+
dimensions: dims,
|
|
49
|
+
atlas: { dimensions: [atlasWidth, vdbPyramidLevelSize(height, 1), vdbPyramidLevelSize(depth, 1)], levels },
|
|
50
|
+
lodLevels: level + count,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* K6.7: packs 3D blocks (the coarse pyramids' bases and mip atlases of a sparse source's volumes) into one
|
|
55
|
+
* texture, deterministically from the input order: blocks go along x in rows, rows along y in layers, layers
|
|
56
|
+
* along z (a 3D shelf packer). Blocks never overlap, and no padding is needed: every read clamps to its block's
|
|
57
|
+
* half-texel box. Throws `VDB_BAD_OPTION` when a block or the result exceeds `max` per axis (WebGPU's
|
|
58
|
+
* `maxTextureDimension3D`, 2048 by default).
|
|
59
|
+
*/
|
|
60
|
+
export function vdbPackPyramidBlocks(blocks, max = [2048, 2048, 2048]) {
|
|
61
|
+
const [MW, MH, MD] = [max[0], max[1], max[2]];
|
|
62
|
+
const origins = [];
|
|
63
|
+
let x = 0;
|
|
64
|
+
let y = 0;
|
|
65
|
+
let z = 0;
|
|
66
|
+
let rowH = 0;
|
|
67
|
+
let layerD = 0;
|
|
68
|
+
const size = [1, 1, 1];
|
|
69
|
+
for (const b of blocks) {
|
|
70
|
+
const [w, h, d] = [b[0], b[1], b[2]];
|
|
71
|
+
if (![w, h, d].every((v) => Number.isInteger(v) && v > 0))
|
|
72
|
+
throw new VDBToolsError("VDB_BAD_OPTION", `vdbPackPyramidBlocks: block sizes must be positive integers, got ${JSON.stringify(b)}`);
|
|
73
|
+
if (w > MW || h > MH || d > MD)
|
|
74
|
+
throw new VDBToolsError("VDB_BAD_OPTION", `vdbPackPyramidBlocks: a ${w}x${h}x${d} block exceeds the ${MW}x${MH}x${MD} texture limit`);
|
|
75
|
+
if (x + w > MW) {
|
|
76
|
+
x = 0;
|
|
77
|
+
y += rowH;
|
|
78
|
+
rowH = 0;
|
|
79
|
+
}
|
|
80
|
+
if (y + h > MH) {
|
|
81
|
+
x = 0;
|
|
82
|
+
y = 0;
|
|
83
|
+
rowH = 0;
|
|
84
|
+
z += layerD;
|
|
85
|
+
layerD = 0;
|
|
86
|
+
}
|
|
87
|
+
if (z + d > MD) {
|
|
88
|
+
throw new VDBToolsError("VDB_BAD_OPTION", `vdbPackPyramidBlocks: the blocks exceed the ${MW}x${MH}x${MD} texture limit (lower pyramidMax, or split the volumes over more sources)`);
|
|
89
|
+
}
|
|
90
|
+
origins.push([x, y, z]);
|
|
91
|
+
size[0] = Math.max(size[0], x + w);
|
|
92
|
+
size[1] = Math.max(size[1], y + h);
|
|
93
|
+
size[2] = Math.max(size[2], z + d);
|
|
94
|
+
x += w;
|
|
95
|
+
rowH = Math.max(rowH, h);
|
|
96
|
+
layerD = Math.max(layerD, d);
|
|
97
|
+
}
|
|
98
|
+
return { origins, size };
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=pyramid-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pyramid-layout.js","sourceRoot":"","sources":["../../../src/tools/frame/pyramid-layout.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,gGAAgG;AAChG,4GAA4G;AAC5G,qGAAqG;AACrG,8CAA8C;AAE9C;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,sDAAsD;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;AAEtH,8FAA8F;AAC9F,MAAM,UAAU,mBAAmB,CAAC,MAAyB,EAAE,UAAU,GAAG,GAAG;IAC7E,MAAM,SAAS,GAAG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CAAC;QACzB,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/frameMipmaps.js L14–106 (level sizes, the mip atlas layout).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: the layout alone (no data), shared by the CPU pyramid (`vdbBoxPyramid`) and the GPU build\n// in the core (`vdbCreateBoxPyramid`, K3.2a).\n\n/**\n * The texel layout of the sparse source's coarse pyramid (K3.2 / K3.2a): the base level L₀ and its\n * size, and his box mip atlas above it (levels 1..n side by side on x). Pure arithmetic, so the CPU\n * build (`vdbBoxPyramid`) and the GPU build (core `vdbCreateBoxPyramid`) agree on every size and offset.\n */\n\nimport { VDBToolsError } from \"../errors.js\";\n\ntype Vec3 = [number, number, number];\n\n/** frameMipmaps.js L14 `getLevelSize`: ceil sizes. */\nexport const vdbPyramidLevelSize = (size: number, level: number): number => Math.max(1, Math.ceil(size / 2 ** level));\n\n/** The base level of the coarse pyramid: max(1, ⌈log2(maxTexels / pyramidMax)⌉) (R1 §4.3). */\nexport function vdbPyramidBaseLevel(texels: readonly number[], pyramidMax = 128): number {\n const maxTexels = Math.max(...texels, 1);\n return Math.max(1, Math.ceil(Math.log2(maxTexels / Math.max(1, pyramidMax))));\n}\n\n/** One level of the mip atlas: its x offset in the atlas and its size. */\nexport interface VDBPyramidAtlasLevel {\n /** The level's x offset in texels. */\n readonly offset: number;\n /** The level's size in texels per axis. */\n readonly dimensions: Vec3;\n}\n\n/** The layout of {@link vdbBoxPyramidLayout}. */\nexport interface VDBBoxPyramidLayout {\n /** L₀: the base level in level-0 voxels (texel footprint 2^L₀). */\n readonly level: number;\n /** Voxels of the index box the pyramid covers. */\n readonly texels: Vec3;\n /** Texels of the base level, ⌈texels / 2^L₀⌉. */\n readonly dimensions: Vec3;\n /** His atlas of the levels above the base (null for a 1³ base). */\n readonly atlas: { readonly dimensions: Vec3; readonly levels: readonly VDBPyramidAtlasLevel[] } | null;\n /** Total levels the source has: L₀ + atlas levels. */\n readonly lodLevels: number;\n}\n\n/**\n * The coarse pyramid's layout for an index box of `texels` voxels: L₀ (default\n * {@link vdbPyramidBaseLevel}), the base size, and his atlas (frameMipmaps.js `buildAtlas` /\n * `packAtlas`): n = ⌈log2(max base side)⌉ levels, each the ceil half of the one below, level l at\n * x = atlasWidth − atlasWidth / 2^(l−1), atlasWidth = 2^max(⌈log2 width⌉, n), height and depth the\n * first level's.\n */\nexport function vdbBoxPyramidLayout(texels: readonly number[], o: { pyramidMax?: number; level?: number } = {}): VDBBoxPyramidLayout {\n const t: Vec3 = [texels[0]!, texels[1]!, texels[2]!];\n if (t.some((v) => !(v > 0) || !Number.isInteger(v))) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbBoxPyramidLayout: texels must be positive integers, got ${JSON.stringify(texels)}`);\n const level = o.level ?? vdbPyramidBaseLevel(t, o.pyramidMax ?? 128);\n if (!Number.isInteger(level) || level < 0) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbBoxPyramidLayout: level must be an integer >= 0, got ${level}`);\n const dims: Vec3 = [vdbPyramidLevelSize(t[0], level), vdbPyramidLevelSize(t[1], level), vdbPyramidLevelSize(t[2], level)];\n const [width, height, depth] = dims;\n const count = Math.ceil(Math.log2(Math.max(width, height, depth, 1)));\n if (count < 1) return { level, texels: t, dimensions: dims, atlas: null, lodLevels: level };\n const atlasWidth = 2 ** Math.max(Math.ceil(Math.log2(width)), count);\n const levels: VDBPyramidAtlasLevel[] = [];\n let size: Vec3 = dims;\n for (let index = 0; index < count; index++) {\n size = [vdbPyramidLevelSize(size[0], 1), vdbPyramidLevelSize(size[1], 1), vdbPyramidLevelSize(size[2], 1)];\n levels.push({ offset: atlasWidth - atlasWidth / 2 ** index, dimensions: size });\n }\n return {\n level,\n texels: t,\n dimensions: dims,\n atlas: { dimensions: [atlasWidth, vdbPyramidLevelSize(height, 1), vdbPyramidLevelSize(depth, 1)], levels },\n lodLevels: level + count,\n };\n}\n\n/** The result of {@link vdbPackPyramidBlocks}. */\nexport interface VDBPyramidPacking {\n /** Origin (texels) of each block, in input order. */\n readonly origins: readonly Vec3[];\n /** The smallest texture that holds every block (each axis ≥ 1). */\n readonly size: Vec3;\n}\n\n/**\n * K6.7: packs 3D blocks (the coarse pyramids' bases and mip atlases of a sparse source's volumes) into one\n * texture, deterministically from the input order: blocks go along x in rows, rows along y in layers, layers\n * along z (a 3D shelf packer). Blocks never overlap, and no padding is needed: every read clamps to its block's\n * half-texel box. Throws `VDB_BAD_OPTION` when a block or the result exceeds `max` per axis (WebGPU's\n * `maxTextureDimension3D`, 2048 by default).\n */\nexport function vdbPackPyramidBlocks(blocks: readonly (readonly number[])[], max: readonly number[] = [2048, 2048, 2048]): VDBPyramidPacking {\n const [MW, MH, MD] = [max[0]!, max[1]!, max[2]!];\n const origins: Vec3[] = [];\n let x = 0;\n let y = 0;\n let z = 0;\n let rowH = 0;\n let layerD = 0;\n const size: Vec3 = [1, 1, 1];\n for (const b of blocks) {\n const [w, h, d] = [b[0]!, b[1]!, b[2]!];\n if (![w, h, d].every((v) => Number.isInteger(v) && v > 0)) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbPackPyramidBlocks: block sizes must be positive integers, got ${JSON.stringify(b)}`);\n if (w > MW || h > MH || d > MD) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbPackPyramidBlocks: a ${w}x${h}x${d} block exceeds the ${MW}x${MH}x${MD} texture limit`);\n if (x + w > MW) {\n x = 0;\n y += rowH;\n rowH = 0;\n }\n if (y + h > MH) {\n x = 0;\n y = 0;\n rowH = 0;\n z += layerD;\n layerD = 0;\n }\n if (z + d > MD) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbPackPyramidBlocks: the blocks exceed the ${MW}x${MH}x${MD} texture limit (lower pyramidMax, or split the volumes over more sources)`);\n }\n origins.push([x, y, z]);\n size[0] = Math.max(size[0], x + w);\n size[1] = Math.max(size[1], y + h);\n size[2] = Math.max(size[2], z + d);\n x += w;\n rowH = Math.max(rowH, h);\n layerD = Math.max(layerD, d);\n }\n return { origins, size };\n}\n"]}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K3.6: CPU twins of the volume shadows on meshes (his `FrameVolumeShadows` / `FrameVolumeShadowMaterial`):
|
|
3
|
+
* the Beer shadow map pass (one texel: a light ray marched through the last grid cascade), the receiver
|
|
4
|
+
* lookup (transmittance at a mesh point from the map), the directional-light cascade split and its lookup.
|
|
5
|
+
*/
|
|
6
|
+
import type { Vec2, Vec3, Vec4 } from "./index.js";
|
|
7
|
+
/** Optical depth below this casts no shadow (his `minOpticalDepth`). */
|
|
8
|
+
export declare const frameShadowMinOpticalDepth = 0.0001;
|
|
9
|
+
/** The march stops past this optical depth (transmittance below e⁻⁸; his `maxOpticalDepth`). */
|
|
10
|
+
export declare const frameShadowMaxOpticalDepth = 8;
|
|
11
|
+
/** Upper limit of `castShadowSteps` (his `frameMaxShadowSteps`). */
|
|
12
|
+
export declare const frameMaxCastShadowSteps = 256;
|
|
13
|
+
/** Directional lights: cascades of the view, tiles of one atlas (his `frameMaxShadowMapCascades`). */
|
|
14
|
+
export declare const frameMaxShadowMapCascades = 4;
|
|
15
|
+
/** Distance in front of the cascade bounds and the volume box, along the light (his `cascadeMargin`). */
|
|
16
|
+
export declare const frameShadowCascadeMargin = 1;
|
|
17
|
+
/** `castShadowCoarse`: map size and samples (his `coarseMapSize`, `coarseSteps`). */
|
|
18
|
+
export declare const frameShadowCoarseMapSize = 64;
|
|
19
|
+
export declare const frameShadowCoarseSteps = 8;
|
|
20
|
+
/** The ray uniforms of one shadow camera (his `createShadowRayUniforms`). */
|
|
21
|
+
export interface VDBFrameShadowRay {
|
|
22
|
+
origin: Vec3;
|
|
23
|
+
forward: Vec3;
|
|
24
|
+
/** 1: depth is the distance from the origin (perspective). 0: along `forward` (orthographic). */
|
|
25
|
+
perspective: number;
|
|
26
|
+
/** Far plane of the shadow camera; map depths are divided by it. */
|
|
27
|
+
far: number;
|
|
28
|
+
}
|
|
29
|
+
/** frameShadowDepth: depth of a world point for a shadow camera (distance, or along the forward axis). */
|
|
30
|
+
export declare function vdbFrameShadowDepth(ray: Pick<VDBFrameShadowRay, "origin" | "forward" | "perspective">, world: Vec3): number;
|
|
31
|
+
/**
|
|
32
|
+
* The pass ray of one map texel (FrameVolumeShadowMaterial L90–109): two unprojected points of the pixel ray at
|
|
33
|
+
* NDC depth 0.25 and 0.75 give the direction; perspective rays start at the camera, orthographic ones on the camera
|
|
34
|
+
* plane. `ndc` is the pixel centre in [−1, 1]² (y up); matrices are the shadow camera's, column-major.
|
|
35
|
+
*/
|
|
36
|
+
export declare function vdbFrameShadowPassRay(projection: ArrayLike<number>, projectionInverse: ArrayLike<number>, cameraWorld: ArrayLike<number>, ndc: Vec2): {
|
|
37
|
+
origin: Vec3;
|
|
38
|
+
direction: Vec3;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* One texel of the Beer shadow map (FrameVolumeShadowMaterial L111–172): `steps` samples of the light ray through
|
|
42
|
+
* `box` (the last grid cascade), each at the middle of its step; the march stops past optical depth 8. Returns
|
|
43
|
+
* (τ·first, τ·last, 0, τ) with first / last the depths (÷ `ray.far`) of the first and last non-empty steps; empty
|
|
44
|
+
* texels are 0. `extinctionAt` is the grid extinction (red channel of the shadow density grid) at a world point.
|
|
45
|
+
* Spectral (`extinctionAt` returns rgb): output 0 is (τ̄·first, τ̄·last, 0, τ̄) with τ̄ the channel mean, output 1
|
|
46
|
+
* is (τ rgb, 0).
|
|
47
|
+
*/
|
|
48
|
+
export declare function vdbFrameShadowMapTexel(extinctionAt: (world: Vec3) => number | Vec3, origin: Vec3, direction: Vec3, box: {
|
|
49
|
+
min: Vec3;
|
|
50
|
+
max: Vec3;
|
|
51
|
+
} | null, steps: number, ray: VDBFrameShadowRay, spectral?: boolean): {
|
|
52
|
+
map: Vec4;
|
|
53
|
+
spectral: Vec4 | null;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The receiver transmittance (FrameVolumeShadows L344–372): the optical depth grows linearly from the first to the
|
|
57
|
+
* last non-empty depth of the (filtered) texel. `depth` is the receiver's {@link vdbFrameShadowDepth}, `far` the
|
|
58
|
+
* drawn shadow camera's far. `spectralTexel` (rgb optical depth): per-channel transmittance; with `mean`, their mean
|
|
59
|
+
* (a `ShadowMaterial` receiver). Returns 1 for an empty texel.
|
|
60
|
+
*/
|
|
61
|
+
export declare function vdbFrameShadowReceiver(texel: Vec4, depth: number, far: number, spectralTexel?: Vec3 | null, mean?: boolean): number | Vec3;
|
|
62
|
+
/** getCascadeBreaks: far distance of each cascade, the practical split of three's CSMShadowNode (λ = 0.5). */
|
|
63
|
+
export declare function vdbFrameShadowCascadeBreaks(count: number, near: number, far: number): number[];
|
|
64
|
+
/**
|
|
65
|
+
* The view distance the cascades cover (fitCascades L714–730): the far corner of the volume box plus one box
|
|
66
|
+
* diagonal, rounded up to half octaves (so the splits move only at those steps), within [near·1.0001,
|
|
67
|
+
* min(camera far, castShadowDistance)]. `boxFar` is the largest view depth of the box's corners.
|
|
68
|
+
*/
|
|
69
|
+
export declare function vdbFrameShadowCascadeFar(near: number, cameraFar: number, castShadowDistance: number, boxFar: number, boxDiagonal: number): number;
|
|
70
|
+
/** The cascade of a receiver (getCascadeLookup L253–261): the number of cascade far distances in front of it. */
|
|
71
|
+
export declare function vdbFrameShadowCascadeIndex(viewDepth: number, breaks: readonly number[], count: number): number;
|
|
72
|
+
/**
|
|
73
|
+
* The spot map uv of a receiver (FrameVolumeShadowNode, his 62a6e3e): `clip` is its clip position in the camera that
|
|
74
|
+
* drew the map (the drawn view-projection, not three's current shadow matrix), with three's ShadowNode y flip.
|
|
75
|
+
* Outside when behind that camera (w ≤ 0) or off the map.
|
|
76
|
+
*/
|
|
77
|
+
export declare function vdbFrameShadowSpotUv(clip: Vec4): {
|
|
78
|
+
uv: Vec2;
|
|
79
|
+
inside: boolean;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The atlas uv of a receiver in cascade `index` (getCascadeLookup L266–282): `clip` is its clip position in the
|
|
83
|
+
* cascade camera (x, y after the divide; orthographic, so w = 1). Half a texel in from each tile side. `inside`
|
|
84
|
+
* also needs the view depth within the last break (checked by the caller).
|
|
85
|
+
*/
|
|
86
|
+
export declare function vdbFrameShadowCascadeUv(clip: Vec2, index: number, size: number): {
|
|
87
|
+
uv: Vec2;
|
|
88
|
+
insideTile: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The map ray of one texel from the drawing camera's inverse view-projection (the core's `vdbFrameVolumeShadowCs`;
|
|
92
|
+
* the same construction as {@link vdbFrameShadowPassRay}: two unprojected points at NDC depth 0.25 and 0.75 give the
|
|
93
|
+
* direction; perspective rays start at the camera, orthographic ones on the camera plane). `ndc`: the texel centre,
|
|
94
|
+
* x right, y up (texel row r ↔ ndc.y = 1 − 2 (r + ½) / size).
|
|
95
|
+
*/
|
|
96
|
+
export declare function vdbFrameShadowMapRay(inverseViewProjection: ArrayLike<number>, cameraPosition: Vec3, perspective: boolean, ndc: Vec2): {
|
|
97
|
+
origin: Vec3;
|
|
98
|
+
direction: Vec3;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The (unnormalized) direction of a cube map texel: face 0–5 (+x, −x, +y, −y, +z, −z), `a`, `b` in [−1, 1] the
|
|
102
|
+
* face coordinates (s, t) × 2 − 1 with t down the rows. WebGPU's cube face selection (the Vulkan table): a cube view
|
|
103
|
+
* sampled with this direction reads this texel.
|
|
104
|
+
*/
|
|
105
|
+
export declare function vdbFrameCubeFaceDirection(face: number, a: number, b: number): Vec3;
|
|
106
|
+
/** The inverse of {@link vdbFrameCubeFaceDirection}: the face and its (s, t) in [0, 1] (t down the rows) of a direction. */
|
|
107
|
+
export declare function vdbFrameCubeFaceUv(d: Vec3): {
|
|
108
|
+
face: number;
|
|
109
|
+
s: number;
|
|
110
|
+
t: number;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The drawing camera of a view-projection (spot lights, explicit cascades): its position and forward axis, and the
|
|
114
|
+
* inverse. Perspective: the centre is VP⁻¹ (0, 0, 1, 0) (clip w = 0 on the camera); orthographic: the near plane centre
|
|
115
|
+
* moved back by `near` along the forward axis. Forward: from the near plane centre to the far plane centre.
|
|
116
|
+
*/
|
|
117
|
+
export declare function vdbFrameShadowViewCamera(viewProjection: ArrayLike<number>, near: number, orthographic: boolean): {
|
|
118
|
+
inverse: Float64Array;
|
|
119
|
+
position: Vec3;
|
|
120
|
+
forward: Vec3;
|
|
121
|
+
};
|
|
122
|
+
/** Inputs of {@link vdbFrameShadowFitCascades}: the view camera, the light and the casters (the last grid cascade). */
|
|
123
|
+
export interface VDBFrameShadowFitInputs {
|
|
124
|
+
/** View → world of the camera (three's `camera.matrixWorld`). */
|
|
125
|
+
cameraWorld: ArrayLike<number>;
|
|
126
|
+
/** Clip → view of the camera (three's `camera.projectionMatrixInverse`). */
|
|
127
|
+
projectionInverse: ArrayLike<number>;
|
|
128
|
+
near: number;
|
|
129
|
+
far: number;
|
|
130
|
+
orthographic: boolean;
|
|
131
|
+
castShadowDistance: number;
|
|
132
|
+
/** Cascades (clamped to 1..4). */
|
|
133
|
+
count: number;
|
|
134
|
+
/** Map texels per side (the snap). */
|
|
135
|
+
size: number;
|
|
136
|
+
/** The way the light travels (normalized here). */
|
|
137
|
+
lightDirection: Vec3;
|
|
138
|
+
/** The box of all casters (the last grid cascade). */
|
|
139
|
+
casterBox: {
|
|
140
|
+
min: Vec3;
|
|
141
|
+
max: Vec3;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** One fitted cascade camera: its view-projection (WebGPU depth 0..1), position (the ray origin) and far plane. */
|
|
145
|
+
export interface VDBFrameShadowCascadeCamera {
|
|
146
|
+
viewProjection: Float64Array;
|
|
147
|
+
origin: Vec3;
|
|
148
|
+
far: number;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* His `fitCascades` (FrameVolumeShadows L692–778; three's CSMShadowNode method), engine-free: the practical split of
|
|
152
|
+
* the view depth up to {@link vdbFrameShadowCascadeFar}; per slice a light-aligned orthographic camera sized from the
|
|
153
|
+
* slice diagonal, its centre snapped to texels, its depth range over the slice and the casters (± 1). Returns the
|
|
154
|
+
* cascades, the breaks (padded to 4 with the last ones, as his `cascadeBreaks`) and the light's forward axis.
|
|
155
|
+
*/
|
|
156
|
+
export declare function vdbFrameShadowFitCascades(o: VDBFrameShadowFitInputs): {
|
|
157
|
+
count: number;
|
|
158
|
+
breaks: [number, number, number, number];
|
|
159
|
+
forward: Vec3;
|
|
160
|
+
cascades: VDBFrameShadowCascadeCamera[];
|
|
161
|
+
};
|
|
162
|
+
/** The drawn view of a core volume shadow map, as `VdbVolumeShadowView` holds it (core/frame/wgsl/shadows.ts). */
|
|
163
|
+
export interface VDBFrameVolumeShadowViewCpu {
|
|
164
|
+
/** 0: directional cascades, 1: spot, 2: point (cube). */
|
|
165
|
+
kind: number;
|
|
166
|
+
/** One per layer (cascades); spot: [0]. */
|
|
167
|
+
viewProjection: readonly ArrayLike<number>[];
|
|
168
|
+
/** Ray origin per layer (cascades) or [0]. */
|
|
169
|
+
origin: readonly Vec3[];
|
|
170
|
+
/** Far plane per layer (map depths ÷ far). */
|
|
171
|
+
far: readonly number[];
|
|
172
|
+
forward: Vec3;
|
|
173
|
+
perspective: boolean;
|
|
174
|
+
breaks: readonly number[];
|
|
175
|
+
cascadeCount: number;
|
|
176
|
+
size: number;
|
|
177
|
+
enabled: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The core receiver (`vdbVolumeShadow` / `vdbVolumeShadowCube`), CPU: picks the layer and uv from the drawn view
|
|
181
|
+
* (cascade by view depth, spot by the drawn view-projection, point by the cube face of the direction from the drawn
|
|
182
|
+
* light position), reads the map with `sample(layer, s, t)` (filtered; s, t in [0, 1], t down the rows) and applies
|
|
183
|
+
* {@link vdbFrameShadowReceiver}. 1 outside the map or when disabled.
|
|
184
|
+
*/
|
|
185
|
+
export declare function vdbFrameVolumeShadowLookup(view: VDBFrameVolumeShadowViewCpu, world: Vec3, viewDepth: number, sample: (layer: number, s: number, t: number) => Vec4): number;
|
|
186
|
+
/**
|
|
187
|
+
* K6.4: the spectral receivers (`vdbVolumeShadowRgb` / `vdbVolumeShadowCubeRgb`): each channel's transmittance from the
|
|
188
|
+
* map's rgb twin (`sampleRgb`, the same layer and uv), along the grey texel's first-to-last span.
|
|
189
|
+
*/
|
|
190
|
+
export declare function vdbFrameVolumeShadowLookupRgb(view: VDBFrameVolumeShadowViewCpu, world: Vec3, viewDepth: number, sample: (layer: number, s: number, t: number) => Vec4, sampleRgb: (layer: number, s: number, t: number) => Vec4): Vec3;
|