@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,280 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/core/frameEnvironment.js (setTexels, getDirectionalLights, getShLights: reused through
|
|
3
|
+
// VDBFrameEnvironmentLights in environment.ts), src/three-openvdb/frame/webgpu/FrameEnvironmentMapMaterial.js
|
|
4
|
+
// (the 64 × 32 map of PMREM roughness 0.4 the lights are made from).
|
|
5
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
6
|
+
// Changes (K6.2b, design §3.5, Q3): the host's equirect or cube texture is reduced by our kernels instead of three's
|
|
7
|
+
// PMREM: an exact-area (equirect) or supersampled (cube) 128 × 64 work map, a GGX roughness-0.4 convolution standing
|
|
8
|
+
// in for PMREM roughness 0.4, and SH L2 irradiance (Ramamoorthi–Hanrahan) for the 'outward' term. CPU twins of the
|
|
9
|
+
// core kernels (f64). Divergences: DIVERGES.md (K6.2b rows).
|
|
10
|
+
/**
|
|
11
|
+
* The environment reduction of the core frame renderer (K6.2b) as f64 CPU twins of its WGSL kernels:
|
|
12
|
+
*
|
|
13
|
+
* - `vdbFrameEnvironmentAreaTexel` / `vdbFrameEnvironmentCubeTexel`: one texel of the 128 × 64 work map (map space,
|
|
14
|
+
* row 0 the zenith) from the host texture.
|
|
15
|
+
* - `vdbFrameEnvironmentBlurTexel`: one texel of his 64 × 32 map (world space, his directions) as the GGX
|
|
16
|
+
* (roughness 0.4) convolution of the work map.
|
|
17
|
+
* - `vdbFrameEnvironmentIrradianceSh`: the SH9 radiance projection of the work map in world space (three's basis),
|
|
18
|
+
* which `vdbFrameEnvironmentIrradiance` turns into irradiance (three's getShIrradianceAt).
|
|
19
|
+
* - `vdbFrameEnvironmentReduce`: the environment buffer (lights and SH) from the read-back maps, through
|
|
20
|
+
* {@link VDBFrameEnvironmentLights} (his extraction, unchanged).
|
|
21
|
+
*
|
|
22
|
+
* Map convention of the host texture (equirect): u = atan2(m.z, m.x) / 2π + ½ along x, row 0 is +Y (the zenith),
|
|
23
|
+
* m = R · d the map direction of a world direction d (R: a 3 × 3 column-major rotation, or a rotation with a
|
|
24
|
+
* reflection: three's flipY equirect is diag(1, −1, 1) · R). Cube: WebGPU's face order and orientation.
|
|
25
|
+
*/
|
|
26
|
+
import { VDBFrameEnvironmentLights, frameEnvironmentMapHeight, frameEnvironmentMapWidth, frameEnvironmentModes, frameMaxEnvironmentLights, vdbFrameEnvironmentMapDirection } from "./environment.js";
|
|
27
|
+
import { vdbFrameOctavesOff, vdbFrameShadowTotal } from "./index.js";
|
|
28
|
+
/** Work map size (design §3.3 envPrefilter). */
|
|
29
|
+
export const VDB_FRAME_ENV_WORK_WIDTH = 128;
|
|
30
|
+
export const VDB_FRAME_ENV_WORK_HEIGHT = 64;
|
|
31
|
+
/** GGX roughness of the blur (his PMREM roughness 0.4, `frameEnvironmentMapRoughness`). */
|
|
32
|
+
export const VDB_FRAME_ENV_ROUGHNESS = 0.4;
|
|
33
|
+
/** Most source texels per axis one work texel reads (larger maps are strided). */
|
|
34
|
+
export const VDB_FRAME_ENV_MAX_SPAN = 256;
|
|
35
|
+
/** Near-ties of the 'directional' extraction (brightest texel, nearest seed) go to the first candidate (f32 vs f64). */
|
|
36
|
+
export const VDB_FRAME_ENV_TIE = 1e-5;
|
|
37
|
+
/** Most cube sub-samples per axis of one work texel. */
|
|
38
|
+
export const VDB_FRAME_ENV_MAX_SUPERSAMPLE = 16;
|
|
39
|
+
/** The identity map rotation. */
|
|
40
|
+
export const VDB_FRAME_ENV_IDENTITY = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
41
|
+
/** m = R · d (R column-major). */
|
|
42
|
+
export function vdbFrameEnvToMap(r, d) {
|
|
43
|
+
return [r[0] * d[0] + r[3] * d[1] + r[6] * d[2], r[1] * d[0] + r[4] * d[1] + r[7] * d[2], r[2] * d[0] + r[5] * d[1] + r[8] * d[2]];
|
|
44
|
+
}
|
|
45
|
+
/** d = Rᵀ · m (R orthogonal: its inverse). */
|
|
46
|
+
export function vdbFrameEnvToWorld(r, m) {
|
|
47
|
+
return [r[0] * m[0] + r[1] * m[1] + r[2] * m[2], r[3] * m[0] + r[4] * m[1] + r[5] * m[2], r[6] * m[0] + r[7] * m[1] + r[8] * m[2]];
|
|
48
|
+
}
|
|
49
|
+
/** The map direction of an equirect point: u along x (u = atan2(z, x) / 2π + ½), v from the top row (+Y). */
|
|
50
|
+
export function vdbFrameEquirectDirection(u, v) {
|
|
51
|
+
const theta = v * Math.PI;
|
|
52
|
+
const phi = (u - 0.5) * 2 * Math.PI;
|
|
53
|
+
return [Math.sin(theta) * Math.cos(phi), Math.cos(theta), Math.sin(theta) * Math.sin(phi)];
|
|
54
|
+
}
|
|
55
|
+
/** Solid angle of work map row `y` (exact: Δφ · (cos θ₀ − cos θ₁)). */
|
|
56
|
+
export function vdbFrameEnvWorkSolidAngle(y, width = VDB_FRAME_ENV_WORK_WIDTH, height = VDB_FRAME_ENV_WORK_HEIGHT) {
|
|
57
|
+
return ((2 * Math.PI) / width) * (Math.cos((y * Math.PI) / height) - Math.cos(((y + 1) * Math.PI) / height));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One work map texel from an equirect source: the solid-angle mean of the source over the texel's box (exact
|
|
61
|
+
* overlaps; sources wider than {@link VDB_FRAME_ENV_MAX_SPAN} texels per work texel are strided).
|
|
62
|
+
*/
|
|
63
|
+
export function vdbFrameEnvironmentAreaTexel(src, x, y, workWidth = VDB_FRAME_ENV_WORK_WIDTH, workHeight = VDB_FRAME_ENV_WORK_HEIGHT) {
|
|
64
|
+
const { width: W, height: H, data } = src;
|
|
65
|
+
const u0 = x / workWidth;
|
|
66
|
+
const u1 = (x + 1) / workWidth;
|
|
67
|
+
const v0 = y / workHeight;
|
|
68
|
+
const v1 = (y + 1) / workHeight;
|
|
69
|
+
const i0 = Math.floor(u0 * W);
|
|
70
|
+
const i1 = Math.min(W, Math.ceil(u1 * W));
|
|
71
|
+
const j0 = Math.floor(v0 * H);
|
|
72
|
+
const j1 = Math.min(H, Math.ceil(v1 * H));
|
|
73
|
+
const si = Math.max(1, Math.ceil((i1 - i0) / VDB_FRAME_ENV_MAX_SPAN));
|
|
74
|
+
const sj = Math.max(1, Math.ceil((j1 - j0) / VDB_FRAME_ENV_MAX_SPAN));
|
|
75
|
+
const sum = [0, 0, 0];
|
|
76
|
+
let weight = 0;
|
|
77
|
+
for (let j = j0; j < j1; j += sj) {
|
|
78
|
+
const a = Math.max(j / H, v0) * Math.PI;
|
|
79
|
+
const b = Math.min((j + sj) / H, v1) * Math.PI;
|
|
80
|
+
if (!(b > a))
|
|
81
|
+
continue;
|
|
82
|
+
const wv = Math.cos(a) - Math.cos(b);
|
|
83
|
+
for (let i = i0; i < i1; i += si) {
|
|
84
|
+
const wu = Math.min((i + si) / W, u1) - Math.max(i / W, u0);
|
|
85
|
+
if (!(wu > 0))
|
|
86
|
+
continue;
|
|
87
|
+
const w = wu * wv;
|
|
88
|
+
const at = (j * W + i) * 4;
|
|
89
|
+
for (let c = 0; c < 3; c++)
|
|
90
|
+
sum[c] = sum[c] + data[at + c] * w;
|
|
91
|
+
weight += w;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return weight > 0 ? [sum[0] / weight, sum[1] / weight, sum[2] / weight, 1] : [0, 0, 0, 1];
|
|
95
|
+
}
|
|
96
|
+
/** The face and texel of a cube direction (WebGPU's face order +X, −X, +Y, −Y, +Z, −Z and orientation). */
|
|
97
|
+
export function vdbFrameCubeTexel(m, size) {
|
|
98
|
+
const ax = Math.abs(m[0]);
|
|
99
|
+
const ay = Math.abs(m[1]);
|
|
100
|
+
const az = Math.abs(m[2]);
|
|
101
|
+
let face;
|
|
102
|
+
let ma;
|
|
103
|
+
let sc;
|
|
104
|
+
let tc;
|
|
105
|
+
if (ax >= ay && ax >= az) {
|
|
106
|
+
face = m[0] >= 0 ? 0 : 1;
|
|
107
|
+
ma = ax;
|
|
108
|
+
sc = m[0] >= 0 ? -m[2] : m[2];
|
|
109
|
+
tc = -m[1];
|
|
110
|
+
}
|
|
111
|
+
else if (ay >= az) {
|
|
112
|
+
face = m[1] >= 0 ? 2 : 3;
|
|
113
|
+
ma = ay;
|
|
114
|
+
sc = m[0];
|
|
115
|
+
tc = m[1] >= 0 ? m[2] : -m[2];
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
face = m[2] >= 0 ? 4 : 5;
|
|
119
|
+
ma = az;
|
|
120
|
+
sc = m[2] >= 0 ? m[0] : -m[0];
|
|
121
|
+
tc = -m[1];
|
|
122
|
+
}
|
|
123
|
+
const s = (sc / ma + 1) * 0.5;
|
|
124
|
+
const t = (tc / ma + 1) * 0.5;
|
|
125
|
+
return { face, x: Math.min(Math.max(Math.floor(s * size), 0), size - 1), y: Math.min(Math.max(Math.floor(t * size), 0), size - 1) };
|
|
126
|
+
}
|
|
127
|
+
/** Cube sub-samples per axis of a work texel for a face of `size` texels (about two per cube texel). */
|
|
128
|
+
export function vdbFrameEnvCubeSupersample(size, workHeight = VDB_FRAME_ENV_WORK_HEIGHT) {
|
|
129
|
+
return Math.min(VDB_FRAME_ENV_MAX_SUPERSAMPLE, Math.max(1, Math.ceil((4 * size) / workHeight)));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* One work map texel from a cube source (`faces[f]` an RGBA image of `size`²): k × k sub-samples of the texel's box,
|
|
133
|
+
* each the nearest cube texel, weighted by sin θ (solid angle).
|
|
134
|
+
*/
|
|
135
|
+
export function vdbFrameEnvironmentCubeTexel(faces, size, x, y, workWidth = VDB_FRAME_ENV_WORK_WIDTH, workHeight = VDB_FRAME_ENV_WORK_HEIGHT) {
|
|
136
|
+
const k = vdbFrameEnvCubeSupersample(size, workHeight);
|
|
137
|
+
const sum = [0, 0, 0];
|
|
138
|
+
let weight = 0;
|
|
139
|
+
for (let b = 0; b < k; b++) {
|
|
140
|
+
const v = (y + (b + 0.5) / k) / workHeight;
|
|
141
|
+
const w = Math.sin(v * Math.PI);
|
|
142
|
+
for (let a = 0; a < k; a++) {
|
|
143
|
+
const u = (x + (a + 0.5) / k) / workWidth;
|
|
144
|
+
const t = vdbFrameCubeTexel(vdbFrameEquirectDirection(u, v), size);
|
|
145
|
+
const f = faces[t.face];
|
|
146
|
+
const at = (t.y * size + t.x) * 4;
|
|
147
|
+
for (let c = 0; c < 3; c++)
|
|
148
|
+
sum[c] = sum[c] + f.data[at + c] * w;
|
|
149
|
+
weight += w;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return weight > 0 ? [sum[0] / weight, sum[1] / weight, sum[2] / weight, 1] : [0, 0, 0, 1];
|
|
153
|
+
}
|
|
154
|
+
/** The GGX weight of input direction cosine `c` around the output direction (n = v = r; D(h) · n·l). */
|
|
155
|
+
export function vdbFrameEnvGgxWeight(c, roughness = VDB_FRAME_ENV_ROUGHNESS) {
|
|
156
|
+
if (!(c > 0))
|
|
157
|
+
return 0;
|
|
158
|
+
const a2 = roughness * roughness * roughness * roughness;
|
|
159
|
+
const nh2 = (1 + c) * 0.5;
|
|
160
|
+
const d = nh2 * (a2 - 1) + 1;
|
|
161
|
+
return (a2 / (Math.PI * d * d)) * c;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* One texel (x, y) of his 64 × 32 map: the GGX (roughness 0.4) weighted mean of the work map around his direction
|
|
165
|
+
* of the texel centre (`vdbFrameEnvironmentMapDirection`), the work map in map space (`rotation` world → map).
|
|
166
|
+
*/
|
|
167
|
+
export function vdbFrameEnvironmentBlurTexel(work, rotation, x, y, roughness = VDB_FRAME_ENV_ROUGHNESS) {
|
|
168
|
+
const d = vdbFrameEnvironmentMapDirection((x + 0.5) / frameEnvironmentMapWidth, (y + 0.5) / frameEnvironmentMapHeight);
|
|
169
|
+
const m = vdbFrameEnvToMap(rotation, d);
|
|
170
|
+
const sum = [0, 0, 0];
|
|
171
|
+
let weight = 0;
|
|
172
|
+
for (let j = 0; j < work.height; j++) {
|
|
173
|
+
const omega = vdbFrameEnvWorkSolidAngle(j, work.width, work.height);
|
|
174
|
+
for (let i = 0; i < work.width; i++) {
|
|
175
|
+
const mj = vdbFrameEquirectDirection((i + 0.5) / work.width, (j + 0.5) / work.height);
|
|
176
|
+
const w = vdbFrameEnvGgxWeight(m[0] * mj[0] + m[1] * mj[1] + m[2] * mj[2], roughness) * omega;
|
|
177
|
+
if (!(w > 0))
|
|
178
|
+
continue;
|
|
179
|
+
const at = (j * work.width + i) * 4;
|
|
180
|
+
for (let c = 0; c < 3; c++)
|
|
181
|
+
sum[c] = sum[c] + work.data[at + c] * w;
|
|
182
|
+
weight += w;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return weight > 0 ? [sum[0] / weight, sum[1] / weight, sum[2] / weight, 1] : [0, 0, 0, 1];
|
|
186
|
+
}
|
|
187
|
+
/** three's SH9 basis (SphericalHarmonics3.getBasisAt). */
|
|
188
|
+
export function vdbFrameSh9Basis(d) {
|
|
189
|
+
const [x, y, z] = d;
|
|
190
|
+
return [0.282095, 0.488603 * y, 0.488603 * z, 0.488603 * x, 1.092548 * x * y, 1.092548 * y * z, 0.315392 * (3 * z * z - 1), 1.092548 * x * z, 0.546274 * (x * x - y * y)];
|
|
191
|
+
}
|
|
192
|
+
/** SH9 radiance coefficients (rgb each, three's basis) of the work map in world space: Σ L · Y(Rᵀ m) · Ω. */
|
|
193
|
+
export function vdbFrameEnvironmentIrradianceSh(work, rotation) {
|
|
194
|
+
const out = Array.from({ length: 9 }, () => [0, 0, 0]);
|
|
195
|
+
for (let j = 0; j < work.height; j++) {
|
|
196
|
+
const omega = vdbFrameEnvWorkSolidAngle(j, work.width, work.height);
|
|
197
|
+
for (let i = 0; i < work.width; i++) {
|
|
198
|
+
const d = vdbFrameEnvToWorld(rotation, vdbFrameEquirectDirection((i + 0.5) / work.width, (j + 0.5) / work.height));
|
|
199
|
+
const basis = vdbFrameSh9Basis(d);
|
|
200
|
+
const at = (j * work.width + i) * 4;
|
|
201
|
+
for (let k = 0; k < 9; k++)
|
|
202
|
+
for (let c = 0; c < 3; c++)
|
|
203
|
+
out[k][c] = out[k][c] + Math.max(0, work.data[at + c]) * basis[k] * omega;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
/** Irradiance at a unit normal from SH9 radiance coefficients (three's getShIrradianceAt, Ramamoorthi–Hanrahan). */
|
|
209
|
+
export function vdbFrameEnvironmentIrradiance(sh, n) {
|
|
210
|
+
const [x, y, z] = n;
|
|
211
|
+
const w = [0.886227, 2 * 0.511664 * y, 2 * 0.511664 * z, 2 * 0.511664 * x, 2 * 0.429043 * x * y, 2 * 0.429043 * y * z, 0.743125 * z * z - 0.247708, 2 * 0.429043 * x * z, 0.429043 * (x * x - y * y)];
|
|
212
|
+
const out = [0, 0, 0];
|
|
213
|
+
for (let k = 0; k < 9; k++)
|
|
214
|
+
for (let c = 0; c < 3; c++)
|
|
215
|
+
out[c] = out[c] + sh[k][c] * w[k];
|
|
216
|
+
return [Math.max(out[0], 0), Math.max(out[1], 0), Math.max(out[2], 0)];
|
|
217
|
+
}
|
|
218
|
+
/** Environment modes as the buffer codes them. */
|
|
219
|
+
export const VDB_FRAME_ENV_MODE = { outward: 0, directional: 1, sphericalHarmonics: 2 };
|
|
220
|
+
/**
|
|
221
|
+
* The `envReduce` kernel's output from the read-back 64 × 32 map (`blurred`, his directions, rows from v = 0) and the
|
|
222
|
+
* work map SH (`sh`, before intensity): his lights ('directional' cells sorted by power, or 'spherical-harmonics'
|
|
223
|
+
* quadrature lights) through {@link VDBFrameEnvironmentLights}, colours and SH × intensity.
|
|
224
|
+
*/
|
|
225
|
+
export function vdbFrameEnvironmentReduce(blurred, sh, s) {
|
|
226
|
+
const w = frameEnvironmentMapWidth;
|
|
227
|
+
const h = frameEnvironmentMapHeight;
|
|
228
|
+
const pixels = new Float64Array(w * h * 4);
|
|
229
|
+
for (let i = 0; i < w * h; i++) {
|
|
230
|
+
for (let c = 0; c < 3; c++)
|
|
231
|
+
pixels[i * 4 + c] = blurred[i * 4 + c];
|
|
232
|
+
pixels[i * 4 + 3] = (Math.floor(i / w) + 0.5) / h;
|
|
233
|
+
}
|
|
234
|
+
const lights = new VDBFrameEnvironmentLights(() => Promise.resolve([]));
|
|
235
|
+
const valid = lights.setTexels(pixels);
|
|
236
|
+
const mode = s.environmentLighting === frameEnvironmentModes.directional ? VDB_FRAME_ENV_MODE.directional : s.environmentLighting === frameEnvironmentModes.sphericalHarmonics ? VDB_FRAME_ENV_MODE.sphericalHarmonics : VDB_FRAME_ENV_MODE.outward;
|
|
237
|
+
const out = { valid, mode, count: 0, directions: [], colors: [], sh: sh.map((c) => c.map((v) => (valid ? v * s.intensity : 0))) };
|
|
238
|
+
if (!valid || mode === VDB_FRAME_ENV_MODE.outward)
|
|
239
|
+
return out;
|
|
240
|
+
const list = mode === VDB_FRAME_ENV_MODE.directional ? lights.getDirectionalLights(s.environmentSamples, s.pairs, VDB_FRAME_ENV_TIE) : lights.getShLights(s.environmentShOrder);
|
|
241
|
+
out.count = Math.min(list.length, frameMaxEnvironmentLights);
|
|
242
|
+
out.directions = list.slice(0, out.count).map((l) => [...l.direction]);
|
|
243
|
+
out.colors = list.slice(0, out.count).map((l) => l.color.map((v) => v * s.intensity));
|
|
244
|
+
return out;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The environment term of his density pass in the core ('frame' lighting, K6.2b): the irradiance E a volume adds as
|
|
248
|
+
* albedo · E / π at its visible position. With environment-grid lights the grid (`gridAt`, null outside: then the
|
|
249
|
+
* unshadowed sum of those lights); with only the slot light nothing (the lighting adds it); else 'outward' SH
|
|
250
|
+
* irradiance along `outward`, shadowed between the sky down and up totals (diffusion: the outward and inward halves).
|
|
251
|
+
*/
|
|
252
|
+
export function vdbFrameEnvironmentDensityTerm(env, flags, outward, sky, skyTotals, gridAt, octaves = vdbFrameOctavesOff) {
|
|
253
|
+
if (!env.valid)
|
|
254
|
+
return [0, 0, 0];
|
|
255
|
+
const first = flags.slot ? 1 : 0;
|
|
256
|
+
if (flags.useShadows && flags.grid && env.count > first) {
|
|
257
|
+
const inside = gridAt();
|
|
258
|
+
if (inside)
|
|
259
|
+
return inside;
|
|
260
|
+
const sum = [0, 0, 0];
|
|
261
|
+
for (let i = first; i < env.count; i++)
|
|
262
|
+
for (let c = 0; c < 3; c++)
|
|
263
|
+
sum[c] = sum[c] + env.colors[i][c];
|
|
264
|
+
// K6.3: the unshadowed light gets the octave total of 1
|
|
265
|
+
const total = vdbFrameShadowTotal(1, octaves);
|
|
266
|
+
return [Math.max(sum[0], 0) * total, Math.max(sum[1], 0) * total, Math.max(sum[2], 0) * total];
|
|
267
|
+
}
|
|
268
|
+
if (flags.useShadows && flags.slot && env.count > 0)
|
|
269
|
+
return [0, 0, 0];
|
|
270
|
+
const blend = (outward[0] * sky[0] + outward[1] * sky[1] + outward[2] * sky[2]) * 0.5 + 0.5;
|
|
271
|
+
const [up, down] = skyTotals;
|
|
272
|
+
const shadow = down + (up - down) * blend;
|
|
273
|
+
const e = vdbFrameEnvironmentIrradiance(env.sh, outward);
|
|
274
|
+
if (!flags.diffusion)
|
|
275
|
+
return [e[0] * shadow, e[1] * shadow, e[2] * shadow];
|
|
276
|
+
const inward = up + (down - up) * blend;
|
|
277
|
+
const back = vdbFrameEnvironmentIrradiance(env.sh, [-outward[0], -outward[1], -outward[2]]);
|
|
278
|
+
return [0, 1, 2].map((c) => (e[c] * shadow + back[c] * inward) * 0.5);
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=environment-gpu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-gpu.js","sourceRoot":"","sources":["../../../src/tools/frame/environment-gpu.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mHAAmH;AACnH,gHAAgH;AAChH,uEAAuE;AACvE,4GAA4G;AAC5G,qHAAqH;AACrH,qHAAqH;AACrH,mHAAmH;AACnH,6DAA6D;AAE7D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AACrM,OAAO,EAAE,kBAAkB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AG,KAAK,CAAC;IACxC,MAAM,IAAI,GAAG,6BAA6B,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAE,GAAG,MAAM,CAAC,GAAG,GAAG,CAAS,CAAC;AAClF,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/core/frameEnvironment.js (setTexels, getDirectionalLights, getShLights: reused through\n// VDBFrameEnvironmentLights in environment.ts), src/three-openvdb/frame/webgpu/FrameEnvironmentMapMaterial.js\n// (the 64 × 32 map of PMREM roughness 0.4 the lights are made from).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes (K6.2b, design §3.5, Q3): the host's equirect or cube texture is reduced by our kernels instead of three's\n// PMREM: an exact-area (equirect) or supersampled (cube) 128 × 64 work map, a GGX roughness-0.4 convolution standing\n// in for PMREM roughness 0.4, and SH L2 irradiance (Ramamoorthi–Hanrahan) for the 'outward' term. CPU twins of the\n// core kernels (f64). Divergences: DIVERGES.md (K6.2b rows).\n\n/**\n * The environment reduction of the core frame renderer (K6.2b) as f64 CPU twins of its WGSL kernels:\n *\n * - `vdbFrameEnvironmentAreaTexel` / `vdbFrameEnvironmentCubeTexel`: one texel of the 128 × 64 work map (map space,\n * row 0 the zenith) from the host texture.\n * - `vdbFrameEnvironmentBlurTexel`: one texel of his 64 × 32 map (world space, his directions) as the GGX\n * (roughness 0.4) convolution of the work map.\n * - `vdbFrameEnvironmentIrradianceSh`: the SH9 radiance projection of the work map in world space (three's basis),\n * which `vdbFrameEnvironmentIrradiance` turns into irradiance (three's getShIrradianceAt).\n * - `vdbFrameEnvironmentReduce`: the environment buffer (lights and SH) from the read-back maps, through\n * {@link VDBFrameEnvironmentLights} (his extraction, unchanged).\n *\n * Map convention of the host texture (equirect): u = atan2(m.z, m.x) / 2π + ½ along x, row 0 is +Y (the zenith),\n * m = R · d the map direction of a world direction d (R: a 3 × 3 column-major rotation, or a rotation with a\n * reflection: three's flipY equirect is diag(1, −1, 1) · R). Cube: WebGPU's face order and orientation.\n */\n\nimport { VDBFrameEnvironmentLights, frameEnvironmentMapHeight, frameEnvironmentMapWidth, frameEnvironmentModes, frameMaxEnvironmentLights, vdbFrameEnvironmentMapDirection } from \"./environment.js\";\nimport { vdbFrameOctavesOff, vdbFrameShadowTotal, type Vec3, type Vec4 } from \"./index.js\";\n\n/** Work map size (design §3.3 envPrefilter). */\nexport const VDB_FRAME_ENV_WORK_WIDTH = 128;\nexport const VDB_FRAME_ENV_WORK_HEIGHT = 64;\n/** GGX roughness of the blur (his PMREM roughness 0.4, `frameEnvironmentMapRoughness`). */\nexport const VDB_FRAME_ENV_ROUGHNESS = 0.4;\n/** Most source texels per axis one work texel reads (larger maps are strided). */\nexport const VDB_FRAME_ENV_MAX_SPAN = 256;\n/** Near-ties of the 'directional' extraction (brightest texel, nearest seed) go to the first candidate (f32 vs f64). */\nexport const VDB_FRAME_ENV_TIE = 1e-5;\n/** Most cube sub-samples per axis of one work texel. */\nexport const VDB_FRAME_ENV_MAX_SUPERSAMPLE = 16;\n\n/** A 3 × 3 column-major matrix (world → map). */\nexport type VDBFrameEnvRotation = ArrayLike<number>;\n\n/** The identity map rotation. */\nexport const VDB_FRAME_ENV_IDENTITY: readonly number[] = [1, 0, 0, 0, 1, 0, 0, 0, 1];\n\n/** m = R · d (R column-major). */\nexport function vdbFrameEnvToMap(r: VDBFrameEnvRotation, d: Vec3): Vec3 {\n return [r[0]! * d[0] + r[3]! * d[1] + r[6]! * d[2], r[1]! * d[0] + r[4]! * d[1] + r[7]! * d[2], r[2]! * d[0] + r[5]! * d[1] + r[8]! * d[2]];\n}\n\n/** d = Rᵀ · m (R orthogonal: its inverse). */\nexport function vdbFrameEnvToWorld(r: VDBFrameEnvRotation, m: Vec3): Vec3 {\n return [r[0]! * m[0] + r[1]! * m[1] + r[2]! * m[2], r[3]! * m[0] + r[4]! * m[1] + r[5]! * m[2], r[6]! * m[0] + r[7]! * m[1] + r[8]! * m[2]];\n}\n\n/** The map direction of an equirect point: u along x (u = atan2(z, x) / 2π + ½), v from the top row (+Y). */\nexport function vdbFrameEquirectDirection(u: number, v: number): Vec3 {\n const theta = v * Math.PI;\n const phi = (u - 0.5) * 2 * Math.PI;\n return [Math.sin(theta) * Math.cos(phi), Math.cos(theta), Math.sin(theta) * Math.sin(phi)];\n}\n\n/** Solid angle of work map row `y` (exact: Δφ · (cos θ₀ − cos θ₁)). */\nexport function vdbFrameEnvWorkSolidAngle(y: number, width = VDB_FRAME_ENV_WORK_WIDTH, height = VDB_FRAME_ENV_WORK_HEIGHT): number {\n return ((2 * Math.PI) / width) * (Math.cos((y * Math.PI) / height) - Math.cos(((y + 1) * Math.PI) / height));\n}\n\n/** An RGBA float image, rows from the top (row 0 is the first `width · 4` floats). */\nexport interface VDBFrameEnvImage {\n data: ArrayLike<number>;\n width: number;\n height: number;\n}\n\n/**\n * One work map texel from an equirect source: the solid-angle mean of the source over the texel's box (exact\n * overlaps; sources wider than {@link VDB_FRAME_ENV_MAX_SPAN} texels per work texel are strided).\n */\nexport function vdbFrameEnvironmentAreaTexel(src: VDBFrameEnvImage, x: number, y: number, workWidth = VDB_FRAME_ENV_WORK_WIDTH, workHeight = VDB_FRAME_ENV_WORK_HEIGHT): [number, number, number, number] {\n const { width: W, height: H, data } = src;\n const u0 = x / workWidth;\n const u1 = (x + 1) / workWidth;\n const v0 = y / workHeight;\n const v1 = (y + 1) / workHeight;\n const i0 = Math.floor(u0 * W);\n const i1 = Math.min(W, Math.ceil(u1 * W));\n const j0 = Math.floor(v0 * H);\n const j1 = Math.min(H, Math.ceil(v1 * H));\n const si = Math.max(1, Math.ceil((i1 - i0) / VDB_FRAME_ENV_MAX_SPAN));\n const sj = Math.max(1, Math.ceil((j1 - j0) / VDB_FRAME_ENV_MAX_SPAN));\n const sum = [0, 0, 0];\n let weight = 0;\n for (let j = j0; j < j1; j += sj) {\n const a = Math.max(j / H, v0) * Math.PI;\n const b = Math.min((j + sj) / H, v1) * Math.PI;\n if (!(b > a)) continue;\n const wv = Math.cos(a) - Math.cos(b);\n for (let i = i0; i < i1; i += si) {\n const wu = Math.min((i + si) / W, u1) - Math.max(i / W, u0);\n if (!(wu > 0)) continue;\n const w = wu * wv;\n const at = (j * W + i) * 4;\n for (let c = 0; c < 3; c++) sum[c] = sum[c]! + data[at + c]! * w;\n weight += w;\n }\n }\n return weight > 0 ? [sum[0]! / weight, sum[1]! / weight, sum[2]! / weight, 1] : [0, 0, 0, 1];\n}\n\n/** The face and texel of a cube direction (WebGPU's face order +X, −X, +Y, −Y, +Z, −Z and orientation). */\nexport function vdbFrameCubeTexel(m: Vec3, size: number): { face: number; x: number; y: number } {\n const ax = Math.abs(m[0]);\n const ay = Math.abs(m[1]);\n const az = Math.abs(m[2]);\n let face: number;\n let ma: number;\n let sc: number;\n let tc: number;\n if (ax >= ay && ax >= az) {\n face = m[0] >= 0 ? 0 : 1;\n ma = ax;\n sc = m[0] >= 0 ? -m[2] : m[2];\n tc = -m[1];\n } else if (ay >= az) {\n face = m[1] >= 0 ? 2 : 3;\n ma = ay;\n sc = m[0];\n tc = m[1] >= 0 ? m[2] : -m[2];\n } else {\n face = m[2] >= 0 ? 4 : 5;\n ma = az;\n sc = m[2] >= 0 ? m[0] : -m[0];\n tc = -m[1];\n }\n const s = (sc / ma + 1) * 0.5;\n const t = (tc / ma + 1) * 0.5;\n return { face, x: Math.min(Math.max(Math.floor(s * size), 0), size - 1), y: Math.min(Math.max(Math.floor(t * size), 0), size - 1) };\n}\n\n/** Cube sub-samples per axis of a work texel for a face of `size` texels (about two per cube texel). */\nexport function vdbFrameEnvCubeSupersample(size: number, workHeight = VDB_FRAME_ENV_WORK_HEIGHT): number {\n return Math.min(VDB_FRAME_ENV_MAX_SUPERSAMPLE, Math.max(1, Math.ceil((4 * size) / workHeight)));\n}\n\n/**\n * One work map texel from a cube source (`faces[f]` an RGBA image of `size`²): k × k sub-samples of the texel's box,\n * each the nearest cube texel, weighted by sin θ (solid angle).\n */\nexport function vdbFrameEnvironmentCubeTexel(faces: readonly VDBFrameEnvImage[], size: number, x: number, y: number, workWidth = VDB_FRAME_ENV_WORK_WIDTH, workHeight = VDB_FRAME_ENV_WORK_HEIGHT): [number, number, number, number] {\n const k = vdbFrameEnvCubeSupersample(size, workHeight);\n const sum = [0, 0, 0];\n let weight = 0;\n for (let b = 0; b < k; b++) {\n const v = (y + (b + 0.5) / k) / workHeight;\n const w = Math.sin(v * Math.PI);\n for (let a = 0; a < k; a++) {\n const u = (x + (a + 0.5) / k) / workWidth;\n const t = vdbFrameCubeTexel(vdbFrameEquirectDirection(u, v), size);\n const f = faces[t.face]!;\n const at = (t.y * size + t.x) * 4;\n for (let c = 0; c < 3; c++) sum[c] = sum[c]! + f.data[at + c]! * w;\n weight += w;\n }\n }\n return weight > 0 ? [sum[0]! / weight, sum[1]! / weight, sum[2]! / weight, 1] : [0, 0, 0, 1];\n}\n\n/** The GGX weight of input direction cosine `c` around the output direction (n = v = r; D(h) · n·l). */\nexport function vdbFrameEnvGgxWeight(c: number, roughness = VDB_FRAME_ENV_ROUGHNESS): number {\n if (!(c > 0)) return 0;\n const a2 = roughness * roughness * roughness * roughness;\n const nh2 = (1 + c) * 0.5;\n const d = nh2 * (a2 - 1) + 1;\n return (a2 / (Math.PI * d * d)) * c;\n}\n\n/**\n * One texel (x, y) of his 64 × 32 map: the GGX (roughness 0.4) weighted mean of the work map around his direction\n * of the texel centre (`vdbFrameEnvironmentMapDirection`), the work map in map space (`rotation` world → map).\n */\nexport function vdbFrameEnvironmentBlurTexel(work: VDBFrameEnvImage, rotation: VDBFrameEnvRotation, x: number, y: number, roughness = VDB_FRAME_ENV_ROUGHNESS): [number, number, number, number] {\n const d = vdbFrameEnvironmentMapDirection((x + 0.5) / frameEnvironmentMapWidth, (y + 0.5) / frameEnvironmentMapHeight);\n const m = vdbFrameEnvToMap(rotation, d);\n const sum = [0, 0, 0];\n let weight = 0;\n for (let j = 0; j < work.height; j++) {\n const omega = vdbFrameEnvWorkSolidAngle(j, work.width, work.height);\n for (let i = 0; i < work.width; i++) {\n const mj = vdbFrameEquirectDirection((i + 0.5) / work.width, (j + 0.5) / work.height);\n const w = vdbFrameEnvGgxWeight(m[0] * mj[0] + m[1] * mj[1] + m[2] * mj[2], roughness) * omega;\n if (!(w > 0)) continue;\n const at = (j * work.width + i) * 4;\n for (let c = 0; c < 3; c++) sum[c] = sum[c]! + work.data[at + c]! * w;\n weight += w;\n }\n }\n return weight > 0 ? [sum[0]! / weight, sum[1]! / weight, sum[2]! / weight, 1] : [0, 0, 0, 1];\n}\n\n/** three's SH9 basis (SphericalHarmonics3.getBasisAt). */\nexport function vdbFrameSh9Basis(d: Vec3): number[] {\n const [x, y, z] = d;\n return [0.282095, 0.488603 * y, 0.488603 * z, 0.488603 * x, 1.092548 * x * y, 1.092548 * y * z, 0.315392 * (3 * z * z - 1), 1.092548 * x * z, 0.546274 * (x * x - y * y)];\n}\n\n/** SH9 radiance coefficients (rgb each, three's basis) of the work map in world space: Σ L · Y(Rᵀ m) · Ω. */\nexport function vdbFrameEnvironmentIrradianceSh(work: VDBFrameEnvImage, rotation: VDBFrameEnvRotation): Vec3[] {\n const out: Vec3[] = Array.from({ length: 9 }, () => [0, 0, 0] as Vec3);\n for (let j = 0; j < work.height; j++) {\n const omega = vdbFrameEnvWorkSolidAngle(j, work.width, work.height);\n for (let i = 0; i < work.width; i++) {\n const d = vdbFrameEnvToWorld(rotation, vdbFrameEquirectDirection((i + 0.5) / work.width, (j + 0.5) / work.height));\n const basis = vdbFrameSh9Basis(d);\n const at = (j * work.width + i) * 4;\n for (let k = 0; k < 9; k++) for (let c = 0; c < 3; c++) out[k]![c] = out[k]![c]! + Math.max(0, work.data[at + c]!) * basis[k]! * omega;\n }\n }\n return out;\n}\n\n/** Irradiance at a unit normal from SH9 radiance coefficients (three's getShIrradianceAt, Ramamoorthi–Hanrahan). */\nexport function vdbFrameEnvironmentIrradiance(sh: readonly Vec3[], n: Vec3): Vec3 {\n const [x, y, z] = n;\n const w = [0.886227, 2 * 0.511664 * y, 2 * 0.511664 * z, 2 * 0.511664 * x, 2 * 0.429043 * x * y, 2 * 0.429043 * y * z, 0.743125 * z * z - 0.247708, 2 * 0.429043 * x * z, 0.429043 * (x * x - y * y)];\n const out: Vec3 = [0, 0, 0];\n for (let k = 0; k < 9; k++) for (let c = 0; c < 3; c++) out[c] = out[c]! + sh[k]![c]! * w[k]!;\n return [Math.max(out[0], 0), Math.max(out[1], 0), Math.max(out[2], 0)];\n}\n\n/** Environment modes as the buffer codes them. */\nexport const VDB_FRAME_ENV_MODE = { outward: 0, directional: 1, sphericalHarmonics: 2 } as const;\n\n/** The environment buffer's content (`VdbFrameEnvironment`), as the twin computes it. */\nexport interface VDBFrameEnvironmentGpuResult {\n /** An environment with finite, positive energy. */\n valid: boolean;\n mode: number;\n count: number;\n directions: Vec3[];\n colors: Vec3[];\n /** SH9 radiance coefficients × intensity (irradiance through {@link vdbFrameEnvironmentIrradiance}). */\n sh: Vec3[];\n}\n\n/** The settings the reduction reads. */\nexport interface VDBFrameEnvironmentReduceSettings {\n environmentLighting: string;\n environmentSamples: number;\n environmentShOrder: number;\n /** Diffusion multiple scattering: the 'directional' seeds come in opposite pairs. */\n pairs: boolean;\n intensity: number;\n}\n\n/**\n * The `envReduce` kernel's output from the read-back 64 × 32 map (`blurred`, his directions, rows from v = 0) and the\n * work map SH (`sh`, before intensity): his lights ('directional' cells sorted by power, or 'spherical-harmonics'\n * quadrature lights) through {@link VDBFrameEnvironmentLights}, colours and SH × intensity.\n */\nexport function vdbFrameEnvironmentReduce(blurred: ArrayLike<number>, sh: readonly Vec3[], s: VDBFrameEnvironmentReduceSettings): VDBFrameEnvironmentGpuResult {\n const w = frameEnvironmentMapWidth;\n const h = frameEnvironmentMapHeight;\n const pixels = new Float64Array(w * h * 4);\n for (let i = 0; i < w * h; i++) {\n for (let c = 0; c < 3; c++) pixels[i * 4 + c] = blurred[i * 4 + c]!;\n pixels[i * 4 + 3] = (Math.floor(i / w) + 0.5) / h;\n }\n const lights = new VDBFrameEnvironmentLights(() => Promise.resolve([]));\n const valid = lights.setTexels(pixels);\n const mode = s.environmentLighting === frameEnvironmentModes.directional ? VDB_FRAME_ENV_MODE.directional : s.environmentLighting === frameEnvironmentModes.sphericalHarmonics ? VDB_FRAME_ENV_MODE.sphericalHarmonics : VDB_FRAME_ENV_MODE.outward;\n const out: VDBFrameEnvironmentGpuResult = { valid, mode, count: 0, directions: [], colors: [], sh: sh.map((c) => c.map((v) => (valid ? v * s.intensity : 0)) as Vec3) };\n if (!valid || mode === VDB_FRAME_ENV_MODE.outward) return out;\n const list = mode === VDB_FRAME_ENV_MODE.directional ? lights.getDirectionalLights(s.environmentSamples, s.pairs, VDB_FRAME_ENV_TIE) : lights.getShLights(s.environmentShOrder);\n out.count = Math.min(list.length, frameMaxEnvironmentLights);\n out.directions = list.slice(0, out.count).map((l) => [...l.direction] as Vec3);\n out.colors = list.slice(0, out.count).map((l) => l.color.map((v) => v * s.intensity) as Vec3);\n return out;\n}\n\n/** The renderer's environment flags of 'frame' lighting (`VdbFrameUniforms.environment`, `lighting.z`, `lighting.w`). */\nexport interface VDBFrameEnvironmentFlags {\n /** The shadow grid is in use. */\n useShadows: boolean;\n /** The dominant 'directional' light has a shadow slot. */\n slot: boolean;\n /** The environment grid holds this frame's lights. */\n grid: boolean;\n /** Diffusion multiple scattering. */\n diffusion: boolean;\n}\n\n/**\n * The environment term of his density pass in the core ('frame' lighting, K6.2b): the irradiance E a volume adds as\n * albedo · E / π at its visible position. With environment-grid lights the grid (`gridAt`, null outside: then the\n * unshadowed sum of those lights); with only the slot light nothing (the lighting adds it); else 'outward' SH\n * irradiance along `outward`, shadowed between the sky down and up totals (diffusion: the outward and inward halves).\n */\nexport function vdbFrameEnvironmentDensityTerm(env: VDBFrameEnvironmentGpuResult, flags: VDBFrameEnvironmentFlags, outward: Vec3, sky: Vec3, skyTotals: [number, number], gridAt: () => Vec3 | null, octaves: Vec4 = vdbFrameOctavesOff): Vec3 {\n if (!env.valid) return [0, 0, 0];\n const first = flags.slot ? 1 : 0;\n if (flags.useShadows && flags.grid && env.count > first) {\n const inside = gridAt();\n if (inside) return inside;\n const sum: Vec3 = [0, 0, 0];\n for (let i = first; i < env.count; i++) for (let c = 0; c < 3; c++) sum[c] = sum[c]! + env.colors[i]![c]!;\n // K6.3: the unshadowed light gets the octave total of 1\n const total = vdbFrameShadowTotal(1, octaves);\n return [Math.max(sum[0], 0) * total, Math.max(sum[1], 0) * total, Math.max(sum[2], 0) * total];\n }\n if (flags.useShadows && flags.slot && env.count > 0) return [0, 0, 0];\n const blend = (outward[0] * sky[0] + outward[1] * sky[1] + outward[2] * sky[2]) * 0.5 + 0.5;\n const [up, down] = skyTotals;\n const shadow = down + (up - down) * blend;\n const e = vdbFrameEnvironmentIrradiance(env.sh, outward);\n if (!flags.diffusion) return [e[0] * shadow, e[1] * shadow, e[2] * shadow];\n const inward = up + (down - up) * blend;\n const back = vdbFrameEnvironmentIrradiance(env.sh, [-outward[0], -outward[1], -outward[2]]);\n return [0, 1, 2].map((c) => (e[c]! * shadow + back[c]! * inward) * 0.5) as Vec3;\n}\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-directional environment light (Disney "Deep Scattering", §4.4 and §7), engine-free (K3.3):
|
|
3
|
+
* the scene environment is read once into a small lat-long map (64 × 32, PMREM roughness 0.4); the
|
|
4
|
+
* CPU turns it into ≤ 12 directional lights. `'directional'`: the brightest texel plus fixed sky
|
|
5
|
+
* directions (zenith, nadir, a horizon ring; opposite pairs with diffusion), each texel to its
|
|
6
|
+
* nearest seed, a light at the energy centroid with energy / 4. `'spherical-harmonics'`: SH L1/L2
|
|
7
|
+
* projection evaluated at quadrature directions. The three adapter draws the map and passes the
|
|
8
|
+
* readback through `extract`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const frameMaxEnvironmentLights = 12;
|
|
11
|
+
export declare const frameMaxEnvironmentSamples = 8;
|
|
12
|
+
export declare const frameEnvironmentMapWidth = 64;
|
|
13
|
+
export declare const frameEnvironmentMapHeight = 32;
|
|
14
|
+
/** PMREM blur of the map: a small sun covers more than one texel and is not lost between texels. */
|
|
15
|
+
export declare const frameEnvironmentMapRoughness = 0.4;
|
|
16
|
+
export declare const frameEnvironmentModes: {
|
|
17
|
+
readonly outward: "outward";
|
|
18
|
+
readonly directional: "directional";
|
|
19
|
+
readonly sphericalHarmonics: "spherical-harmonics";
|
|
20
|
+
};
|
|
21
|
+
export type VDBFrameEnvironmentMode = (typeof frameEnvironmentModes)[keyof typeof frameEnvironmentModes];
|
|
22
|
+
/** The renderer settings the environment lights read. */
|
|
23
|
+
export interface VDBFrameEnvironmentSettings {
|
|
24
|
+
environmentLighting: string;
|
|
25
|
+
environmentSamples: number;
|
|
26
|
+
environmentShOrder: number;
|
|
27
|
+
multipleScattering: boolean | string;
|
|
28
|
+
}
|
|
29
|
+
/** The scene fields the environment lights read (three's `Scene` fits). */
|
|
30
|
+
export interface VDBFrameEnvironmentScene {
|
|
31
|
+
environment: {
|
|
32
|
+
uuid: string;
|
|
33
|
+
version: number;
|
|
34
|
+
} | null;
|
|
35
|
+
environmentRotation: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
z: number;
|
|
39
|
+
order: string;
|
|
40
|
+
};
|
|
41
|
+
environmentIntensity: number;
|
|
42
|
+
}
|
|
43
|
+
type V3 = [number, number, number];
|
|
44
|
+
/** The same direction as the map shaders. u and v are 0 to 1; v = 0 is +Y. */
|
|
45
|
+
export declare const vdbFrameEnvironmentMapDirection: (u: number, v: number) => V3;
|
|
46
|
+
export declare const vdbFrameEnvironmentMode: (settings: Pick<VDBFrameEnvironmentSettings, "environmentLighting">) => VDBFrameEnvironmentMode;
|
|
47
|
+
interface Texel {
|
|
48
|
+
radiance: V3;
|
|
49
|
+
luminance: number;
|
|
50
|
+
direction: V3;
|
|
51
|
+
solidAngle: number;
|
|
52
|
+
}
|
|
53
|
+
/** One environment light: world direction to the light and its isotropic irradiance colour (energy / 4). */
|
|
54
|
+
export interface VDBFrameEnvironmentLight {
|
|
55
|
+
direction: V3;
|
|
56
|
+
color: V3;
|
|
57
|
+
power?: number;
|
|
58
|
+
}
|
|
59
|
+
/** Output of {@link VDBFrameEnvironmentLights.update}. Colours include `scene.environmentIntensity`. */
|
|
60
|
+
export interface VDBFrameEnvironmentResult {
|
|
61
|
+
mode: VDBFrameEnvironmentMode;
|
|
62
|
+
count: number;
|
|
63
|
+
directions: V3[];
|
|
64
|
+
colors: V3[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* His `FrameEnvironmentLights`: holds the lat-long map of the scene environment and the lights made
|
|
68
|
+
* from it. `extract(renderer, scene)` is the engine part: it draws the map (RGB radiance, A the
|
|
69
|
+
* texel's v, so the readback row order does not matter) and resolves RGBA floats.
|
|
70
|
+
*/
|
|
71
|
+
export declare class VDBFrameEnvironmentLights<R = unknown, S extends VDBFrameEnvironmentScene = VDBFrameEnvironmentScene> {
|
|
72
|
+
readonly extract: (renderer: R, scene: S) => Promise<ArrayLike<number>>;
|
|
73
|
+
key: string | null;
|
|
74
|
+
pending: boolean;
|
|
75
|
+
retryAt: number;
|
|
76
|
+
updates: number;
|
|
77
|
+
texels: Texel[] | null;
|
|
78
|
+
texelsVersion: number;
|
|
79
|
+
warned: boolean;
|
|
80
|
+
lightsKey: string | null;
|
|
81
|
+
lights: VDBFrameEnvironmentLight[];
|
|
82
|
+
readonly result: VDBFrameEnvironmentResult;
|
|
83
|
+
constructor(extract: (renderer: R, scene: S) => Promise<ArrayLike<number>>);
|
|
84
|
+
getKey(scene: S): string;
|
|
85
|
+
/** Null when the 'outward' path must be used: another mode, no environment, or no map yet. */
|
|
86
|
+
update(renderer: R, scene: S, settings: VDBFrameEnvironmentSettings): VDBFrameEnvironmentResult | null;
|
|
87
|
+
/** Resolves when a pending map readback has settled (tests and harnesses; not his). */
|
|
88
|
+
settled: Promise<void>;
|
|
89
|
+
requestMap(renderer: R, scene: S, key: string): void;
|
|
90
|
+
/** Radiance, direction and solid angle of each texel. Returns false for an empty map. Half floats (Uint16Array) are decoded. */
|
|
91
|
+
setTexels(pixels: ArrayLike<number>): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Dominant direction (brightest texel) and fixed sky directions: zenith, nadir, then a horizon ring.
|
|
94
|
+
* Each texel goes to the nearest direction; a light is at the energy centroid of its texels with
|
|
95
|
+
* their energy; colour is energy / 4 (a uniform environment then gives the 'outward' light).
|
|
96
|
+
* `pairs`: seeds in opposite pairs (diffusion weights of a pair sum to 2). `tie` (K6.2b, the core): near-ties go to
|
|
97
|
+
* the first candidate.
|
|
98
|
+
*/
|
|
99
|
+
getDirectionalLights(samples: number, pairs?: boolean, tie?: number): VDBFrameEnvironmentLight[];
|
|
100
|
+
/**
|
|
101
|
+
* SH projection of the environment (L1: 4, L2: 9 coefficients) evaluated at quadrature directions:
|
|
102
|
+
* direction m gets the colour (4π / M) L_sh(w_m) / 4. The shaders clamp the sum to ≥ 0.
|
|
103
|
+
*/
|
|
104
|
+
getShLights(order: number): VDBFrameEnvironmentLight[];
|
|
105
|
+
}
|
|
106
|
+
export {};
|