@pmndrs/vdb 0.1.0 → 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 +592 -2
- package/README.md +85 -37
- package/THIRD_PARTY_NOTICES.md +197 -29
- package/dist/core/compute/atlas.d.ts +10 -2
- package/dist/core/compute/atlas.js +6 -1
- package/dist/core/compute/atlas.js.map +1 -1
- package/dist/core/compute/index.d.ts +3 -3
- package/dist/core/compute/index.js +2 -2
- package/dist/core/compute/index.js.map +1 -1
- 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 +22 -7
- package/dist/core/compute/pyramid.js +22 -9
- package/dist/core/compute/pyramid.js.map +1 -1
- package/dist/core/compute/shared.d.ts +1 -0
- package/dist/core/compute/shared.js.map +1 -1
- package/dist/core/compute/stats.d.ts +10 -3
- package/dist/core/compute/stats.js +6 -1
- package/dist/core/compute/stats.js.map +1 -1
- package/dist/core/compute/value-transform.d.ts +8 -1
- package/dist/core/compute/value-transform.js +9 -3
- package/dist/core/compute/value-transform.js.map +1 -1
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.js +8 -0
- package/dist/core/errors.js.map +1 -1
- 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 +25 -3
- package/dist/core/index.js +23 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/internal.d.ts +17 -1
- package/dist/core/internal.js +18 -1
- package/dist/core/internal.js.map +1 -1
- package/dist/core/pool/image-header.d.ts +13 -2
- package/dist/core/pool/image-header.js +24 -5
- package/dist/core/pool/image-header.js.map +1 -1
- package/dist/core/pool/layout.d.ts +35 -1
- package/dist/core/pool/layout.js +51 -2
- package/dist/core/pool/layout.js.map +1 -1
- package/dist/core/pool/limits.d.ts +1 -0
- package/dist/core/pool/limits.js +1 -0
- package/dist/core/pool/limits.js.map +1 -1
- package/dist/core/pool/pool.d.ts +120 -15
- package/dist/core/pool/pool.js +255 -24
- package/dist/core/pool/pool.js.map +1 -1
- 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/{three → core}/sequence.d.ts +32 -2
- package/dist/{three → core}/sequence.js +24 -2
- 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 +33 -2
- package/dist/core/source/dense.js +121 -24
- package/dist/core/source/dense.js.map +1 -1
- 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 +59 -2
- package/dist/core/source/types.js.map +1 -1
- 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 +12 -3
- package/dist/core/types.js +6 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/wgsl/api.d.ts +29 -5
- package/dist/core/wgsl/api.js +110 -27
- package/dist/core/wgsl/api.js.map +1 -1
- package/dist/core/wgsl/generate.d.ts +8 -0
- package/dist/core/wgsl/generate.js +195 -22
- package/dist/core/wgsl/generate.js.map +1 -1
- 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 +5 -1
- package/dist/core/wgsl/level-set.js +11 -5
- package/dist/core/wgsl/level-set.js.map +1 -1
- 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 +2 -2
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
- package/dist/core/wgsl/types.d.ts +97 -3
- package/dist/core/wgsl/types.js.map +1 -1
- package/dist/three/coarse-first.d.ts +53 -8
- package/dist/three/coarse-first.js +24 -6
- package/dist/three/coarse-first.js.map +1 -1
- package/dist/three/compute.d.ts +12 -2
- package/dist/three/compute.js +16 -6
- package/dist/three/compute.js.map +1 -1
- package/dist/three/device.d.ts +7 -0
- package/dist/three/device.js +3 -0
- package/dist/three/device.js.map +1 -1
- 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 +64 -114
- package/dist/three/frame/emission-light.js +188 -567
- package/dist/three/frame/emission-light.js.map +1 -1
- package/dist/three/frame/index.d.ts +11 -31
- package/dist/three/frame/index.js +9 -29
- package/dist/three/frame/index.js.map +1 -1
- package/dist/three/frame/medium.d.ts +12 -0
- package/dist/three/frame/medium.js.map +1 -1
- package/dist/three/frame/renderer.d.ts +58 -454
- package/dist/three/frame/renderer.js +409 -1427
- package/dist/three/frame/renderer.js.map +1 -1
- package/dist/three/frame/spectrum.d.ts +0 -14
- package/dist/three/frame/spectrum.js +2 -23
- package/dist/three/frame/spectrum.js.map +1 -1
- package/dist/three/frame/three-internals.d.ts +3 -8
- package/dist/three/frame/three-internals.js +13 -11
- package/dist/three/frame/three-internals.js.map +1 -1
- package/dist/three/frame/volume-shadows.d.ts +93 -107
- package/dist/three/frame/volume-shadows.js +278 -631
- package/dist/three/frame/volume-shadows.js.map +1 -1
- package/dist/three/frame/volume.d.ts +91 -33
- package/dist/three/frame/volume.js +63 -51
- package/dist/three/frame/volume.js.map +1 -1
- package/dist/three/grid-node.d.ts +34 -1
- package/dist/three/grid-node.js +36 -1
- package/dist/three/grid-node.js.map +1 -1
- package/dist/three/index.d.ts +20 -11
- package/dist/three/index.js +21 -12
- package/dist/three/index.js.map +1 -1
- package/dist/three/internal.d.ts +14 -8
- package/dist/three/internal.js +11 -7
- package/dist/three/internal.js.map +1 -1
- package/dist/three/level-set-material.d.ts +81 -8
- package/dist/three/level-set-material.js +162 -125
- package/dist/three/level-set-material.js.map +1 -1
- 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 +141 -11
- package/dist/three/material.js +161 -18
- package/dist/three/material.js.map +1 -1
- package/dist/three/points.d.ts +60 -4
- package/dist/three/points.js +140 -9
- package/dist/three/points.js.map +1 -1
- package/dist/three/sparse-source.d.ts +49 -117
- package/dist/three/sparse-source.js +109 -580
- package/dist/three/sparse-source.js.map +1 -1
- package/dist/three/volume-source.d.ts +11 -156
- package/dist/three/volume-source.js +29 -272
- package/dist/three/volume-source.js.map +1 -1
- 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 +23 -4
- package/dist/tools/cpu/compute.js +35 -14
- package/dist/tools/cpu/compute.js.map +1 -1
- 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 +42 -3
- package/dist/tools/cpu/level-set.js +59 -7
- package/dist/tools/cpu/level-set.js.map +1 -1
- 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 +93 -2
- package/dist/tools/cpu/march.js +165 -14
- package/dist/tools/cpu/march.js.map +1 -1
- 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/read-value.d.ts +19 -6
- package/dist/tools/cpu/read-value.js +32 -17
- package/dist/tools/cpu/read-value.js.map +1 -1
- package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
- package/dist/tools/cpu/sample-trilinear.js +19 -7
- package/dist/tools/cpu/sample-trilinear.js.map +1 -1
- package/dist/tools/cpu/stride-tables.d.ts +2 -2
- package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
- package/dist/tools/cpu/stride-tables.generated.js +7 -6
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
- package/dist/tools/cpu/stride-tables.js +1 -1
- package/dist/tools/cpu/stride-tables.js.map +1 -1
- 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 +9 -0
- package/dist/tools/errors.js +9 -0
- package/dist/tools/errors.js.map +1 -1
- 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 +15 -0
- package/dist/tools/frame/blackbody.js +35 -0
- package/dist/tools/frame/blackbody.js.map +1 -1
- 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 +9 -0
- package/dist/tools/frame/emission.js +9 -1
- package/dist/tools/frame/emission.js.map +1 -1
- 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 +3 -2
- package/dist/tools/frame/environment.js +8 -4
- package/dist/tools/frame/environment.js.map +1 -1
- 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 +90 -0
- package/dist/tools/frame/grid.js +112 -13
- package/dist/tools/frame/grid.js.map +1 -1
- package/dist/tools/frame/index.d.ts +14 -0
- package/dist/tools/frame/index.js +45 -4
- package/dist/tools/frame/index.js.map +1 -1
- package/dist/tools/frame/medium.d.ts +16 -0
- package/dist/tools/frame/medium.js +3 -1
- package/dist/tools/frame/medium.js.map +1 -1
- package/dist/tools/frame/mie.d.ts +9 -0
- package/dist/tools/frame/mie.js +18 -0
- package/dist/tools/frame/mie.js.map +1 -1
- 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 +6 -5
- package/dist/tools/frame/neural-weights.js +234 -235
- package/dist/tools/frame/neural-weights.js.map +1 -1
- package/dist/tools/frame/neural.js +1 -1
- package/dist/tools/frame/neural.js.map +1 -1
- 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 +17 -0
- package/dist/tools/frame/pyramid-layout.js +47 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -1
- package/dist/tools/frame/shadows.d.ts +110 -0
- package/dist/tools/frame/shadows.js +286 -0
- package/dist/tools/frame/shadows.js.map +1 -1
- package/dist/tools/frame/sparse.d.ts +82 -0
- package/dist/tools/frame/sparse.js +242 -1
- package/dist/tools/frame/sparse.js.map +1 -1
- 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 +21 -2
- package/dist/tools/frame/spectral.js +30 -8
- package/dist/tools/frame/spectral.js.map +1 -1
- 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 +66 -15
- package/dist/tools/index.js +55 -11
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/internal.d.ts +58 -17
- package/dist/tools/internal.js +65 -11
- package/dist/tools/internal.js.map +1 -1
- package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
- package/dist/tools/nanovdb/build-from-vdb.js +10 -2
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
- package/dist/tools/nanovdb/bytes.d.ts +17 -4
- package/dist/tools/nanovdb/bytes.js +46 -3
- package/dist/tools/nanovdb/bytes.js.map +1 -1
- package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
- package/dist/tools/nanovdb/coarse-first.js +7 -1
- package/dist/tools/nanovdb/coarse-first.js.map +1 -1
- 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 +3 -1
- package/dist/tools/nanovdb/index.js +2 -1
- package/dist/tools/nanovdb/index.js.map +1 -1
- package/dist/tools/nanovdb/inspect.d.ts +10 -1
- package/dist/tools/nanovdb/inspect.js +8 -1
- package/dist/tools/nanovdb/inspect.js.map +1 -1
- package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
- package/dist/tools/nanovdb/leaf-codec.js +40 -4
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
- package/dist/tools/nanovdb/quantize.d.ts +39 -10
- package/dist/tools/nanovdb/quantize.js +96 -44
- package/dist/tools/nanovdb/quantize.js.map +1 -1
- package/dist/tools/nanovdb/resample.d.ts +20 -3
- package/dist/tools/nanovdb/resample.js +20 -7
- package/dist/tools/nanovdb/resample.js.map +1 -1
- package/dist/tools/nanovdb/serialize.d.ts +34 -3
- package/dist/tools/nanovdb/serialize.js +51 -7
- package/dist/tools/nanovdb/serialize.js.map +1 -1
- package/dist/tools/nanovdb/stats.d.ts +34 -5
- package/dist/tools/nanovdb/stats.js +87 -11
- package/dist/tools/nanovdb/stats.js.map +1 -1
- package/dist/tools/nanovdb/transform.d.ts +4 -0
- package/dist/tools/nanovdb/transform.js +3 -0
- package/dist/tools/nanovdb/transform.js.map +1 -1
- package/dist/tools/nanovdb/tree.d.ts +14 -3
- package/dist/tools/nanovdb/tree.js +25 -13
- package/dist/tools/nanovdb/tree.js.map +1 -1
- package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
- package/dist/tools/nanovdb/write-nvdb.js +108 -28
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
- package/dist/tools/nvdb-file.d.ts +77 -7
- package/dist/tools/nvdb-file.js +177 -20
- package/dist/tools/nvdb-file.js.map +1 -1
- package/dist/tools/nvdb-stream.d.ts +23 -7
- package/dist/tools/nvdb-stream.js +78 -34
- package/dist/tools/nvdb-stream.js.map +1 -1
- 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/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 +35 -5
- package/dist/tools/vdb/blosc.js +82 -26
- package/dist/tools/vdb/blosc.js.map +1 -1
- 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 +13 -3
- package/dist/tools/vdb/byte-reader.js +26 -4
- package/dist/tools/vdb/byte-reader.js.map +1 -1
- package/dist/tools/vdb/compression.d.ts +13 -5
- package/dist/tools/vdb/compression.js +13 -2
- package/dist/tools/vdb/compression.js.map +1 -1
- package/dist/tools/vdb/grid.js +8 -2
- package/dist/tools/vdb/grid.js.map +1 -1
- package/dist/tools/vdb/index.d.ts +2 -1
- package/dist/tools/vdb/index.js.map +1 -1
- 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.js +1 -1
- package/dist/tools/vdb/metadata.js.map +1 -1
- package/dist/tools/vdb/parse.d.ts +24 -2
- package/dist/tools/vdb/parse.js +102 -32
- package/dist/tools/vdb/parse.js.map +1 -1
- package/dist/tools/vdb/point-render-data.d.ts +49 -1
- package/dist/tools/vdb/point-render-data.js +91 -11
- package/dist/tools/vdb/point-render-data.js.map +1 -1
- package/dist/tools/vdb/points.d.ts +26 -0
- package/dist/tools/vdb/points.js +46 -5
- package/dist/tools/vdb/points.js.map +1 -1
- package/dist/tools/vdb/types.d.ts +59 -2
- package/dist/tools/vdb/types.js.map +1 -1
- package/dist/tools/wvdb/bake.d.ts +38 -9
- package/dist/tools/wvdb/bake.js +63 -13
- package/dist/tools/wvdb/bake.js.map +1 -1
- package/dist/tools/wvdb/dense.d.ts +80 -1
- package/dist/tools/wvdb/dense.js +67 -8
- package/dist/tools/wvdb/dense.js.map +1 -1
- package/dist/tools/wvdb/format.d.ts +59 -0
- package/dist/tools/wvdb/format.js +3 -0
- package/dist/tools/wvdb/format.js.map +1 -1
- package/dist/tools/wvdb/index.d.ts +1 -0
- package/dist/tools/wvdb/index.js +1 -0
- package/dist/tools/wvdb/index.js.map +1 -1
- package/dist/tools/wvdb/level-set.d.ts +10 -2
- package/dist/tools/wvdb/level-set.js.map +1 -1
- package/dist/tools/wvdb/nanovdb.d.ts +6 -1
- package/dist/tools/wvdb/nanovdb.js +5 -1
- package/dist/tools/wvdb/nanovdb.js.map +1 -1
- 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 +77 -1
- package/dist/tools/wvdb/read.js +30 -7
- package/dist/tools/wvdb/read.js.map +1 -1
- package/dist/tools/wvdb/write.d.ts +23 -1
- package/dist/tools/wvdb/write.js +8 -1
- package/dist/tools/wvdb/write.js.map +1 -1
- package/package.json +2 -1
- package/vendor/VENDOR.md +21 -6
- package/vendor/pnanovdb.wgsl +52 -14
- package/dist/three/frame/blackbody.d.ts +0 -42
- package/dist/three/frame/blackbody.js +0 -74
- package/dist/three/frame/blackbody.js.map +0 -1
- package/dist/three/frame/chunks.d.ts +0 -157
- package/dist/three/frame/chunks.js +0 -559
- package/dist/three/frame/chunks.js.map +0 -1
- package/dist/three/frame/density-material.d.ts +0 -53
- package/dist/three/frame/density-material.js +0 -353
- package/dist/three/frame/density-material.js.map +0 -1
- package/dist/three/frame/environment-grid-material.d.ts +0 -21
- package/dist/three/frame/environment-grid-material.js +0 -184
- package/dist/three/frame/environment-grid-material.js.map +0 -1
- package/dist/three/frame/environment-material.d.ts +0 -22
- package/dist/three/frame/environment-material.js +0 -87
- package/dist/three/frame/environment-material.js.map +0 -1
- package/dist/three/frame/grid-mip-material.d.ts +0 -12
- package/dist/three/frame/grid-mip-material.js +0 -61
- package/dist/three/frame/grid-mip-material.js.map +0 -1
- package/dist/three/frame/inject-material.d.ts +0 -56
- package/dist/three/frame/inject-material.js +0 -424
- package/dist/three/frame/inject-material.js.map +0 -1
- package/dist/three/frame/integrate-material.d.ts +0 -26
- package/dist/three/frame/integrate-material.js +0 -198
- package/dist/three/frame/integrate-material.js.map +0 -1
- package/dist/three/frame/layout.d.ts +0 -34
- package/dist/three/frame/layout.js +0 -48
- package/dist/three/frame/layout.js.map +0 -1
- package/dist/three/frame/lighting-material.d.ts +0 -41
- package/dist/three/frame/lighting-material.js +0 -257
- package/dist/three/frame/lighting-material.js.map +0 -1
- package/dist/three/frame/lights.d.ts +0 -11
- package/dist/three/frame/lights.js +0 -16
- package/dist/three/frame/lights.js.map +0 -1
- package/dist/three/frame/neural.d.ts +0 -14
- package/dist/three/frame/neural.js +0 -105
- package/dist/three/frame/neural.js.map +0 -1
- package/dist/three/frame/phase.d.ts +0 -44
- package/dist/three/frame/phase.js +0 -80
- package/dist/three/frame/phase.js.map +0 -1
- package/dist/three/frame/shadow-density-material.d.ts +0 -30
- package/dist/three/frame/shadow-density-material.js +0 -123
- package/dist/three/frame/shadow-density-material.js.map +0 -1
- package/dist/three/frame/temporal-material.d.ts +0 -29
- package/dist/three/frame/temporal-material.js +0 -152
- package/dist/three/frame/temporal-material.js.map +0 -1
- package/dist/three/frame/transmittance-material.d.ts +0 -31
- package/dist/three/frame/transmittance-material.js +0 -315
- package/dist/three/frame/transmittance-material.js.map +0 -1
- package/dist/three/frame/view.d.ts +0 -103
- package/dist/three/frame/view.js +0 -296
- package/dist/three/frame/view.js.map +0 -1
- package/dist/three/frame/volume-shadow-material.d.ts +0 -36
- package/dist/three/frame/volume-shadow-material.js +0 -128
- package/dist/three/frame/volume-shadow-material.js.map +0 -1
- package/dist/three/sequence.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute.js","sourceRoot":"","sources":["../../src/three/compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE5F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"compute.js","sourceRoot":"","sources":["../../src/three/compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE5F,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAA+C,MAAM,0BAA0B,CAAC;AACjI,OAAO,EAAE,SAAS,EAA6B,MAAM,aAAa,CAAC;AAWnE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,QAA8B,EAC9B,IAAiB,EACjB,MAAc,EACd,UAAoC,EAAE;IAEtC,IAAI,CAAC;QACH,OAAO,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAuBD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAA8B,EAC9B,IAAiB,EACjB,MAAc,EACd,UAAwC,EAAE;IAE1C,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,OAAkC,CAAC;IAClF,MAAM,KAAK,GAAG,MAAM,oBAAoB,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACzF,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,YAAY,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC;IACjC,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC;IACjC,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC;IAC5B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * three.js wrappers over the core compute tools (K2.3). v1's raw-WebGPU\n * kernels (`gridStats`, `valueTransform`, `decodeToAtlas` over a\n * `NanoVDBGrid` and the vendored WGSL text) moved into the engine-free core\n * (`core/compute/`) and now read grids from a `VDBGridPool`; these wrappers\n * take the renderer instead of a device (`getDevice(renderer)`), submit their\n * own encoder and return a promise.\n *\n * | v1 | core (`@pmndrs/vdb`) | this file (`@pmndrs/vdb/three`) |\n * |---|---|---|\n * | `vdbGridStatsGpu(device, grid, pnanovdbSource, opts)` | `vdbGridStats(device, pool, id, opts)` (core) → `VDBReadback` | `vdbGridStats(renderer, pool, id, opts)` → `Promise` |\n * | `vdbDecodeToAtlasGpu(device, grid, pnanovdbSource, opts)` | `vdbDecodeToAtlas(device, pool, id, opts)` (core) → `VDBAtlasReadback` | `vdbDecodeToAtlas(renderer, pool, id, opts)` → `Promise`, plus a ready `Data3DTexture` |\n * | `valueTransform(device, grid, pnanovdbSource, wgslBodyOrPreset)` | `vdbApplyValueTransform(pool, id, sourceImage, fnOrPreset)` (CPU + `pool.replace`) | — (use the core function) |\n *\n * The `vdb` prefix keeps these apart from the core functions of the same job\n * (D17). For recording into your own encoder (the D8 pattern), use the core\n * functions directly with `getDevice(renderer)`; then submit, and\n * `job.submitted().read()`.\n */\nimport { Data3DTexture, FloatType, LinearFilter, RedFormat, UnsignedByteType } from \"three\";\nimport type { VDBGridPool } from \"../core/pool/pool.js\";\nimport { vdbGridStats as vdbCoreGridStats, type VDBGridStats } from \"../core/compute/stats.js\";\nimport { vdbDecodeToAtlas as vdbCoreDecodeToAtlas, type VDBAtlas, type VDBDecodeToAtlasOptions } from \"../core/compute/atlas.js\";\nimport { getDevice, type VDBThreeRendererLike } from \"./device.js\";\n\n/** Options of {@link vdbGridStats}. */\nexport interface VDBThreeGridStatsOptions {\n /** Histogram bins over `[rootMin, rootMax]`. Default 256. */\n histogramBins?: number;\n}\n\n/** What {@link vdbGridStats} resolves with: the core's `VDBGridStats` (v1's result plus the histogram `range`). */\nexport type VDBGridStatsResult = VDBGridStats;\n\n/**\n * Statistics of grid `gridId`: active-voxel min/max/mean/count and a histogram\n * (see the core `gridStats`). The grid must be resident (`pool.flush()` or an\n * update submitted) and the pool must live on the renderer's device. Records\n * into its own encoder and submits it. Rejects (never throws) on bad input.\n *\n * @param renderer The initialized `WebGPURenderer` whose device the pool lives on.\n * @param pool The pool that holds the grid.\n * @param gridId The grid's pool id; it must be resident.\n * @param options Histogram bin count.\n */\nexport function vdbGridStats(\n renderer: VDBThreeRendererLike,\n pool: VDBGridPool,\n gridId: number,\n options: VDBThreeGridStatsOptions = {},\n): Promise<VDBGridStatsResult> {\n try {\n return vdbCoreGridStats(getDevice(renderer), pool, gridId, options.histogramBins === undefined ? {} : { histogramBins: options.histogramBins }).read();\n } catch (e) {\n return Promise.reject(e);\n }\n}\n\n/** Options of {@link vdbDecodeToAtlas}: the core's, without the encoder/readback plumbing. */\nexport type VDBThreeDecodeToAtlasOptions = Omit<VDBDecodeToAtlasOptions, \"encoder\" | \"readback\">;\n\n/** v1's result plus a `Data3DTexture` over `data`. */\nexport interface VDBDecodeToAtlasResult extends VDBAtlas {\n /**\n * `data` as a three `Data3DTexture`: `RedFormat`, `UnsignedByteType`\n * (`uint8`) or `FloatType` (`float32`), linear filtering, `unpackAlignment`\n * 1, `needsUpdate` set. Sample it with TSL `texture3D(texture, uvw).r`.\n * Linear filtering of a `float32` atlas needs the `float32-filterable`\n * feature; use `uint8` (the default) otherwise. Dispose it yourself.\n *\n * Texel `i` of an axis with `n` texels holds the grid at index\n * `min + (i + 0.5) * (max - min + 1) / n - 0.5`: voxel `min + i` at full\n * resolution (K2.6). The texture spans the voxel-centred box\n * `[min - 0.5, max + 0.5]` of the index bbox (world: that box times the\n * voxel size, through the grid transform).\n */\n texture: Data3DTexture;\n}\n\n/**\n * Dense decode of grid `gridId`'s index bbox (see the core `decodeToAtlas`,\n * including its voxel-centre sample convention), read back and wrapped in a\n * `Data3DTexture`. Records into its own encoder and submits it.\n *\n * @param renderer The initialized `WebGPURenderer` whose device the pool lives on.\n * @param pool The pool that holds the grid.\n * @param gridId The grid's pool id; it must be resident.\n * @param options Resolution cap, filter, format and normalization range.\n */\nexport async function vdbDecodeToAtlas(\n renderer: VDBThreeRendererLike,\n pool: VDBGridPool,\n gridId: number,\n options: VDBThreeDecodeToAtlasOptions = {},\n): Promise<VDBDecodeToAtlasResult> {\n const { encoder: _e, readback: _r, ...rest } = options as VDBDecodeToAtlasOptions;\n const atlas = await vdbCoreDecodeToAtlas(getDevice(renderer), pool, gridId, rest).read();\n const [dx, dy, dz] = atlas.dims;\n const texture = new Data3DTexture(atlas.data, dx, dy, dz);\n texture.format = RedFormat;\n texture.type = atlas.data instanceof Uint8Array ? UnsignedByteType : FloatType;\n texture.minFilter = LinearFilter;\n texture.magFilter = LinearFilter;\n texture.unpackAlignment = 1;\n texture.needsUpdate = true;\n return { ...atlas, texture };\n}\n"]}
|
package/dist/three/device.d.ts
CHANGED
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
/** The parts of three's WebGPU backend the adapter reads (structural, three r187). */
|
|
23
23
|
export interface VDBThreeBackendLike {
|
|
24
|
+
/** True on three's WebGPU backend (false on the WebGL fallback). */
|
|
24
25
|
readonly isWebGPUBackend?: boolean;
|
|
26
|
+
/** The backend's `GPUDevice`, set once the renderer is initialized. */
|
|
25
27
|
readonly device?: GPUDevice | null;
|
|
28
|
+
/** three's per-object backend record (texture or buffer data). */
|
|
26
29
|
get(object: object): {
|
|
27
30
|
texture?: GPUTexture;
|
|
28
31
|
buffer?: GPUBuffer;
|
|
@@ -35,6 +38,7 @@ export interface VDBThreeBackendLike {
|
|
|
35
38
|
* checked at runtime instead.
|
|
36
39
|
*/
|
|
37
40
|
export interface VDBThreeRendererLike {
|
|
41
|
+
/** The renderer's backend object (checked at runtime). */
|
|
38
42
|
readonly backend: object;
|
|
39
43
|
}
|
|
40
44
|
/** Throws unless `renderer` is an initialized `WebGPURenderer` on its WebGPU backend; returns that backend. */
|
|
@@ -53,6 +57,9 @@ export declare function getDevice(renderer: VDBThreeRendererLike): GPUDevice;
|
|
|
53
57
|
* `DepthTexture`, `StorageTexture`...). It must already be allocated: render to
|
|
54
58
|
* it once or call `renderer.initTexture(texture)`.
|
|
55
59
|
*
|
|
60
|
+
* @param renderer The initialized `WebGPURenderer` whose device the pool lives on.
|
|
61
|
+
* @param texture The three texture (or render-target attachment) to look up.
|
|
62
|
+
*
|
|
56
63
|
* @throws VDBError `VDB_UNSUPPORTED_DEVICE` for an uninitialized or non-WebGPU
|
|
57
64
|
* renderer; `VDB_BAD_OPTION` if the texture has no GPU allocation yet.
|
|
58
65
|
*/
|
package/dist/three/device.js
CHANGED
|
@@ -43,6 +43,9 @@ export function getDevice(renderer) {
|
|
|
43
43
|
* `DepthTexture`, `StorageTexture`...). It must already be allocated: render to
|
|
44
44
|
* it once or call `renderer.initTexture(texture)`.
|
|
45
45
|
*
|
|
46
|
+
* @param renderer The initialized `WebGPURenderer` whose device the pool lives on.
|
|
47
|
+
* @param texture The three texture (or render-target attachment) to look up.
|
|
48
|
+
*
|
|
46
49
|
* @throws VDBError `VDB_UNSUPPORTED_DEVICE` for an uninitialized or non-WebGPU
|
|
47
50
|
* renderer; `VDB_BAD_OPTION` if the texture has no GPU allocation yet.
|
|
48
51
|
*/
|
package/dist/three/device.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/three/device.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/three/device.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAuB7C,+GAA+G;AAC/G,MAAM,UAAU,eAAe,CAAC,QAAiB,EAAE,IAAI,GAAG,WAAW;IACnE,MAAM,OAAO,GAAI,QAAiE,EAAE,OAAO,CAAC;IAC5F,IAAI,OAAO,EAAE,eAAe,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QAC9F,MAAM,IAAI,QAAQ,CAChB,wBAAwB,EACxB,kBAAkB,IAAI,yFAAyF;YAC7G,8CAA8C,CACjD,CAAC;IACJ,CAAC;IACD,OAAO,OAA+D,CAAC;AACzE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAA8B;IACtD,OAAO,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;AACvD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,QAA8B,EAAE,OAAe;IAC3E,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,OAA2C,CAAC;QAC1D,MAAM,IAAI,QAAQ,CAChB,gBAAgB,EAChB,wCAAwC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,SAAS,SAAS;YACpF,gEAAgE,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/**\n * The raw WebGPU handles behind a three.js `WebGPURenderer` (task K2.1).\n *\n * Same helpers and semantics as `@pmndrs/upscaler` and `@pmndrs/denoiser`\n * (`getDevice`, `getGPUTexture`), so every pmndrs tool in a frame shares the\n * renderer's one `GPUDevice`: create the pool with\n * `VDBGridPool.create(getDevice(renderer))`.\n *\n * Typed structurally (`VDBThreeRendererLike`, the downsampler's pattern), so this\n * file needs nothing from three at runtime. It reads two backend internals,\n * checked against three r187 (the peer range):\n * - `renderer.backend.device`: the `GPUDevice` (null until `renderer.init()`\n * resolves; absent on the WebGL fallback backend);\n * - `renderer.backend.get(texture).texture`: the `GPUTexture` behind a three\n * texture once it is allocated.\n *\n * A renderer built without a `device` parameter owns its device and destroys\n * it in `renderer.dispose()`, and with it every buffer on it (the pool's\n * too). To keep a pool alive past the renderer, create the device yourself and\n * pass it: `new WebGPURenderer({ device })`.\n */\n\nimport { VDBError } from \"../core/errors.js\";\n\n/** The parts of three's WebGPU backend the adapter reads (structural, three r187). */\nexport interface VDBThreeBackendLike {\n /** True on three's WebGPU backend (false on the WebGL fallback). */\n readonly isWebGPUBackend?: boolean;\n /** The backend's `GPUDevice`, set once the renderer is initialized. */\n readonly device?: GPUDevice | null;\n /** three's per-object backend record (texture or buffer data). */\n get(object: object): { texture?: GPUTexture; buffer?: GPUBuffer } & Record<string, unknown>;\n}\n\n/**\n * The part of a three.js `WebGPURenderer` the adapter uses (structural, so\n * `three` stays an optional peer). `backend` is typed loosely because\n * `@types/three` does not declare the internals read here (`get`); they are\n * checked at runtime instead.\n */\nexport interface VDBThreeRendererLike {\n /** The renderer's backend object (checked at runtime). */\n readonly backend: object;\n}\n\n/** Throws unless `renderer` is an initialized `WebGPURenderer` on its WebGPU backend; returns that backend. */\nexport function webgpuBackendOf(renderer: unknown, what = \"getDevice\"): VDBThreeBackendLike & { readonly device: GPUDevice } {\n const backend = (renderer as { backend?: VDBThreeBackendLike } | null | undefined)?.backend;\n if (backend?.isWebGPUBackend !== true || !backend.device || typeof backend.get !== \"function\") {\n throw new VDBError(\n \"VDB_UNSUPPORTED_DEVICE\",\n `three adapter: ${what} requires an initialized WebGPURenderer (await renderer.init()) on its WebGPU backend; ` +\n \"the WebGL fallback backend has no GPUDevice.\",\n );\n }\n return backend as VDBThreeBackendLike & { readonly device: GPUDevice };\n}\n\n/**\n * The `GPUDevice` an initialized `WebGPURenderer` renders with. Create the\n * pool (and the other pmndrs tools) on it so they share one device.\n *\n * @throws VDBError `VDB_UNSUPPORTED_DEVICE` before `await renderer.init()`, or on the WebGL fallback backend.\n */\nexport function getDevice(renderer: VDBThreeRendererLike): GPUDevice {\n return webgpuBackendOf(renderer, \"getDevice\").device;\n}\n\n/**\n * The raw `GPUTexture` behind a three texture (render-target attachment,\n * `DepthTexture`, `StorageTexture`...). It must already be allocated: render to\n * it once or call `renderer.initTexture(texture)`.\n *\n * @param renderer The initialized `WebGPURenderer` whose device the pool lives on.\n * @param texture The three texture (or render-target attachment) to look up.\n *\n * @throws VDBError `VDB_UNSUPPORTED_DEVICE` for an uninitialized or non-WebGPU\n * renderer; `VDB_BAD_OPTION` if the texture has no GPU allocation yet.\n */\nexport function getGPUTexture(renderer: VDBThreeRendererLike, texture: object): GPUTexture {\n const backend = webgpuBackendOf(renderer, \"getGPUTexture\");\n const gpuTexture = backend.get(texture)?.texture;\n if (!gpuTexture) {\n const named = texture as { name?: string; uuid?: string };\n throw new VDBError(\n \"VDB_BAD_OPTION\",\n `three adapter: no GPUTexture behind \"${named.name || named.uuid || \"texture\"}\" yet. ` +\n \"Render to it once or call renderer.initTexture(texture) first.\",\n );\n }\n return gpuTexture;\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.2b: `scene.environment` as the core renderer's environment input (design §2.3, Q3). The core reads a host equirect
|
|
3
|
+
* or cube `GPUTexture` directly, so the adapter passes the scene environment's own texture (no readback, no PMREM):
|
|
4
|
+
*
|
|
5
|
+
* - an equirect texture (`EquirectangularReflectionMapping` / `RefractionMapping`): its GPUTexture; three uploads
|
|
6
|
+
* `flipY` images bottom row first, and three samples GPU row 0 at v = 0 (the nadir: `equirectUV`) for every equirect,
|
|
7
|
+
* `flipY` or not (a DataTexture's data row 0 is its v = 0): a reflection of y joins the rotation (K6.8: also for
|
|
8
|
+
* `flipY: false` textures, which K6.2b left unflipped, so a synthetic data sky lit the volume from below);
|
|
9
|
+
* - a cube texture: its GPUTexture as a 6-layer cube; three's WebGPU cube lookups negate x (`CubeTextureNode`), so a
|
|
10
|
+
* reflection of x joins the rotation;
|
|
11
|
+
* - anything else (a PMREM `CubeUVReflectionMapping` atlas, a render-target cube): drawn once into a 1024 × 512 float
|
|
12
|
+
* lat-long target through three's PMREM sampler at roughness 0 (the scene rotation applied there), and that target's
|
|
13
|
+
* GPUTexture is passed (redrawn only when the environment or its rotation changes).
|
|
14
|
+
*
|
|
15
|
+
* The rotation is `scene.environmentRotation` the way three applies it (`materialEnvRotation`: the transposed Euler
|
|
16
|
+
* matrix), so the core's lights and SH sit where three's PMREM lookups put them. Intensity: `scene.environmentIntensity`.
|
|
17
|
+
*/
|
|
18
|
+
import * as THREE from "three";
|
|
19
|
+
import type { VDBFrameEnvironment } from "../../core/frame/types.js";
|
|
20
|
+
type SceneLike = THREE.Object3D & {
|
|
21
|
+
environment?: THREE.Texture | null;
|
|
22
|
+
environmentIntensity?: number;
|
|
23
|
+
environmentRotation?: THREE.Euler;
|
|
24
|
+
};
|
|
25
|
+
type RendererLike = {
|
|
26
|
+
initTexture?(t: THREE.Texture): void;
|
|
27
|
+
setRenderTarget(t: THREE.RenderTarget | null): void;
|
|
28
|
+
getRenderTarget(): THREE.RenderTarget | null;
|
|
29
|
+
render(s: THREE.Object3D, c: THREE.Camera): void;
|
|
30
|
+
};
|
|
31
|
+
/** @internal The environment input of the `./three` core backend. */
|
|
32
|
+
export declare class VDBCoreEnvironment {
|
|
33
|
+
#private;
|
|
34
|
+
/** The core input for `scene` (null without an environment). */
|
|
35
|
+
input(renderer: RendererLike, scene: SceneLike): VDBFrameEnvironment | null;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.2b: `scene.environment` as the core renderer's environment input (design §2.3, Q3). The core reads a host equirect
|
|
3
|
+
* or cube `GPUTexture` directly, so the adapter passes the scene environment's own texture (no readback, no PMREM):
|
|
4
|
+
*
|
|
5
|
+
* - an equirect texture (`EquirectangularReflectionMapping` / `RefractionMapping`): its GPUTexture; three uploads
|
|
6
|
+
* `flipY` images bottom row first, and three samples GPU row 0 at v = 0 (the nadir: `equirectUV`) for every equirect,
|
|
7
|
+
* `flipY` or not (a DataTexture's data row 0 is its v = 0): a reflection of y joins the rotation (K6.8: also for
|
|
8
|
+
* `flipY: false` textures, which K6.2b left unflipped, so a synthetic data sky lit the volume from below);
|
|
9
|
+
* - a cube texture: its GPUTexture as a 6-layer cube; three's WebGPU cube lookups negate x (`CubeTextureNode`), so a
|
|
10
|
+
* reflection of x joins the rotation;
|
|
11
|
+
* - anything else (a PMREM `CubeUVReflectionMapping` atlas, a render-target cube): drawn once into a 1024 × 512 float
|
|
12
|
+
* lat-long target through three's PMREM sampler at roughness 0 (the scene rotation applied there), and that target's
|
|
13
|
+
* GPUTexture is passed (redrawn only when the environment or its rotation changes).
|
|
14
|
+
*
|
|
15
|
+
* The rotation is `scene.environmentRotation` the way three applies it (`materialEnvRotation`: the transposed Euler
|
|
16
|
+
* matrix), so the core's lights and SH sit where three's PMREM lookups put them. Intensity: `scene.environmentIntensity`.
|
|
17
|
+
*/
|
|
18
|
+
import * as THREE from "three";
|
|
19
|
+
import { NodeMaterial } from "three/webgpu";
|
|
20
|
+
import * as TSL from "three/tsl";
|
|
21
|
+
import { getGPUTexture } from "../device.js";
|
|
22
|
+
const { Fn, cos, float, pmremTexture, positionGeometry, screenCoordinate, sin, vec2, vec3, vec4 } = TSL;
|
|
23
|
+
/** The lat-long fallback's size: about one texel per PMREM mip-0 texel (0.35°), so a small sun is not lost between point samples. */
|
|
24
|
+
const LATLONG = [1024, 512];
|
|
25
|
+
/**
|
|
26
|
+
* A lat-long of the scene environment in the core's equirect convention (row 0 the zenith, u = atan2(z, x) / 2π + ½),
|
|
27
|
+
* through three's PMREM sampler at roughness 0 (his FrameEnvironmentMaterial: the PMREM node needs a texture, so a new
|
|
28
|
+
* or removed environment builds the shader again; no own envMap, so the PMREM rotation reads the pass scene's).
|
|
29
|
+
*/
|
|
30
|
+
class VDBCoreLatLongMaterial extends NodeMaterial {
|
|
31
|
+
environment = null;
|
|
32
|
+
environmentNodes = [];
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.envMap = null;
|
|
36
|
+
this.name = "VDBCoreLatLongMaterial";
|
|
37
|
+
this.vertexNode = vec4(positionGeometry.xy, 0.0, 1.0);
|
|
38
|
+
this.fragmentNode = this.createFragmentNode();
|
|
39
|
+
this.side = THREE.DoubleSide;
|
|
40
|
+
this.forceSinglePass = true;
|
|
41
|
+
this.depthTest = false;
|
|
42
|
+
this.depthWrite = false;
|
|
43
|
+
this.blending = THREE.NoBlending;
|
|
44
|
+
}
|
|
45
|
+
setEnvironment(environment) {
|
|
46
|
+
const next = environment ?? null;
|
|
47
|
+
if (!!next !== !!this.environment) {
|
|
48
|
+
this.environment = next;
|
|
49
|
+
this.environmentNodes = [];
|
|
50
|
+
this.fragmentNode = this.createFragmentNode();
|
|
51
|
+
this.needsUpdate = true;
|
|
52
|
+
}
|
|
53
|
+
else if (next && this.environment !== next) {
|
|
54
|
+
this.environment = next;
|
|
55
|
+
this.environmentNodes.forEach((node) => {
|
|
56
|
+
node.value = next;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// NOTE Radiance of the PMREM environment at the roughness. Rotation is from the pass scene, intensity is not applied.
|
|
61
|
+
environmentRadiance(direction, roughness) {
|
|
62
|
+
const node = pmremTexture(this.environment, direction, float(roughness));
|
|
63
|
+
this.environmentNodes.push(node);
|
|
64
|
+
return node;
|
|
65
|
+
}
|
|
66
|
+
createFragmentNode() {
|
|
67
|
+
return Fn(() => {
|
|
68
|
+
// WebGPU: screenCoordinate.y is the render target row (0 at the top)
|
|
69
|
+
const uv = vec2(screenCoordinate.x, screenCoordinate.y).div(vec2(LATLONG[0], LATLONG[1])).toVar();
|
|
70
|
+
const theta = uv.y.mul(Math.PI);
|
|
71
|
+
const phi = uv.x.sub(0.5).mul(2.0 * Math.PI);
|
|
72
|
+
const direction = vec3(sin(theta).mul(cos(phi)), cos(theta), sin(theta).mul(sin(phi)));
|
|
73
|
+
if (!this.environment)
|
|
74
|
+
return vec4(0.0, 0.0, 0.0, 1.0);
|
|
75
|
+
return vec4(this.environmentRadiance(direction, 0.0), float(1.0));
|
|
76
|
+
})();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** @internal The environment input of the `./three` core backend. */
|
|
80
|
+
export class VDBCoreEnvironment {
|
|
81
|
+
#material = null;
|
|
82
|
+
#scene = null;
|
|
83
|
+
#camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
84
|
+
#target = null;
|
|
85
|
+
#drawnKey = "";
|
|
86
|
+
#drawn = 0;
|
|
87
|
+
#initialized = new WeakMap();
|
|
88
|
+
#euler = new THREE.Matrix4();
|
|
89
|
+
/** The core input for `scene` (null without an environment). */
|
|
90
|
+
input(renderer, scene) {
|
|
91
|
+
const env = scene.environment;
|
|
92
|
+
if (!env)
|
|
93
|
+
return null;
|
|
94
|
+
const intensity = scene.environmentIntensity ?? 1;
|
|
95
|
+
const t = env;
|
|
96
|
+
const equirect = (t.mapping === THREE.EquirectangularReflectionMapping || t.mapping === THREE.EquirectangularRefractionMapping) && !t.isRenderTargetTexture;
|
|
97
|
+
const cube = !!t.isCubeTexture && !t.isRenderTargetTexture && (t.mapping === THREE.CubeReflectionMapping || t.mapping === THREE.CubeRefractionMapping);
|
|
98
|
+
// three's lookup direction m = Rᵀ d (materialEnvRotation is the transposed Euler matrix)
|
|
99
|
+
this.#euler.makeRotationFromEuler(scene.environmentRotation ?? new THREE.Euler());
|
|
100
|
+
const e = this.#euler.elements;
|
|
101
|
+
if (equirect || cube) {
|
|
102
|
+
if (this.#initialized.get(t) !== t.version) {
|
|
103
|
+
renderer.initTexture?.(t);
|
|
104
|
+
this.#initialized.set(t, t.version);
|
|
105
|
+
}
|
|
106
|
+
// world → map: F · Rᵀ (column-major; Rᵀ's column c is R's row c)
|
|
107
|
+
const flip = cube ? [-1, 1, 1] : [1, -1, 1];
|
|
108
|
+
const rotation = new Float32Array(9);
|
|
109
|
+
for (let c = 0; c < 3; c++)
|
|
110
|
+
for (let r = 0; r < 3; r++)
|
|
111
|
+
rotation[c * 3 + r] = flip[r] * e[r * 4 + c];
|
|
112
|
+
return { id: t, revision: t.version, texture: getGPUTexture(renderer, t), projection: cube ? "cube" : "equirect", rotation, intensity };
|
|
113
|
+
}
|
|
114
|
+
// A PMREM atlas or a render-target cube: the lat-long fallback (rotation applied by three's PMREM sampler)
|
|
115
|
+
const r = scene.environmentRotation;
|
|
116
|
+
const key = `${t.uuid}:${t.version}:${r ? `${r.x}:${r.y}:${r.z}:${r.order}` : ""}`;
|
|
117
|
+
const target = this.#latLong(renderer, scene, key);
|
|
118
|
+
return { id: this, revision: this.#drawn, texture: getGPUTexture(renderer, target.texture), projection: "equirect", intensity };
|
|
119
|
+
}
|
|
120
|
+
#latLong(renderer, scene, key) {
|
|
121
|
+
if (!this.#target) {
|
|
122
|
+
this.#target = new THREE.RenderTarget(LATLONG[0], LATLONG[1], { type: THREE.HalfFloatType, depthBuffer: false, magFilter: THREE.NearestFilter, minFilter: THREE.NearestFilter, generateMipmaps: false });
|
|
123
|
+
this.#material = new VDBCoreLatLongMaterial();
|
|
124
|
+
this.#scene = new THREE.Scene();
|
|
125
|
+
const mesh = new THREE.Mesh(new THREE.BufferGeometry().setAttribute("position", new THREE.Float32BufferAttribute([-1, -1, 0, 3, -1, 0, -1, 3, 0], 3)), this.#material);
|
|
126
|
+
mesh.frustumCulled = false;
|
|
127
|
+
this.#scene.add(mesh);
|
|
128
|
+
}
|
|
129
|
+
if (key !== this.#drawnKey) {
|
|
130
|
+
const s = this.#scene;
|
|
131
|
+
s.environment = scene.environment ?? null;
|
|
132
|
+
s.environmentIntensity = 1;
|
|
133
|
+
if (scene.environmentRotation)
|
|
134
|
+
s.environmentRotation.copy(scene.environmentRotation);
|
|
135
|
+
this.#material.setEnvironment(scene.environment);
|
|
136
|
+
const previous = renderer.getRenderTarget();
|
|
137
|
+
renderer.setRenderTarget(this.#target);
|
|
138
|
+
renderer.render(s, this.#camera);
|
|
139
|
+
renderer.setRenderTarget(previous);
|
|
140
|
+
this.#drawnKey = key;
|
|
141
|
+
this.#drawn++;
|
|
142
|
+
}
|
|
143
|
+
return this.#target;
|
|
144
|
+
}
|
|
145
|
+
dispose() {
|
|
146
|
+
this.#target?.dispose();
|
|
147
|
+
this.#material?.dispose();
|
|
148
|
+
this.#target = null;
|
|
149
|
+
this.#material = null;
|
|
150
|
+
this.#scene = null;
|
|
151
|
+
this.#drawnKey = "";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=core-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-environment.js","sourceRoot":"","sources":["../../../src/three/frame/core-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAA4C,CAAC;AAEjJ,qIAAqI;AACrI,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAU,CAAC;AAKrC;;;;GAIG;AACH,MAAM,sBAAuB,SAAQ,YAAY;IAC/C,WAAW,GAAyB,IAAI,CAAC;IACzC,gBAAgB,GAAiB,EAAE,CAAC;IAEpC;QACE,KAAK,EAAE,CAAC;QACP,IAAoD,CAAC,MAAM,GAAG,IAAI,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,KAA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,IAAI,KAAK,CAAC,mBAAmB;gBAAE,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACrF,IAAI,CAAC,SAAU,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAClD,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;YAC5C,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACjC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;YACrB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,CAAC,OAAQ,CAAC;IACvB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;CACF","sourcesContent":["/**\n * K6.2b: `scene.environment` as the core renderer's environment input (design §2.3, Q3). The core reads a host equirect\n * or cube `GPUTexture` directly, so the adapter passes the scene environment's own texture (no readback, no PMREM):\n *\n * - an equirect texture (`EquirectangularReflectionMapping` / `RefractionMapping`): its GPUTexture; three uploads\n * `flipY` images bottom row first, and three samples GPU row 0 at v = 0 (the nadir: `equirectUV`) for every equirect,\n * `flipY` or not (a DataTexture's data row 0 is its v = 0): a reflection of y joins the rotation (K6.8: also for\n * `flipY: false` textures, which K6.2b left unflipped, so a synthetic data sky lit the volume from below);\n * - a cube texture: its GPUTexture as a 6-layer cube; three's WebGPU cube lookups negate x (`CubeTextureNode`), so a\n * reflection of x joins the rotation;\n * - anything else (a PMREM `CubeUVReflectionMapping` atlas, a render-target cube): drawn once into a 1024 × 512 float\n * lat-long target through three's PMREM sampler at roughness 0 (the scene rotation applied there), and that target's\n * GPUTexture is passed (redrawn only when the environment or its rotation changes).\n *\n * The rotation is `scene.environmentRotation` the way three applies it (`materialEnvRotation`: the transposed Euler\n * matrix), so the core's lights and SH sit where three's PMREM lookups put them. Intensity: `scene.environmentIntensity`.\n */\n\nimport * as THREE from \"three\";\nimport { NodeMaterial } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport type { VDBFrameEnvironment } from \"../../core/frame/types.js\";\nimport { getGPUTexture } from \"../device.js\";\n\nconst { Fn, cos, float, pmremTexture, positionGeometry, screenCoordinate, sin, vec2, vec3, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\n/** The lat-long fallback's size: about one texel per PMREM mip-0 texel (0.35°), so a small sun is not lost between point samples. */\nconst LATLONG = [1024, 512] as const;\n\ntype SceneLike = THREE.Object3D & { environment?: THREE.Texture | null; environmentIntensity?: number; environmentRotation?: THREE.Euler };\ntype RendererLike = { initTexture?(t: THREE.Texture): void; setRenderTarget(t: THREE.RenderTarget | null): void; getRenderTarget(): THREE.RenderTarget | null; render(s: THREE.Object3D, c: THREE.Camera): void };\n\n/**\n * A lat-long of the scene environment in the core's equirect convention (row 0 the zenith, u = atan2(z, x) / 2π + ½),\n * through three's PMREM sampler at roughness 0 (his FrameEnvironmentMaterial: the PMREM node needs a texture, so a new\n * or removed environment builds the shader again; no own envMap, so the PMREM rotation reads the pass scene's).\n */\nclass VDBCoreLatLongMaterial extends NodeMaterial {\n environment: THREE.Texture | null = null;\n environmentNodes: VDBTslNode[] = [];\n\n constructor() {\n super();\n (this as unknown as { envMap: THREE.Texture | null }).envMap = null;\n this.name = \"VDBCoreLatLongMaterial\";\n this.vertexNode = vec4(positionGeometry.xy, 0.0, 1.0);\n this.fragmentNode = this.createFragmentNode();\n this.side = THREE.DoubleSide;\n this.forceSinglePass = true;\n this.depthTest = false;\n this.depthWrite = false;\n this.blending = THREE.NoBlending;\n }\n\n setEnvironment(environment: THREE.Texture | null | undefined): void {\n const next = environment ?? null;\n if (!!next !== !!this.environment) {\n this.environment = next;\n this.environmentNodes = [];\n this.fragmentNode = this.createFragmentNode();\n this.needsUpdate = true;\n } else if (next && this.environment !== next) {\n this.environment = next;\n this.environmentNodes.forEach((node) => {\n node.value = next;\n });\n }\n }\n\n // NOTE Radiance of the PMREM environment at the roughness. Rotation is from the pass scene, intensity is not applied.\n environmentRadiance(direction: VDBTslNode, roughness: number): VDBTslNode {\n const node = pmremTexture(this.environment, direction, float(roughness));\n this.environmentNodes.push(node);\n return node;\n }\n\n createFragmentNode(): VDBTslNode {\n return Fn(() => {\n // WebGPU: screenCoordinate.y is the render target row (0 at the top)\n const uv = vec2(screenCoordinate.x, screenCoordinate.y).div(vec2(LATLONG[0], LATLONG[1])).toVar();\n const theta = uv.y.mul(Math.PI);\n const phi = uv.x.sub(0.5).mul(2.0 * Math.PI);\n const direction = vec3(sin(theta).mul(cos(phi)), cos(theta), sin(theta).mul(sin(phi)));\n if (!this.environment) return vec4(0.0, 0.0, 0.0, 1.0);\n return vec4(this.environmentRadiance(direction, 0.0), float(1.0));\n })();\n }\n}\n\n/** @internal The environment input of the `./three` core backend. */\nexport class VDBCoreEnvironment {\n #material: VDBCoreLatLongMaterial | null = null;\n #scene: THREE.Scene | null = null;\n #camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n #target: THREE.RenderTarget | null = null;\n #drawnKey = \"\";\n #drawn = 0;\n #initialized = new WeakMap<THREE.Texture, number>();\n readonly #euler = new THREE.Matrix4();\n\n /** The core input for `scene` (null without an environment). */\n input(renderer: RendererLike, scene: SceneLike): VDBFrameEnvironment | null {\n const env = scene.environment;\n if (!env) return null;\n const intensity = scene.environmentIntensity ?? 1;\n const t = env as THREE.Texture & { isCubeTexture?: boolean; isRenderTargetTexture?: boolean; isDataTexture?: boolean };\n const equirect = (t.mapping === THREE.EquirectangularReflectionMapping || t.mapping === THREE.EquirectangularRefractionMapping) && !t.isRenderTargetTexture;\n const cube = !!t.isCubeTexture && !t.isRenderTargetTexture && (t.mapping === THREE.CubeReflectionMapping || t.mapping === THREE.CubeRefractionMapping);\n // three's lookup direction m = Rᵀ d (materialEnvRotation is the transposed Euler matrix)\n this.#euler.makeRotationFromEuler(scene.environmentRotation ?? new THREE.Euler());\n const e = this.#euler.elements;\n if (equirect || cube) {\n if (this.#initialized.get(t) !== t.version) {\n renderer.initTexture?.(t);\n this.#initialized.set(t, t.version);\n }\n // world → map: F · Rᵀ (column-major; Rᵀ's column c is R's row c)\n const flip = cube ? [-1, 1, 1] : [1, -1, 1];\n const rotation = new Float32Array(9);\n for (let c = 0; c < 3; c++) for (let r = 0; r < 3; r++) rotation[c * 3 + r] = flip[r]! * e[r * 4 + c]!;\n return { id: t, revision: t.version, texture: getGPUTexture(renderer as never, t), projection: cube ? \"cube\" : \"equirect\", rotation, intensity };\n }\n // A PMREM atlas or a render-target cube: the lat-long fallback (rotation applied by three's PMREM sampler)\n const r = scene.environmentRotation;\n const key = `${t.uuid}:${t.version}:${r ? `${r.x}:${r.y}:${r.z}:${r.order}` : \"\"}`;\n const target = this.#latLong(renderer, scene, key);\n return { id: this, revision: this.#drawn, texture: getGPUTexture(renderer as never, target.texture), projection: \"equirect\", intensity };\n }\n\n #latLong(renderer: RendererLike, scene: SceneLike, key: string): THREE.RenderTarget {\n if (!this.#target) {\n this.#target = new THREE.RenderTarget(LATLONG[0], LATLONG[1], { type: THREE.HalfFloatType, depthBuffer: false, magFilter: THREE.NearestFilter, minFilter: THREE.NearestFilter, generateMipmaps: false });\n this.#material = new VDBCoreLatLongMaterial();\n this.#scene = new THREE.Scene();\n const mesh = new THREE.Mesh(new THREE.BufferGeometry().setAttribute(\"position\", new THREE.Float32BufferAttribute([-1, -1, 0, 3, -1, 0, -1, 3, 0], 3)), this.#material as unknown as NodeMaterial);\n mesh.frustumCulled = false;\n this.#scene.add(mesh);\n }\n if (key !== this.#drawnKey) {\n const s = this.#scene!;\n s.environment = scene.environment ?? null;\n s.environmentIntensity = 1;\n if (scene.environmentRotation) s.environmentRotation.copy(scene.environmentRotation);\n this.#material!.setEnvironment(scene.environment);\n const previous = renderer.getRenderTarget();\n renderer.setRenderTarget(this.#target);\n renderer.render(s, this.#camera);\n renderer.setRenderTarget(previous);\n this.#drawnKey = key;\n this.#drawn++;\n }\n return this.#target!;\n }\n\n dispose(): void {\n this.#target?.dispose();\n this.#material?.dispose();\n this.#target = null;\n this.#material = null;\n this.#scene = null;\n this.#drawnKey = \"\";\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NodeMaterial } from "three/webgpu";
|
|
2
|
+
import type { VDBTslNode } from "../grid-node.js";
|
|
3
|
+
import type { VDBFroxelLayout } from "../../core/frame/types.js";
|
|
4
|
+
export declare class VDBFrameCoreIntegrateMaterial extends NodeMaterial {
|
|
5
|
+
#private;
|
|
6
|
+
/** The prefix texture node: its `value` is the stand-in of `outputs.froxels.integrated`. */
|
|
7
|
+
readonly prefix: VDBTslNode;
|
|
8
|
+
/** K6.4: the alpha prefix (`outputs.froxels.integratedAlpha`: red, blue opacity) of spectral media. */
|
|
9
|
+
readonly alphaPrefix: VDBTslNode;
|
|
10
|
+
readonly frameGrid: any;
|
|
11
|
+
readonly frameRange: any;
|
|
12
|
+
readonly frameScreenRect: any;
|
|
13
|
+
readonly frameCameraNear: any;
|
|
14
|
+
readonly frameCameraFar: any;
|
|
15
|
+
readonly frameCameraOrthographic: any;
|
|
16
|
+
srgbBlending: boolean | null;
|
|
17
|
+
srgbClamp: boolean | null;
|
|
18
|
+
/** K6.4: spectral media composite themselves over the scene colour (no hardware blending). */
|
|
19
|
+
spectral: boolean;
|
|
20
|
+
constructor();
|
|
21
|
+
/** The froxel layout of the core outputs (each update). */
|
|
22
|
+
setLayout(layout: VDBFroxelLayout, camera: {
|
|
23
|
+
near: number;
|
|
24
|
+
far: number;
|
|
25
|
+
isOrthographicCamera?: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
/** K6.4: the spectral composite (the alpha prefix, his NoBlending) or the grey one. */
|
|
28
|
+
setSpectral(spectral: boolean): void;
|
|
29
|
+
/** As `VDBFrameIntegrateMaterial.setSrgbBlending` (his rules). */
|
|
30
|
+
setSrgbBlending(srgbBlending: boolean, srgbClamp: boolean): void;
|
|
31
|
+
private createSceneDepth;
|
|
32
|
+
private createFragmentNode;
|
|
33
|
+
private createSpectralFragmentNode;
|
|
34
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/webgpu/FrameIntegrateMaterial.js L33–138 (the proxy quad over the froxel area,
|
|
3
|
+
// sRGB blending and its clamp rule, the scene depth with the empty-depth rule).
|
|
4
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
5
|
+
// Changes: the composite reads the core renderer's integrated prefix (two taps) through the core WGSL
|
|
6
|
+
// (`vdbFrameSliceCoord`, `vdbFrameIntegrateTaps`, `vdbFrameCompositeColor` by `wgslFn`). Divergences:
|
|
7
|
+
// DIVERGES.md (K6.1 rows).
|
|
8
|
+
/**
|
|
9
|
+
* The proxy material of `VDBFrameRenderer` with `backend: 'core'` (internal, K6.1 A/B): every volume proxy
|
|
10
|
+
* draws it; its fragment is the core composite (`vdbFrameIntegrate`'s maths) over three's
|
|
11
|
+
* `viewportDepthTexture` and `viewportTexture`, sampling the core prefix through a stand-in texture
|
|
12
|
+
* (`core-textures.ts`).
|
|
13
|
+
*/
|
|
14
|
+
import * as THREE from "three";
|
|
15
|
+
import { NodeMaterial } from "three/webgpu";
|
|
16
|
+
import * as TSL from "three/tsl";
|
|
17
|
+
import { VDB_FRAME_COMPOSITE_COLOR_FN_WGSL, VDB_FRAME_COMPOSITE_SPECTRAL_FN_WGSL, VDB_FRAME_INTEGRATE_TAPS_WGSL, VDB_FRAME_SLICE_COORD_WGSL, VDB_FRAME_SRGB_EOTF_WGSL, VDB_FRAME_SRGB_OETF_WGSL, } from "../../core/frame/wgsl/integrate.js";
|
|
18
|
+
const { Discard, Fn, If, clamp, float, mix, orthographicDepthToViewZ, perspectiveDepthToViewZ, positionGeometry, screenUV, select, texture3D, uint, uniform, vec2, vec3, vec4, viewportDepthTexture, viewportTexture, wgslFn } = TSL;
|
|
19
|
+
const sliceCoordFn = wgslFn(VDB_FRAME_SLICE_COORD_WGSL);
|
|
20
|
+
const tapsFn = wgslFn(VDB_FRAME_INTEGRATE_TAPS_WGSL);
|
|
21
|
+
const oetfFn = wgslFn(VDB_FRAME_SRGB_OETF_WGSL);
|
|
22
|
+
const eotfFn = wgslFn(VDB_FRAME_SRGB_EOTF_WGSL);
|
|
23
|
+
const compositeFn = wgslFn(VDB_FRAME_COMPOSITE_COLOR_FN_WGSL, [oetfFn, eotfFn]);
|
|
24
|
+
// K6.4: the spectral composite (over the scene colour, per channel)
|
|
25
|
+
const compositeSpectralFn = wgslFn(VDB_FRAME_COMPOSITE_SPECTRAL_FN_WGSL, [oetfFn, eotfFn]);
|
|
26
|
+
/** A 1³ zero placeholder until the first core update binds the prefix. */
|
|
27
|
+
function placeholder() {
|
|
28
|
+
const t = new THREE.Data3DTexture(new Uint16Array(4), 1, 1, 1);
|
|
29
|
+
t.type = THREE.HalfFloatType;
|
|
30
|
+
t.format = THREE.RGBAFormat;
|
|
31
|
+
t.minFilter = t.magFilter = THREE.LinearFilter;
|
|
32
|
+
t.needsUpdate = true;
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
export class VDBFrameCoreIntegrateMaterial extends NodeMaterial {
|
|
36
|
+
/** The prefix texture node: its `value` is the stand-in of `outputs.froxels.integrated`. */
|
|
37
|
+
prefix = texture3D(placeholder());
|
|
38
|
+
/** K6.4: the alpha prefix (`outputs.froxels.integratedAlpha`: red, blue opacity) of spectral media. */
|
|
39
|
+
alphaPrefix = texture3D(placeholder());
|
|
40
|
+
frameGrid = uniform(new THREE.Vector3(1, 1, 1));
|
|
41
|
+
frameRange = uniform(new THREE.Vector2(0.1, 1.0));
|
|
42
|
+
frameScreenRect = uniform(new THREE.Vector4(-1, -1, 1, 1));
|
|
43
|
+
frameCameraNear = uniform(0.1);
|
|
44
|
+
frameCameraFar = uniform(1000.0);
|
|
45
|
+
frameCameraOrthographic = uniform(0, "int");
|
|
46
|
+
srgbBlending = null;
|
|
47
|
+
srgbClamp = null;
|
|
48
|
+
/** K6.4: spectral media composite themselves over the scene colour (no hardware blending). */
|
|
49
|
+
spectral = false;
|
|
50
|
+
constructor() {
|
|
51
|
+
super();
|
|
52
|
+
this.name = "VDBFrameCoreIntegrateMaterial";
|
|
53
|
+
this.vertexNode = vec4(mix(this.frameScreenRect.xy, this.frameScreenRect.zw, positionGeometry.xy.mul(0.5).add(0.5)), 0.0, 1.0);
|
|
54
|
+
this.setSrgbBlending(true, true);
|
|
55
|
+
this.side = THREE.DoubleSide;
|
|
56
|
+
this.forceSinglePass = true;
|
|
57
|
+
this.transparent = true;
|
|
58
|
+
this.depthTest = false;
|
|
59
|
+
this.depthWrite = false;
|
|
60
|
+
}
|
|
61
|
+
/** The froxel layout of the core outputs (each update). */
|
|
62
|
+
setLayout(layout, camera) {
|
|
63
|
+
this.frameGrid.value.set(layout.width, layout.height, layout.depth);
|
|
64
|
+
this.frameRange.value.set(layout.range[0], layout.range[1]);
|
|
65
|
+
this.frameScreenRect.value.set(...layout.screenRect);
|
|
66
|
+
this.frameCameraNear.value = camera.near;
|
|
67
|
+
this.frameCameraFar.value = camera.far;
|
|
68
|
+
this.frameCameraOrthographic.value = camera.isOrthographicCamera ? 1 : 0;
|
|
69
|
+
}
|
|
70
|
+
/** K6.4: the spectral composite (the alpha prefix, his NoBlending) or the grey one. */
|
|
71
|
+
setSpectral(spectral) {
|
|
72
|
+
if (spectral === this.spectral)
|
|
73
|
+
return;
|
|
74
|
+
this.spectral = spectral;
|
|
75
|
+
this.#rebuild();
|
|
76
|
+
}
|
|
77
|
+
/** As `VDBFrameIntegrateMaterial.setSrgbBlending` (his rules). */
|
|
78
|
+
setSrgbBlending(srgbBlending, srgbClamp) {
|
|
79
|
+
if (srgbBlending === this.srgbBlending && srgbClamp === this.srgbClamp)
|
|
80
|
+
return;
|
|
81
|
+
this.srgbBlending = srgbBlending;
|
|
82
|
+
this.srgbClamp = srgbClamp;
|
|
83
|
+
this.#rebuild();
|
|
84
|
+
}
|
|
85
|
+
#rebuild() {
|
|
86
|
+
const srgbBlending = !!this.srgbBlending;
|
|
87
|
+
this.fragmentNode = this.createFragmentNode();
|
|
88
|
+
this.needsUpdate = true;
|
|
89
|
+
if (srgbBlending || this.spectral) {
|
|
90
|
+
this.blending = THREE.NoBlending;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.blending = THREE.CustomBlending;
|
|
94
|
+
this.blendEquation = THREE.AddEquation;
|
|
95
|
+
this.blendSrc = THREE.OneFactor;
|
|
96
|
+
this.blendDst = THREE.OneMinusSrcAlphaFactor;
|
|
97
|
+
this.blendSrcAlpha = THREE.OneFactor;
|
|
98
|
+
this.blendDstAlpha = THREE.OneMinusSrcAlphaFactor;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// NOTE Empty depth (no geometry) gives an infinite scene depth (as the TSL integrate pass)
|
|
102
|
+
createSceneDepth() {
|
|
103
|
+
return Fn((_, builder) => {
|
|
104
|
+
const depth = viewportDepthTexture().x;
|
|
105
|
+
const near = this.frameCameraNear;
|
|
106
|
+
const far = this.frameCameraFar;
|
|
107
|
+
const isEmpty = builder.renderer.reversedDepthBuffer ? depth.lessThanEqual(0.0) : depth.greaterThanEqual(1.0);
|
|
108
|
+
const viewZ = select(this.frameCameraOrthographic.equal(1), orthographicDepthToViewZ(depth, near, far), perspectiveDepthToViewZ(depth, near, far));
|
|
109
|
+
return select(isEmpty, float(1e20), viewZ.negate());
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
createFragmentNode() {
|
|
113
|
+
const srgb = !!this.srgbBlending;
|
|
114
|
+
const clampColors = !!this.srgbClamp;
|
|
115
|
+
const sceneDepth = this.createSceneDepth();
|
|
116
|
+
if (this.spectral)
|
|
117
|
+
return this.createSpectralFragmentNode(srgb, clampColors, sceneDepth);
|
|
118
|
+
return Fn(() => {
|
|
119
|
+
const grid = this.frameGrid;
|
|
120
|
+
const depth = sceneDepth().toVar();
|
|
121
|
+
const uv = vec2(screenUV.x, float(1.0).sub(screenUV.y));
|
|
122
|
+
const kc = sliceCoordFn({ viewDepth: depth, range: this.frameRange, depth: grid.z }).toVar();
|
|
123
|
+
const xy = clamp(uv.mul(grid.xy), vec2(0.5), grid.xy.sub(0.5)).div(grid.xy).toVar();
|
|
124
|
+
const layers = grid.z.add(1.0);
|
|
125
|
+
const a = this.prefix.sample(vec3(xy, kc.x.add(0.5).div(layers))).level(float(0.0));
|
|
126
|
+
const b = this.prefix.sample(vec3(xy, kc.x.add(1.5).div(layers))).level(float(0.0));
|
|
127
|
+
const r = tapsFn({ a, b, c: kc.y }).toVar();
|
|
128
|
+
If(r.w.greaterThanEqual(1.0), () => {
|
|
129
|
+
Discard();
|
|
130
|
+
});
|
|
131
|
+
const background = srgb ? viewportTexture() : vec4(0.0);
|
|
132
|
+
return compositeFn({ r, sceneColor: background, srgb: uint(srgb ? 1 : 0), clampColors: uint(clampColors ? 1 : 0) });
|
|
133
|
+
})();
|
|
134
|
+
}
|
|
135
|
+
// K6.4 (vdbFrameIntegrate spectral): the two-tap formula for each channel (red and blue opacity from the alpha prefix),
|
|
136
|
+
// then his spectral composite over the scene colour
|
|
137
|
+
createSpectralFragmentNode(srgb, clampColors, sceneDepth) {
|
|
138
|
+
return Fn(() => {
|
|
139
|
+
const grid = this.frameGrid;
|
|
140
|
+
const depth = sceneDepth().toVar();
|
|
141
|
+
const uv = vec2(screenUV.x, float(1.0).sub(screenUV.y));
|
|
142
|
+
const kc = sliceCoordFn({ viewDepth: depth, range: this.frameRange, depth: grid.z }).toVar();
|
|
143
|
+
const xy = clamp(uv.mul(grid.xy), vec2(0.5), grid.xy.sub(0.5)).div(grid.xy).toVar();
|
|
144
|
+
const layers = grid.z.add(1.0);
|
|
145
|
+
const za = vec3(xy, kc.x.add(0.5).div(layers));
|
|
146
|
+
const zb = vec3(xy, kc.x.add(1.5).div(layers));
|
|
147
|
+
const a = this.prefix.sample(za).level(float(0.0)).toVar();
|
|
148
|
+
const b = this.prefix.sample(zb).level(float(0.0)).toVar();
|
|
149
|
+
const aa = this.alphaPrefix.sample(za).level(float(0.0)).toVar();
|
|
150
|
+
const ba = this.alphaPrefix.sample(zb).level(float(0.0)).toVar();
|
|
151
|
+
const r = tapsFn({ a: vec4(a.x, 0.0, 0.0, aa.x), b: vec4(b.x, 0.0, 0.0, ba.x), c: kc.y }).toVar();
|
|
152
|
+
const g = tapsFn({ a: vec4(a.y, 0.0, 0.0, a.w), b: vec4(b.y, 0.0, 0.0, b.w), c: kc.y }).toVar();
|
|
153
|
+
const bl = tapsFn({ a: vec4(a.z, 0.0, 0.0, aa.y), b: vec4(b.z, 0.0, 0.0, ba.y), c: kc.y }).toVar();
|
|
154
|
+
const transmittance = vec3(r.w, g.w, bl.w).toVar();
|
|
155
|
+
If(transmittance.x.greaterThanEqual(1.0).and(transmittance.y.greaterThanEqual(1.0)).and(transmittance.z.greaterThanEqual(1.0)), () => {
|
|
156
|
+
Discard();
|
|
157
|
+
});
|
|
158
|
+
return compositeSpectralFn({ radiance: vec3(r.x, g.x, bl.x), transmittance, sceneColor: viewportTexture(), srgb: uint(srgb ? 1 : 0), clampColors: uint(clampColors ? 1 : 0) });
|
|
159
|
+
})();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=core-integrate-material.js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EAAE,UAAU,EAAE,eAAe,EAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/L,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/FrameIntegrateMaterial.js L33–138 (the proxy quad over the froxel area,\n// sRGB blending and its clamp rule, the scene depth with the empty-depth rule).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: the composite reads the core renderer's integrated prefix (two taps) through the core WGSL\n// (`vdbFrameSliceCoord`, `vdbFrameIntegrateTaps`, `vdbFrameCompositeColor` by `wgslFn`). Divergences:\n// DIVERGES.md (K6.1 rows).\n\n/**\n * The proxy material of `VDBFrameRenderer` with `backend: 'core'` (internal, K6.1 A/B): every volume proxy\n * draws it; its fragment is the core composite (`vdbFrameIntegrate`'s maths) over three's\n * `viewportDepthTexture` and `viewportTexture`, sampling the core prefix through a stand-in texture\n * (`core-textures.ts`).\n */\n\nimport * as THREE from \"three\";\nimport { NodeMaterial } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport {\n VDB_FRAME_COMPOSITE_COLOR_FN_WGSL,\n VDB_FRAME_COMPOSITE_SPECTRAL_FN_WGSL,\n VDB_FRAME_INTEGRATE_TAPS_WGSL,\n VDB_FRAME_SLICE_COORD_WGSL,\n VDB_FRAME_SRGB_EOTF_WGSL,\n VDB_FRAME_SRGB_OETF_WGSL,\n} from \"../../core/frame/wgsl/integrate.js\";\nimport type { VDBFroxelLayout } from \"../../core/frame/types.js\";\n\nconst { Discard, Fn, If, clamp, float, mix, orthographicDepthToViewZ, perspectiveDepthToViewZ, positionGeometry, screenUV, select, texture3D, uint, uniform, vec2, vec3, vec4, viewportDepthTexture, viewportTexture, wgslFn } = TSL as unknown as Record<string, VDBTslNode>;\n\nconst sliceCoordFn = wgslFn(VDB_FRAME_SLICE_COORD_WGSL);\nconst tapsFn = wgslFn(VDB_FRAME_INTEGRATE_TAPS_WGSL);\nconst oetfFn = wgslFn(VDB_FRAME_SRGB_OETF_WGSL);\nconst eotfFn = wgslFn(VDB_FRAME_SRGB_EOTF_WGSL);\nconst compositeFn = wgslFn(VDB_FRAME_COMPOSITE_COLOR_FN_WGSL, [oetfFn, eotfFn]);\n// K6.4: the spectral composite (over the scene colour, per channel)\nconst compositeSpectralFn = wgslFn(VDB_FRAME_COMPOSITE_SPECTRAL_FN_WGSL, [oetfFn, eotfFn]);\n\n/** A 1³ zero placeholder until the first core update binds the prefix. */\nfunction placeholder(): THREE.Data3DTexture {\n const t = new THREE.Data3DTexture(new Uint16Array(4), 1, 1, 1);\n t.type = THREE.HalfFloatType;\n t.format = THREE.RGBAFormat;\n t.minFilter = t.magFilter = THREE.LinearFilter;\n t.needsUpdate = true;\n return t;\n}\n\nexport class VDBFrameCoreIntegrateMaterial extends NodeMaterial {\n /** The prefix texture node: its `value` is the stand-in of `outputs.froxels.integrated`. */\n readonly prefix: VDBTslNode = texture3D(placeholder());\n /** K6.4: the alpha prefix (`outputs.froxels.integratedAlpha`: red, blue opacity) of spectral media. */\n readonly alphaPrefix: VDBTslNode = texture3D(placeholder());\n readonly frameGrid = uniform(new THREE.Vector3(1, 1, 1));\n readonly frameRange = uniform(new THREE.Vector2(0.1, 1.0));\n readonly frameScreenRect = uniform(new THREE.Vector4(-1, -1, 1, 1));\n readonly frameCameraNear = uniform(0.1);\n readonly frameCameraFar = uniform(1000.0);\n readonly frameCameraOrthographic = uniform(0, \"int\");\n srgbBlending: boolean | null = null;\n srgbClamp: boolean | null = null;\n /** K6.4: spectral media composite themselves over the scene colour (no hardware blending). */\n spectral = false;\n\n constructor() {\n super();\n this.name = \"VDBFrameCoreIntegrateMaterial\";\n this.vertexNode = vec4(mix(this.frameScreenRect.xy, this.frameScreenRect.zw, positionGeometry.xy.mul(0.5).add(0.5)), 0.0, 1.0);\n this.setSrgbBlending(true, true);\n this.side = THREE.DoubleSide;\n this.forceSinglePass = true;\n this.transparent = true;\n this.depthTest = false;\n this.depthWrite = false;\n }\n\n /** The froxel layout of the core outputs (each update). */\n setLayout(layout: VDBFroxelLayout, camera: { near: number; far: number; isOrthographicCamera?: boolean }): void {\n this.frameGrid.value.set(layout.width, layout.height, layout.depth);\n this.frameRange.value.set(layout.range[0], layout.range[1]);\n this.frameScreenRect.value.set(...layout.screenRect);\n this.frameCameraNear.value = camera.near;\n this.frameCameraFar.value = camera.far;\n this.frameCameraOrthographic.value = camera.isOrthographicCamera ? 1 : 0;\n }\n\n /** K6.4: the spectral composite (the alpha prefix, his NoBlending) or the grey one. */\n setSpectral(spectral: boolean): void {\n if (spectral === this.spectral) return;\n this.spectral = spectral;\n this.#rebuild();\n }\n\n /** As `VDBFrameIntegrateMaterial.setSrgbBlending` (his rules). */\n setSrgbBlending(srgbBlending: boolean, srgbClamp: boolean): void {\n if (srgbBlending === this.srgbBlending && srgbClamp === this.srgbClamp) return;\n this.srgbBlending = srgbBlending;\n this.srgbClamp = srgbClamp;\n this.#rebuild();\n }\n\n #rebuild(): void {\n const srgbBlending = !!this.srgbBlending;\n this.fragmentNode = this.createFragmentNode();\n this.needsUpdate = true;\n if (srgbBlending || this.spectral) {\n this.blending = THREE.NoBlending;\n } else {\n this.blending = THREE.CustomBlending;\n this.blendEquation = THREE.AddEquation;\n this.blendSrc = THREE.OneFactor;\n this.blendDst = THREE.OneMinusSrcAlphaFactor;\n this.blendSrcAlpha = THREE.OneFactor;\n this.blendDstAlpha = THREE.OneMinusSrcAlphaFactor;\n }\n }\n\n // NOTE Empty depth (no geometry) gives an infinite scene depth (as the TSL integrate pass)\n private createSceneDepth(): VDBTslNode {\n return Fn((_: unknown, builder: { renderer: { reversedDepthBuffer?: boolean } }) => {\n const depth: VDBTslNode = (viewportDepthTexture() as VDBTslNode).x;\n const near = this.frameCameraNear;\n const far = this.frameCameraFar;\n const isEmpty = builder.renderer.reversedDepthBuffer ? depth.lessThanEqual(0.0) : depth.greaterThanEqual(1.0);\n const viewZ = select(this.frameCameraOrthographic.equal(1), orthographicDepthToViewZ(depth, near, far), perspectiveDepthToViewZ(depth, near, far));\n return select(isEmpty, float(1e20), viewZ.negate());\n });\n }\n\n private createFragmentNode(): VDBTslNode {\n const srgb = !!this.srgbBlending;\n const clampColors = !!this.srgbClamp;\n const sceneDepth = this.createSceneDepth();\n if (this.spectral) return this.createSpectralFragmentNode(srgb, clampColors, sceneDepth);\n return Fn(() => {\n const grid = this.frameGrid;\n const depth = sceneDepth().toVar();\n const uv = vec2(screenUV.x, float(1.0).sub(screenUV.y));\n const kc = sliceCoordFn({ viewDepth: depth, range: this.frameRange, depth: grid.z }).toVar();\n const xy = clamp(uv.mul(grid.xy), vec2(0.5), grid.xy.sub(0.5)).div(grid.xy).toVar();\n const layers = grid.z.add(1.0);\n const a = this.prefix.sample(vec3(xy, kc.x.add(0.5).div(layers))).level(float(0.0));\n const b = this.prefix.sample(vec3(xy, kc.x.add(1.5).div(layers))).level(float(0.0));\n const r = tapsFn({ a, b, c: kc.y }).toVar();\n If(r.w.greaterThanEqual(1.0), () => {\n Discard();\n });\n const background: VDBTslNode = srgb ? (viewportTexture() as VDBTslNode) : vec4(0.0);\n return compositeFn({ r, sceneColor: background, srgb: uint(srgb ? 1 : 0), clampColors: uint(clampColors ? 1 : 0) });\n })();\n }\n\n // K6.4 (vdbFrameIntegrate spectral): the two-tap formula for each channel (red and blue opacity from the alpha prefix),\n // then his spectral composite over the scene colour\n private createSpectralFragmentNode(srgb: boolean, clampColors: boolean, sceneDepth: VDBTslNode): VDBTslNode {\n return Fn(() => {\n const grid = this.frameGrid;\n const depth = sceneDepth().toVar();\n const uv = vec2(screenUV.x, float(1.0).sub(screenUV.y));\n const kc = sliceCoordFn({ viewDepth: depth, range: this.frameRange, depth: grid.z }).toVar();\n const xy = clamp(uv.mul(grid.xy), vec2(0.5), grid.xy.sub(0.5)).div(grid.xy).toVar();\n const layers = grid.z.add(1.0);\n const za = vec3(xy, kc.x.add(0.5).div(layers));\n const zb = vec3(xy, kc.x.add(1.5).div(layers));\n const a = this.prefix.sample(za).level(float(0.0)).toVar();\n const b = this.prefix.sample(zb).level(float(0.0)).toVar();\n const aa = this.alphaPrefix.sample(za).level(float(0.0)).toVar();\n const ba = this.alphaPrefix.sample(zb).level(float(0.0)).toVar();\n const r = tapsFn({ a: vec4(a.x, 0.0, 0.0, aa.x), b: vec4(b.x, 0.0, 0.0, ba.x), c: kc.y }).toVar();\n const g = tapsFn({ a: vec4(a.y, 0.0, 0.0, a.w), b: vec4(b.y, 0.0, 0.0, b.w), c: kc.y }).toVar();\n const bl = tapsFn({ a: vec4(a.z, 0.0, 0.0, aa.y), b: vec4(b.z, 0.0, 0.0, ba.y), c: kc.y }).toVar();\n const transmittance = vec3(r.w, g.w, bl.w).toVar();\n If(transmittance.x.greaterThanEqual(1.0).and(transmittance.y.greaterThanEqual(1.0)).and(transmittance.z.greaterThanEqual(1.0)), () => {\n Discard();\n });\n return compositeSpectralFn({ radiance: vec3(r.x, g.x, bl.x), transmittance, sceneColor: viewportTexture() as VDBTslNode, srgb: uint(srgb ? 1 : 0), clampColors: uint(clampColors ? 1 : 0) });\n })();\n }\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.5b: three's light shadow maps as the core renderer's occluder maps (mesh → volume shadows, design §3.7). For each
|
|
3
|
+
* directional, spot and point light with `castShadow` (and `renderer.shadowMap.enabled`) whose map three has drawn, the
|
|
4
|
+
* adapter passes the map's depth `GPUTexture` (a `'2d-array'` view: one layer, or the point light's 6 cube faces), the
|
|
5
|
+
* view-projections it was drawn with, `shadow.bias`, the renderer's reversed depth and the filter (`BasicShadowMap`:
|
|
6
|
+
* one texel, else 2 × 2 PCF).
|
|
7
|
+
*
|
|
8
|
+
* **No lag.** three draws a light's map inside its own render, when the first lit material of the frame draws (the
|
|
9
|
+
* light's `ShadowNode.updateBefore`). Before the core update the adapter calls that `updateBefore` itself, with three's
|
|
10
|
+
* frame id, so three draws (and submits) the map first and skips it later in the same frame; the core then reads this
|
|
11
|
+
* frame's map with this frame's matrices. A map three does not redraw this frame (`autoUpdate` off) is read as it is,
|
|
12
|
+
* with the matrices it was drawn with (they stay on the shadow camera), so map and matrices always agree.
|
|
13
|
+
*
|
|
14
|
+
* three r187 internals used, checked by a self-test per backend and map kind (`VDB_ENGINE_MISMATCH` otherwise):
|
|
15
|
+
* 1. `light.shadow.map.depthTexture`'s GPU texture (`backend.get(t).texture`): a depth format with `TEXTURE_BINDING`,
|
|
16
|
+
* 1 layer (directional, spot) or 6 (point, `CubeDepthTexture`);
|
|
17
|
+
* 2. `light.shadow.matrix` is the WebGPU bias matrix × `shadow.camera` projection × view of the last draw
|
|
18
|
+
* (`LightShadow._updateMatrix`); a point light's is the translation to the light of the last draw
|
|
19
|
+
* (`PointShadowNode.renderShadow`), which leaves `shadow.camera` on face 5, and its faces follow three's WebGPU
|
|
20
|
+
* table (checked on face 5);
|
|
21
|
+
* 3. the shared `AnalyticLightNode` of a light (`three-internals.ts` internal 1) has the `ShadowNode` in
|
|
22
|
+
* `shadowNode`, whose `updateBefore(frame)` draws the map once per frame and camera (`_cameraFrameId`), reading
|
|
23
|
+
* `frame.renderer / scene / camera / frameId`.
|
|
24
|
+
* Not supported: logarithmic depth buffers (the maps store log depth; warned, skipped); `CSMShadowNode` (its cascades
|
|
25
|
+
* are lights of their own; not mapped); `shadow.normalBias` (a volume has no normal).
|
|
26
|
+
*/
|
|
27
|
+
import * as THREE from "three";
|
|
28
|
+
import type { VDBFrameOccluder } from "../../core/frame/types.js";
|
|
29
|
+
type RendererLike = THREE.EventDispatcher & {
|
|
30
|
+
readonly backend: object;
|
|
31
|
+
shadowMap: {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
type: THREE.ShadowMapType;
|
|
34
|
+
};
|
|
35
|
+
reversedDepthBuffer?: boolean;
|
|
36
|
+
logarithmicDepthBuffer?: boolean;
|
|
37
|
+
_nodes?: {
|
|
38
|
+
nodeFrame?: {
|
|
39
|
+
frameId?: number;
|
|
40
|
+
renderId?: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/** The occluder inputs of a render (one instance per `VDBFrameRenderer`). */
|
|
45
|
+
export declare class VDBCoreOccluders {
|
|
46
|
+
#private;
|
|
47
|
+
/**
|
|
48
|
+
* The occluder maps of `lights` (three lights in the camera's layers that the core lights; ids = `light.id`) for this
|
|
49
|
+
* render: draws three's pending maps first (no lag), then reads each map that exists.
|
|
50
|
+
*/
|
|
51
|
+
input(renderer: RendererLike, scene: THREE.Object3D, camera: THREE.Camera, lights: readonly THREE.Light[]): VDBFrameOccluder[];
|
|
52
|
+
}
|
|
53
|
+
export {};
|