@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,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K3.6: CPU twins of the emission light (his `FrameEmissionLight`): each emissive volume's light along 16
|
|
3
|
+
* Fibonacci directions × 8² parallel rays (direction pass), its mean intensity and luminance-weighted centre
|
|
4
|
+
* (reduce pass), the L1 irradiance probes of all volumes as point lights (probe pass), the probe cascades
|
|
5
|
+
* (power-of-two snapped) and the irradiance a lit surface reads.
|
|
6
|
+
*/
|
|
7
|
+
import type { Vec3, Vec4 } from "./index.js";
|
|
8
|
+
import { type VDBFrameAtlas, type VDBFrameGridLayout } from "./grid.js";
|
|
9
|
+
/** Directions of each volume's emitted light (his `frameEmissionDirections`). */
|
|
10
|
+
export declare const frameEmissionDirections = 16;
|
|
11
|
+
/** Rays on each side of the square that covers the volume (his `frameEmissionRays`). */
|
|
12
|
+
export declare const frameEmissionRays = 8;
|
|
13
|
+
/** Probes per axis, at most (the atlas is made for it; his `frameEmissionMaxResolution`). */
|
|
14
|
+
export declare const frameEmissionMaxResolution = 32;
|
|
15
|
+
export declare const frameEmissionMaxCascades = 4;
|
|
16
|
+
export declare const frameEmissionAtlasColumns: number;
|
|
17
|
+
export declare const frameEmissionAtlasSize: number;
|
|
18
|
+
/** Golden angle in radians: Fibonacci directions turn by it. */
|
|
19
|
+
export declare const frameEmissionGoldenAngle: number;
|
|
20
|
+
/** Linear-sRGB luminance (three's `luminance()` with the working colour space's coefficients). */
|
|
21
|
+
export declare const frameEmissionLuminance: Vec3;
|
|
22
|
+
/** Direction `index` (0–15) of the direction pass: a Fibonacci sphere point, from the volume to the viewer, with its tangent frame. */
|
|
23
|
+
export declare function vdbFrameEmissionDirection(index: number): {
|
|
24
|
+
direction: Vec3;
|
|
25
|
+
tangent: Vec3;
|
|
26
|
+
bitangent: Vec3;
|
|
27
|
+
};
|
|
28
|
+
/** His `boxSegment` of the local unit box ([−½, ½]³): the [t0, t1] ⊂ [0, 1] of the segment inside it. */
|
|
29
|
+
export declare function vdbFrameBoxSegment(start: Vec3, end: Vec3): [number, number];
|
|
30
|
+
/** One emitter as the direction pass reads it. Samplers take local positions (unit box) and a mip lod. */
|
|
31
|
+
export interface VDBFrameEmitter {
|
|
32
|
+
/** Extinction per world unit (the source's `sampleExtinction`). */
|
|
33
|
+
sampleExtinction(local: Vec3, lod: number): number;
|
|
34
|
+
/** Emitted radiance (the source's `sampleEmission`; the pass reads lod 0). */
|
|
35
|
+
sampleEmission(local: Vec3, lod: number): Vec3;
|
|
36
|
+
/** The source's `getLod` of a local size. */
|
|
37
|
+
getLod(localSize: number): number;
|
|
38
|
+
/** World → local unit box, column-major. */
|
|
39
|
+
worldToLocal: ArrayLike<number>;
|
|
40
|
+
center: Vec3;
|
|
41
|
+
radius: number;
|
|
42
|
+
/** World scale of the volume (`matrixWorld.getMaxScaleOnAxis()`). */
|
|
43
|
+
worldScale: number;
|
|
44
|
+
absorbance: number;
|
|
45
|
+
steps: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The emitter centre and bounding radius (FrameEmissionLight core L138–150): the translation of the volume's world
|
|
49
|
+
* matrix (unit box → world) and the largest distance of a box corner from it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function vdbFrameEmitterBounds(matrixWorld: ArrayLike<number>): {
|
|
52
|
+
center: Vec3;
|
|
53
|
+
radius: number;
|
|
54
|
+
min: Vec3;
|
|
55
|
+
max: Vec3;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* One texel of the direction pass (his FrameEmissionDirectionMaterial): the emitted light of the volume toward
|
|
59
|
+
* direction `index`, summed over 8² parallel rays that cover its bounding sphere. Each ray adds emission × α × the
|
|
60
|
+
* transmittance so far (absorbance scales the transmittance, as for scene lights) and stops below 1%. Returns output
|
|
61
|
+
* 0 (intensity × ray area, radius) and output 1 (luminance-weighted world position × ray area, weight × area).
|
|
62
|
+
*/
|
|
63
|
+
export declare function vdbFrameEmissionDirectionTexel(emitter: VDBFrameEmitter, index: number): {
|
|
64
|
+
intensity: Vec4;
|
|
65
|
+
center: Vec4;
|
|
66
|
+
};
|
|
67
|
+
/** The reduce pass: mean intensity of the 16 directions, and the centre of the visible emission ((0,0,0,0) when none). */
|
|
68
|
+
export declare function vdbFrameEmissionReduce(texels: readonly {
|
|
69
|
+
intensity: Vec4;
|
|
70
|
+
center: Vec4;
|
|
71
|
+
}[]): {
|
|
72
|
+
intensity: Vec4;
|
|
73
|
+
center: Vec4;
|
|
74
|
+
};
|
|
75
|
+
/** One emitter of the probe pass: the reduce outputs (intensity rgb + radius, centre + visible flag). */
|
|
76
|
+
export interface VDBFrameEmitterLight {
|
|
77
|
+
intensity: Vec4;
|
|
78
|
+
center: Vec4;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* One probe of the probe pass: the L1 irradiance of every emitter as a point light at its emission centre,
|
|
82
|
+
* E(n) = E/4 + E/2 · dot(l, n), softened near the centre by a quarter of the radius. Returns (red, green, blue),
|
|
83
|
+
* each (constant, direction xyz).
|
|
84
|
+
*/
|
|
85
|
+
export declare function vdbFrameEmissionProbe(probe: Vec3, emitters: readonly VDBFrameEmitterLight[]): [Vec4, Vec4, Vec4];
|
|
86
|
+
/** The light node's irradiance from (filtered) probe values: max(x + dot(yzw, n), 0) per channel, × falloff. */
|
|
87
|
+
export declare function vdbFrameEmissionIrradiance(probe: readonly [Vec4, Vec4, Vec4], normal: Vec3, falloff?: number): Vec3;
|
|
88
|
+
/** Settings of the probe cascades (his `FrameEmissionLight` props). */
|
|
89
|
+
export interface VDBFrameEmissionGridSettings {
|
|
90
|
+
resolution: number;
|
|
91
|
+
range: number;
|
|
92
|
+
cascades: number;
|
|
93
|
+
distance: number;
|
|
94
|
+
}
|
|
95
|
+
/** The probe cascades (cascade 0 finest), the centre of all emitters, and a key that changes with them. */
|
|
96
|
+
export interface VDBFrameEmissionGrid {
|
|
97
|
+
resolution: number;
|
|
98
|
+
count: number;
|
|
99
|
+
min: Vec3[];
|
|
100
|
+
size: Vec3[];
|
|
101
|
+
center: Vec3;
|
|
102
|
+
key: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* updateProbeGrid (FrameEmissionLight core L186–241): the last cascade is the box of all emitters grown by
|
|
106
|
+
* (range − 1)/2 of its longest side on each side; finer cascades are power-of-two-voxel cubes around the camera,
|
|
107
|
+
* each half the next, snapped to their voxel; a fine cascade that is not finer than the last or holds no emitter is
|
|
108
|
+
* skipped.
|
|
109
|
+
*/
|
|
110
|
+
export declare function vdbFrameEmissionProbeGrid(settings: VDBFrameEmissionGridSettings, emitterBoxes: readonly {
|
|
111
|
+
min: Vec3;
|
|
112
|
+
max: Vec3;
|
|
113
|
+
}[], cameraPosition: Vec3): VDBFrameEmissionGrid;
|
|
114
|
+
/**
|
|
115
|
+
* Past the last cascade (the light node, L490–506): the clamped edge probe's light falls off as the squared distance
|
|
116
|
+
* ratio |edge − centre|² / |p − centre|² (≤ 1).
|
|
117
|
+
*/
|
|
118
|
+
export declare function vdbFrameEmissionFalloff(edge: Vec3, position: Vec3, center: Vec3): number;
|
|
119
|
+
/**
|
|
120
|
+
* The light node's probe read (L457–507) on CPU atlases (the probe target's three attachments, rows bottom first):
|
|
121
|
+
* the finest cascade that holds the point (half a probe inside), blended into the next one over the last tenth of
|
|
122
|
+
* each side; outside every cascade, the last cascade's clamped edge with {@link vdbFrameEmissionFalloff}. Returns the
|
|
123
|
+
* (red, green, blue) L1 probe values and the falloff; {@link vdbFrameEmissionIrradiance} then gives E(n).
|
|
124
|
+
*/
|
|
125
|
+
export declare function vdbFrameEmissionLookup(atlases: readonly [VDBFrameAtlas, VDBFrameAtlas, VDBFrameAtlas], grid: VDBFrameGridLayout, center: Vec3, position: Vec3): {
|
|
126
|
+
probe: [Vec4, Vec4, Vec4];
|
|
127
|
+
falloff: number;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* {@link vdbFrameEmissionLookup} on any probe store: `sample(cascade, channel, uvw)` returns the filtered L1 probe of
|
|
131
|
+
* one colour channel (K6.5: the core's stacked 3D texture through `vdbFrameStackSample`; the CPU twin of
|
|
132
|
+
* `vdbEmissionIrradiance`).
|
|
133
|
+
*/
|
|
134
|
+
export declare function vdbFrameEmissionLookupWith(sampleProbe: (cascade: number, channel: number, uvw: Vec3) => ArrayLike<number>, grid: VDBFrameGridLayout, center: Vec3, position: Vec3): {
|
|
135
|
+
probe: [Vec4, Vec4, Vec4];
|
|
136
|
+
falloff: number;
|
|
137
|
+
};
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/core/FrameEmissionLight.js L3–15 (constants), L138–150 (emitter centre and radius),
|
|
3
|
+
// L182–241 (updateProbeGrid); src/three-openvdb/frame/webgpu/FrameEmissionLight.js L59–60 (golden angle),
|
|
4
|
+
// L168–237 (the direction pass), L259–279 (the reduce pass), L310–364 (the probe pass), L457–519 (the light
|
|
5
|
+
// node's irradiance).
|
|
6
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
7
|
+
// Changes: engine-free TypeScript CPU twins (f64) of his emission-light maths; boxes and matrices are plain
|
|
8
|
+
// arrays (column-major). Divergences: none (twins of the ported TSL).
|
|
9
|
+
import { vdbFrameFindCascade, vdbFrameGridUvw, vdbFrameSampleGrid } from "./grid.js";
|
|
10
|
+
/** Directions of each volume's emitted light (his `frameEmissionDirections`). */
|
|
11
|
+
export const frameEmissionDirections = 16;
|
|
12
|
+
/** Rays on each side of the square that covers the volume (his `frameEmissionRays`). */
|
|
13
|
+
export const frameEmissionRays = 8;
|
|
14
|
+
/** Probes per axis, at most (the atlas is made for it; his `frameEmissionMaxResolution`). */
|
|
15
|
+
export const frameEmissionMaxResolution = 32;
|
|
16
|
+
export const frameEmissionMaxCascades = 4;
|
|
17
|
+
export const frameEmissionAtlasColumns = Math.ceil(Math.sqrt(frameEmissionMaxResolution * frameEmissionMaxCascades));
|
|
18
|
+
export const frameEmissionAtlasSize = frameEmissionMaxResolution * frameEmissionAtlasColumns;
|
|
19
|
+
/** Golden angle in radians: Fibonacci directions turn by it. */
|
|
20
|
+
export const frameEmissionGoldenAngle = Math.PI * (3.0 - Math.sqrt(5.0));
|
|
21
|
+
/** Linear-sRGB luminance (three's `luminance()` with the working colour space's coefficients). */
|
|
22
|
+
export const frameEmissionLuminance = [0.2126, 0.7152, 0.0722];
|
|
23
|
+
const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
24
|
+
const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
25
|
+
const normalize = (a) => {
|
|
26
|
+
const l = Math.sqrt(dot(a, a));
|
|
27
|
+
return [a[0] / l, a[1] / l, a[2] / l];
|
|
28
|
+
};
|
|
29
|
+
const apply = (m, p) => [
|
|
30
|
+
m[0] * p[0] + m[4] * p[1] + m[8] * p[2] + m[12],
|
|
31
|
+
m[1] * p[0] + m[5] * p[1] + m[9] * p[2] + m[13],
|
|
32
|
+
m[2] * p[0] + m[6] * p[1] + m[10] * p[2] + m[14],
|
|
33
|
+
];
|
|
34
|
+
/** Direction `index` (0–15) of the direction pass: a Fibonacci sphere point, from the volume to the viewer, with its tangent frame. */
|
|
35
|
+
export function vdbFrameEmissionDirection(index) {
|
|
36
|
+
const y = 1 - (index * 2 + 1) / frameEmissionDirections;
|
|
37
|
+
const ring = Math.sqrt(Math.max(0, 1 - y * y));
|
|
38
|
+
const phi = index * frameEmissionGoldenAngle;
|
|
39
|
+
const direction = [Math.cos(phi) * ring, y, Math.sin(phi) * ring];
|
|
40
|
+
const helper = Math.abs(direction[1]) < 0.999 ? [0, 1, 0] : [1, 0, 0];
|
|
41
|
+
const tangent = normalize(cross(helper, direction));
|
|
42
|
+
return { direction, tangent, bitangent: cross(direction, tangent) };
|
|
43
|
+
}
|
|
44
|
+
/** His `boxSegment` of the local unit box ([−½, ½]³): the [t0, t1] ⊂ [0, 1] of the segment inside it. */
|
|
45
|
+
export function vdbFrameBoxSegment(start, end) {
|
|
46
|
+
let t0 = -Infinity;
|
|
47
|
+
let t1 = Infinity;
|
|
48
|
+
for (let c = 0; c < 3; c++) {
|
|
49
|
+
const inv = 1 / (end[c] - start[c]);
|
|
50
|
+
const a = (-0.5 - start[c]) * inv;
|
|
51
|
+
const b = (0.5 - start[c]) * inv;
|
|
52
|
+
t0 = Math.max(t0, Math.min(a, b));
|
|
53
|
+
t1 = Math.min(t1, Math.max(a, b));
|
|
54
|
+
}
|
|
55
|
+
return [Math.max(0, t0), Math.min(1, t1)];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The emitter centre and bounding radius (FrameEmissionLight core L138–150): the translation of the volume's world
|
|
59
|
+
* matrix (unit box → world) and the largest distance of a box corner from it.
|
|
60
|
+
*/
|
|
61
|
+
export function vdbFrameEmitterBounds(matrixWorld) {
|
|
62
|
+
const center = [matrixWorld[12], matrixWorld[13], matrixWorld[14]];
|
|
63
|
+
let radius = 0;
|
|
64
|
+
const min = [Infinity, Infinity, Infinity];
|
|
65
|
+
const max = [-Infinity, -Infinity, -Infinity];
|
|
66
|
+
for (let i = 0; i < 8; i++) {
|
|
67
|
+
const corner = apply(matrixWorld, [i & 1 ? 0.5 : -0.5, i & 2 ? 0.5 : -0.5, i & 4 ? 0.5 : -0.5]);
|
|
68
|
+
radius = Math.max(radius, Math.hypot(corner[0] - center[0], corner[1] - center[1], corner[2] - center[2]));
|
|
69
|
+
for (let c = 0; c < 3; c++) {
|
|
70
|
+
min[c] = Math.min(min[c], corner[c]);
|
|
71
|
+
max[c] = Math.max(max[c], corner[c]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { center, radius, min, max };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One texel of the direction pass (his FrameEmissionDirectionMaterial): the emitted light of the volume toward
|
|
78
|
+
* direction `index`, summed over 8² parallel rays that cover its bounding sphere. Each ray adds emission × α × the
|
|
79
|
+
* transmittance so far (absorbance scales the transmittance, as for scene lights) and stops below 1%. Returns output
|
|
80
|
+
* 0 (intensity × ray area, radius) and output 1 (luminance-weighted world position × ray area, weight × area).
|
|
81
|
+
*/
|
|
82
|
+
export function vdbFrameEmissionDirectionTexel(emitter, index) {
|
|
83
|
+
const { direction, tangent, bitangent } = vdbFrameEmissionDirection(index);
|
|
84
|
+
const { center: c, radius, steps } = emitter;
|
|
85
|
+
const diameter = radius * 2;
|
|
86
|
+
const spacing = diameter / frameEmissionRays;
|
|
87
|
+
const intensity = [0, 0, 0];
|
|
88
|
+
const center = [0, 0, 0, 0];
|
|
89
|
+
for (let r = 0; r < frameEmissionRays * frameEmissionRays; r++) {
|
|
90
|
+
const u = (((r % frameEmissionRays) + 0.5) / frameEmissionRays) * 2 - 1;
|
|
91
|
+
const v = ((Math.floor(r / frameEmissionRays) + 0.5) / frameEmissionRays) * 2 - 1;
|
|
92
|
+
const worldStart = [0, 1, 2].map((k) => c[k] + direction[k] * radius + tangent[k] * u * radius + bitangent[k] * v * radius);
|
|
93
|
+
const worldEnd = [0, 1, 2].map((k) => worldStart[k] - direction[k] * diameter);
|
|
94
|
+
const localStart = apply(emitter.worldToLocal, worldStart);
|
|
95
|
+
const localEnd = apply(emitter.worldToLocal, worldEnd);
|
|
96
|
+
const segment = vdbFrameBoxSegment(localStart, localEnd);
|
|
97
|
+
if (!(segment[0] < segment[1]))
|
|
98
|
+
continue;
|
|
99
|
+
const segmentLength = segment[1] - segment[0];
|
|
100
|
+
const stepLength = (segmentLength * diameter) / steps;
|
|
101
|
+
const lod = emitter.getLod(stepLength / emitter.worldScale);
|
|
102
|
+
let transmittance = 1;
|
|
103
|
+
for (let s = 0; s < steps; s++) {
|
|
104
|
+
const t = segment[0] + segmentLength * ((s + 0.5) / steps);
|
|
105
|
+
const local = [0, 1, 2].map((k) => localStart[k] + (localEnd[k] - localStart[k]) * t);
|
|
106
|
+
const extinction = emitter.sampleExtinction(local, lod);
|
|
107
|
+
if (extinction > 0) {
|
|
108
|
+
const alpha = 1 - Math.exp(-extinction * stepLength);
|
|
109
|
+
const e = emitter.sampleEmission(local, 0);
|
|
110
|
+
const radiance = [e[0] * transmittance * alpha, e[1] * transmittance * alpha, e[2] * transmittance * alpha];
|
|
111
|
+
const weight = dot(radiance, frameEmissionLuminance);
|
|
112
|
+
for (let k = 0; k < 3; k++) {
|
|
113
|
+
intensity[k] = intensity[k] + radiance[k];
|
|
114
|
+
center[k] = center[k] + (worldStart[k] + (worldEnd[k] - worldStart[k]) * t) * weight;
|
|
115
|
+
}
|
|
116
|
+
center[3] += weight;
|
|
117
|
+
transmittance *= Math.exp(-extinction * emitter.absorbance * stepLength);
|
|
118
|
+
if (transmittance < 0.01)
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const area = spacing * spacing;
|
|
124
|
+
return { intensity: [intensity[0] * area, intensity[1] * area, intensity[2] * area, radius], center: [center[0] * area, center[1] * area, center[2] * area, center[3] * area] };
|
|
125
|
+
}
|
|
126
|
+
/** The reduce pass: mean intensity of the 16 directions, and the centre of the visible emission ((0,0,0,0) when none). */
|
|
127
|
+
export function vdbFrameEmissionReduce(texels) {
|
|
128
|
+
const intensity = [0, 0, 0, 0];
|
|
129
|
+
const center = [0, 0, 0, 0];
|
|
130
|
+
for (const t of texels) {
|
|
131
|
+
for (let k = 0; k < 4; k++) {
|
|
132
|
+
intensity[k] = intensity[k] + t.intensity[k];
|
|
133
|
+
center[k] = center[k] + t.center[k];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
for (let k = 0; k < 4; k++)
|
|
137
|
+
intensity[k] = intensity[k] / frameEmissionDirections;
|
|
138
|
+
const visible = center[3] > 0;
|
|
139
|
+
const w = Math.max(center[3], 1e-12);
|
|
140
|
+
return { intensity, center: visible ? [center[0] / w, center[1] / w, center[2] / w, 1] : [0, 0, 0, 0] };
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One probe of the probe pass: the L1 irradiance of every emitter as a point light at its emission centre,
|
|
144
|
+
* E(n) = E/4 + E/2 · dot(l, n), softened near the centre by a quarter of the radius. Returns (red, green, blue),
|
|
145
|
+
* each (constant, direction xyz).
|
|
146
|
+
*/
|
|
147
|
+
export function vdbFrameEmissionProbe(probe, emitters) {
|
|
148
|
+
const constant = [0, 0, 0];
|
|
149
|
+
const dirs = [
|
|
150
|
+
[0, 0, 0],
|
|
151
|
+
[0, 0, 0],
|
|
152
|
+
[0, 0, 0],
|
|
153
|
+
];
|
|
154
|
+
for (const e of emitters) {
|
|
155
|
+
if (!(e.center[3] > 0))
|
|
156
|
+
continue;
|
|
157
|
+
const toProbe = [probe[0] - e.center[0], probe[1] - e.center[1], probe[2] - e.center[2]];
|
|
158
|
+
const d2 = dot(toProbe, toProbe);
|
|
159
|
+
const soft = e.intensity[3] * 0.25;
|
|
160
|
+
const sd2 = d2 + soft * soft;
|
|
161
|
+
const irradiance = [e.intensity[0] / sd2, e.intensity[1] / sd2, e.intensity[2] / sd2];
|
|
162
|
+
const scale = (1 / Math.sqrt(Math.max(d2, 1e-12))) * (d2 / sd2) * -0.5;
|
|
163
|
+
const toLight = [toProbe[0] * scale, toProbe[1] * scale, toProbe[2] * scale];
|
|
164
|
+
for (let k = 0; k < 3; k++) {
|
|
165
|
+
constant[k] = constant[k] + irradiance[k] * 0.25;
|
|
166
|
+
for (let a = 0; a < 3; a++)
|
|
167
|
+
dirs[k][a] = dirs[k][a] + toLight[a] * irradiance[k];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return [
|
|
171
|
+
[constant[0], ...dirs[0]],
|
|
172
|
+
[constant[1], ...dirs[1]],
|
|
173
|
+
[constant[2], ...dirs[2]],
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
/** The light node's irradiance from (filtered) probe values: max(x + dot(yzw, n), 0) per channel, × falloff. */
|
|
177
|
+
export function vdbFrameEmissionIrradiance(probe, normal, falloff = 1) {
|
|
178
|
+
return probe.map((p) => Math.max(0, p[0] + p[1] * normal[0] + p[2] * normal[1] + p[3] * normal[2]) * falloff);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* updateProbeGrid (FrameEmissionLight core L186–241): the last cascade is the box of all emitters grown by
|
|
182
|
+
* (range − 1)/2 of its longest side on each side; finer cascades are power-of-two-voxel cubes around the camera,
|
|
183
|
+
* each half the next, snapped to their voxel; a fine cascade that is not finer than the last or holds no emitter is
|
|
184
|
+
* skipped.
|
|
185
|
+
*/
|
|
186
|
+
export function vdbFrameEmissionProbeGrid(settings, emitterBoxes, cameraPosition) {
|
|
187
|
+
const resolution = Math.min(frameEmissionMaxResolution, Math.max(2, Math.round(settings.resolution)));
|
|
188
|
+
const cascades = Math.min(frameEmissionMaxCascades, Math.max(1, Math.round(settings.cascades)));
|
|
189
|
+
const gMin = [Infinity, Infinity, Infinity];
|
|
190
|
+
const gMax = [-Infinity, -Infinity, -Infinity];
|
|
191
|
+
for (const b of emitterBoxes) {
|
|
192
|
+
for (let k = 0; k < 3; k++) {
|
|
193
|
+
gMin[k] = Math.min(gMin[k], b.min[k]);
|
|
194
|
+
gMax[k] = Math.max(gMax[k], b.max[k]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const center = [(gMin[0] + gMax[0]) / 2, (gMin[1] + gMax[1]) / 2, (gMin[2] + gMax[2]) / 2];
|
|
198
|
+
let size = [gMax[0] - gMin[0], gMax[1] - gMin[1], gMax[2] - gMin[2]];
|
|
199
|
+
const grow = (Math.max(size[0], size[1], size[2]) * Math.max(0, settings.range - 1)) / 2;
|
|
200
|
+
for (let k = 0; k < 3; k++) {
|
|
201
|
+
gMin[k] = gMin[k] - grow;
|
|
202
|
+
gMax[k] = gMax[k] + grow;
|
|
203
|
+
}
|
|
204
|
+
size = [Math.max(gMax[0] - gMin[0], 1e-6), Math.max(gMax[1] - gMin[1], 1e-6), Math.max(gMax[2] - gMin[2], 1e-6)];
|
|
205
|
+
const lastSize = Math.max(size[0], size[1], size[2]);
|
|
206
|
+
const fineHalfSize = Math.min(settings.distance, lastSize / 2);
|
|
207
|
+
const min = [];
|
|
208
|
+
const sizes = [];
|
|
209
|
+
for (let cascade = 0; cascade < cascades - 1; cascade++) {
|
|
210
|
+
const halfSize = fineHalfSize / Math.pow(2, cascades - 1 - cascade);
|
|
211
|
+
const voxel = Math.pow(2, Math.ceil(Math.log2((halfSize * 2) / (resolution - 1))));
|
|
212
|
+
const s = voxel * resolution;
|
|
213
|
+
const bMin = [0, 1, 2].map((k) => Math.floor((cameraPosition[k] - halfSize) / voxel) * voxel);
|
|
214
|
+
const bMax = [bMin[0] + s, bMin[1] + s, bMin[2] + s];
|
|
215
|
+
const intersects = bMax[0] >= gMin[0] && bMin[0] <= gMax[0] && bMax[1] >= gMin[1] && bMin[1] <= gMax[1] && bMax[2] >= gMin[2] && bMin[2] <= gMax[2];
|
|
216
|
+
if (s >= lastSize || !intersects)
|
|
217
|
+
continue;
|
|
218
|
+
min.push(bMin);
|
|
219
|
+
sizes.push([s, s, s]);
|
|
220
|
+
}
|
|
221
|
+
min.push([gMin[0], gMin[1], gMin[2]]);
|
|
222
|
+
sizes.push(size);
|
|
223
|
+
const key = [resolution];
|
|
224
|
+
for (let i = 0; i < min.length; i++)
|
|
225
|
+
key.push(...min[i], ...sizes[i]);
|
|
226
|
+
return { resolution, count: min.length, min, size: sizes, center, key: key.join(",") };
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Past the last cascade (the light node, L490–506): the clamped edge probe's light falls off as the squared distance
|
|
230
|
+
* ratio |edge − centre|² / |p − centre|² (≤ 1).
|
|
231
|
+
*/
|
|
232
|
+
export function vdbFrameEmissionFalloff(edge, position, center) {
|
|
233
|
+
const a = [edge[0] - center[0], edge[1] - center[1], edge[2] - center[2]];
|
|
234
|
+
const b = [position[0] - center[0], position[1] - center[1], position[2] - center[2]];
|
|
235
|
+
return Math.min(1, dot(a, a) / Math.max(dot(b, b), 1e-6));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The light node's probe read (L457–507) on CPU atlases (the probe target's three attachments, rows bottom first):
|
|
239
|
+
* the finest cascade that holds the point (half a probe inside), blended into the next one over the last tenth of
|
|
240
|
+
* each side; outside every cascade, the last cascade's clamped edge with {@link vdbFrameEmissionFalloff}. Returns the
|
|
241
|
+
* (red, green, blue) L1 probe values and the falloff; {@link vdbFrameEmissionIrradiance} then gives E(n).
|
|
242
|
+
*/
|
|
243
|
+
export function vdbFrameEmissionLookup(atlases, grid, center, position) {
|
|
244
|
+
return vdbFrameEmissionLookupWith((cascade, channel, uvw) => vdbFrameSampleGrid(atlases[channel], grid, cascade, uvw), grid, center, position);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* {@link vdbFrameEmissionLookup} on any probe store: `sample(cascade, channel, uvw)` returns the filtered L1 probe of
|
|
248
|
+
* one colour channel (K6.5: the core's stacked 3D texture through `vdbFrameStackSample`; the CPU twin of
|
|
249
|
+
* `vdbEmissionIrradiance`).
|
|
250
|
+
*/
|
|
251
|
+
export function vdbFrameEmissionLookupWith(sampleProbe, grid, center, position) {
|
|
252
|
+
let probe = [
|
|
253
|
+
[0, 0, 0, 0],
|
|
254
|
+
[0, 0, 0, 0],
|
|
255
|
+
[0, 0, 0, 0],
|
|
256
|
+
];
|
|
257
|
+
let falloff = 1;
|
|
258
|
+
const sample = (cascade, uvw, weight) => {
|
|
259
|
+
probe = probe.map((p, k) => {
|
|
260
|
+
const s = sampleProbe(cascade, k, uvw);
|
|
261
|
+
return p.map((v, c) => v + (s[c] - v) * weight);
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
if (grid.count > 0) {
|
|
265
|
+
const cascade = vdbFrameFindCascade(grid, position, 0);
|
|
266
|
+
if (cascade >= 0) {
|
|
267
|
+
const uvw = vdbFrameGridUvw(grid, cascade, position);
|
|
268
|
+
sample(cascade, uvw, 1);
|
|
269
|
+
const side = Math.min(uvw[0], uvw[1], uvw[2], 1 - uvw[0], 1 - uvw[1], 1 - uvw[2]);
|
|
270
|
+
const t = Math.min(1, Math.max(0, side / 0.1));
|
|
271
|
+
const blend = 1 - t * t * (3 - 2 * t);
|
|
272
|
+
if (blend > 0) {
|
|
273
|
+
const next = vdbFrameFindCascade(grid, position, cascade + 1);
|
|
274
|
+
if (next >= 0)
|
|
275
|
+
sample(next, vdbFrameGridUvw(grid, next, position), blend);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
const last = grid.count - 1;
|
|
280
|
+
const inset = 0.5 / grid.resolution;
|
|
281
|
+
const uvw = vdbFrameGridUvw(grid, last, position).map((v) => Math.min(1 - inset, Math.max(inset, v)));
|
|
282
|
+
const m = grid.gridMin[last];
|
|
283
|
+
const s = grid.gridSize[last];
|
|
284
|
+
sample(last, uvw, 1);
|
|
285
|
+
falloff = vdbFrameEmissionFalloff([m[0] + uvw[0] * s[0], m[1] + uvw[1] * s[1], m[2] + uvw[2] * s[2]], position, center);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return { probe, falloff };
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=emission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emission.js","sourceRoot":"","sources":["../../../src/tools/frame/emission.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,gHAAgH;AAChH,4GAA4G;AAC5G,8GAA8G;AAC9G,wBAAwB;AACxB,4GAA4G;AAC5G,4GAA4G;AAC5G,sEAAsE;AAUtE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAA+C,MAAM,WAAW,CAAC;AAElI,iFAAiF;AACjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,wFAAwF;AACxF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AACnC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,GAAG,wBAA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–15 (constants), L138–150 (emitter centre and radius),\n// L182–241 (updateProbeGrid); src/three-openvdb/frame/webgpu/FrameEmissionLight.js L59–60 (golden angle),\n// L168–237 (the direction pass), L259–279 (the reduce pass), L310–364 (the probe pass), L457–519 (the light\n// node's irradiance).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: engine-free TypeScript CPU twins (f64) of his emission-light maths; boxes and matrices are plain\n// arrays (column-major). Divergences: none (twins of the ported TSL).\n\n/**\n * K3.6: CPU twins of the emission light (his `FrameEmissionLight`): each emissive volume's light along 16\n * Fibonacci directions × 8² parallel rays (direction pass), its mean intensity and luminance-weighted centre\n * (reduce pass), the L1 irradiance probes of all volumes as point lights (probe pass), the probe cascades\n * (power-of-two snapped) and the irradiance a lit surface reads.\n */\n\nimport type { Vec3, Vec4 } from \"./index.js\";\nimport { vdbFrameFindCascade, vdbFrameGridUvw, vdbFrameSampleGrid, type VDBFrameAtlas, type VDBFrameGridLayout } from \"./grid.js\";\n\n/** Directions of each volume's emitted light (his `frameEmissionDirections`). */\nexport const frameEmissionDirections = 16;\n/** Rays on each side of the square that covers the volume (his `frameEmissionRays`). */\nexport const frameEmissionRays = 8;\n/** Probes per axis, at most (the atlas is made for it; his `frameEmissionMaxResolution`). */\nexport const frameEmissionMaxResolution = 32;\nexport const frameEmissionMaxCascades = 4;\nexport const frameEmissionAtlasColumns = Math.ceil(Math.sqrt(frameEmissionMaxResolution * frameEmissionMaxCascades));\nexport const frameEmissionAtlasSize = frameEmissionMaxResolution * frameEmissionAtlasColumns;\n/** Golden angle in radians: Fibonacci directions turn by it. */\nexport const frameEmissionGoldenAngle = Math.PI * (3.0 - Math.sqrt(5.0));\n/** Linear-sRGB luminance (three's `luminance()` with the working colour space's coefficients). */\nexport const frameEmissionLuminance: Vec3 = [0.2126, 0.7152, 0.0722];\n\nconst cross = (a: Vec3, b: Vec3): Vec3 => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\nconst dot = (a: Vec3, b: Vec3): number => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\nconst normalize = (a: Vec3): Vec3 => {\n const l = Math.sqrt(dot(a, a));\n return [a[0] / l, a[1] / l, a[2] / l];\n};\nconst apply = (m: ArrayLike<number>, p: Vec3): Vec3 => [\n m[0]! * p[0] + m[4]! * p[1] + m[8]! * p[2] + m[12]!,\n m[1]! * p[0] + m[5]! * p[1] + m[9]! * p[2] + m[13]!,\n m[2]! * p[0] + m[6]! * p[1] + m[10]! * p[2] + m[14]!,\n];\n\n/** Direction `index` (0–15) of the direction pass: a Fibonacci sphere point, from the volume to the viewer, with its tangent frame. */\nexport function vdbFrameEmissionDirection(index: number): { direction: Vec3; tangent: Vec3; bitangent: Vec3 } {\n const y = 1 - (index * 2 + 1) / frameEmissionDirections;\n const ring = Math.sqrt(Math.max(0, 1 - y * y));\n const phi = index * frameEmissionGoldenAngle;\n const direction: Vec3 = [Math.cos(phi) * ring, y, Math.sin(phi) * ring];\n const helper: Vec3 = Math.abs(direction[1]) < 0.999 ? [0, 1, 0] : [1, 0, 0];\n const tangent = normalize(cross(helper, direction));\n return { direction, tangent, bitangent: cross(direction, tangent) };\n}\n\n/** His `boxSegment` of the local unit box ([−½, ½]³): the [t0, t1] ⊂ [0, 1] of the segment inside it. */\nexport function vdbFrameBoxSegment(start: Vec3, end: Vec3): [number, number] {\n let t0 = -Infinity;\n let t1 = Infinity;\n for (let c = 0; c < 3; c++) {\n const inv = 1 / (end[c]! - start[c]!);\n const a = (-0.5 - start[c]!) * inv;\n const b = (0.5 - start[c]!) * inv;\n t0 = Math.max(t0, Math.min(a, b));\n t1 = Math.min(t1, Math.max(a, b));\n }\n return [Math.max(0, t0), Math.min(1, t1)];\n}\n\n/** One emitter as the direction pass reads it. Samplers take local positions (unit box) and a mip lod. */\nexport interface VDBFrameEmitter {\n /** Extinction per world unit (the source's `sampleExtinction`). */\n sampleExtinction(local: Vec3, lod: number): number;\n /** Emitted radiance (the source's `sampleEmission`; the pass reads lod 0). */\n sampleEmission(local: Vec3, lod: number): Vec3;\n /** The source's `getLod` of a local size. */\n getLod(localSize: number): number;\n /** World → local unit box, column-major. */\n worldToLocal: ArrayLike<number>;\n center: Vec3;\n radius: number;\n /** World scale of the volume (`matrixWorld.getMaxScaleOnAxis()`). */\n worldScale: number;\n absorbance: number;\n steps: number;\n}\n\n/**\n * The emitter centre and bounding radius (FrameEmissionLight core L138–150): the translation of the volume's world\n * matrix (unit box → world) and the largest distance of a box corner from it.\n */\nexport function vdbFrameEmitterBounds(matrixWorld: ArrayLike<number>): { center: Vec3; radius: number; min: Vec3; max: Vec3 } {\n const center: Vec3 = [matrixWorld[12]!, matrixWorld[13]!, matrixWorld[14]!];\n let radius = 0;\n const min: Vec3 = [Infinity, Infinity, Infinity];\n const max: Vec3 = [-Infinity, -Infinity, -Infinity];\n for (let i = 0; i < 8; i++) {\n const corner = apply(matrixWorld, [i & 1 ? 0.5 : -0.5, i & 2 ? 0.5 : -0.5, i & 4 ? 0.5 : -0.5]);\n radius = Math.max(radius, Math.hypot(corner[0] - center[0], corner[1] - center[1], corner[2] - center[2]));\n for (let c = 0; c < 3; c++) {\n min[c] = Math.min(min[c]!, corner[c]!);\n max[c] = Math.max(max[c]!, corner[c]!);\n }\n }\n return { center, radius, min, max };\n}\n\n/**\n * One texel of the direction pass (his FrameEmissionDirectionMaterial): the emitted light of the volume toward\n * direction `index`, summed over 8² parallel rays that cover its bounding sphere. Each ray adds emission × α × the\n * transmittance so far (absorbance scales the transmittance, as for scene lights) and stops below 1%. Returns output\n * 0 (intensity × ray area, radius) and output 1 (luminance-weighted world position × ray area, weight × area).\n */\nexport function vdbFrameEmissionDirectionTexel(emitter: VDBFrameEmitter, index: number): { intensity: Vec4; center: Vec4 } {\n const { direction, tangent, bitangent } = vdbFrameEmissionDirection(index);\n const { center: c, radius, steps } = emitter;\n const diameter = radius * 2;\n const spacing = diameter / frameEmissionRays;\n const intensity: Vec3 = [0, 0, 0];\n const center: Vec4 = [0, 0, 0, 0];\n for (let r = 0; r < frameEmissionRays * frameEmissionRays; r++) {\n const u = (((r % frameEmissionRays) + 0.5) / frameEmissionRays) * 2 - 1;\n const v = ((Math.floor(r / frameEmissionRays) + 0.5) / frameEmissionRays) * 2 - 1;\n const worldStart: Vec3 = [0, 1, 2].map((k) => c[k]! + direction[k]! * radius + tangent[k]! * u * radius + bitangent[k]! * v * radius) as Vec3;\n const worldEnd: Vec3 = [0, 1, 2].map((k) => worldStart[k]! - direction[k]! * diameter) as Vec3;\n const localStart = apply(emitter.worldToLocal, worldStart);\n const localEnd = apply(emitter.worldToLocal, worldEnd);\n const segment = vdbFrameBoxSegment(localStart, localEnd);\n if (!(segment[0] < segment[1])) continue;\n const segmentLength = segment[1] - segment[0];\n const stepLength = (segmentLength * diameter) / steps;\n const lod = emitter.getLod(stepLength / emitter.worldScale);\n let transmittance = 1;\n for (let s = 0; s < steps; s++) {\n const t = segment[0] + segmentLength * ((s + 0.5) / steps);\n const local: Vec3 = [0, 1, 2].map((k) => localStart[k]! + (localEnd[k]! - localStart[k]!) * t) as Vec3;\n const extinction = emitter.sampleExtinction(local, lod);\n if (extinction > 0) {\n const alpha = 1 - Math.exp(-extinction * stepLength);\n const e = emitter.sampleEmission(local, 0);\n const radiance: Vec3 = [e[0] * transmittance * alpha, e[1] * transmittance * alpha, e[2] * transmittance * alpha];\n const weight = dot(radiance, frameEmissionLuminance);\n for (let k = 0; k < 3; k++) {\n intensity[k] = intensity[k]! + radiance[k]!;\n center[k] = center[k]! + (worldStart[k]! + (worldEnd[k]! - worldStart[k]!) * t) * weight;\n }\n center[3] += weight;\n transmittance *= Math.exp(-extinction * emitter.absorbance * stepLength);\n if (transmittance < 0.01) break;\n }\n }\n }\n const area = spacing * spacing;\n return { intensity: [intensity[0] * area, intensity[1] * area, intensity[2] * area, radius], center: [center[0] * area, center[1] * area, center[2] * area, center[3] * area] };\n}\n\n/** The reduce pass: mean intensity of the 16 directions, and the centre of the visible emission ((0,0,0,0) when none). */\nexport function vdbFrameEmissionReduce(texels: readonly { intensity: Vec4; center: Vec4 }[]): { intensity: Vec4; center: Vec4 } {\n const intensity: Vec4 = [0, 0, 0, 0];\n const center: Vec4 = [0, 0, 0, 0];\n for (const t of texels) {\n for (let k = 0; k < 4; k++) {\n intensity[k] = intensity[k]! + t.intensity[k]!;\n center[k] = center[k]! + t.center[k]!;\n }\n }\n for (let k = 0; k < 4; k++) intensity[k] = intensity[k]! / frameEmissionDirections;\n const visible = center[3] > 0;\n const w = Math.max(center[3], 1e-12);\n return { intensity, center: visible ? [center[0] / w, center[1] / w, center[2] / w, 1] : [0, 0, 0, 0] };\n}\n\n/** One emitter of the probe pass: the reduce outputs (intensity rgb + radius, centre + visible flag). */\nexport interface VDBFrameEmitterLight {\n intensity: Vec4;\n center: Vec4;\n}\n\n/**\n * One probe of the probe pass: the L1 irradiance of every emitter as a point light at its emission centre,\n * E(n) = E/4 + E/2 · dot(l, n), softened near the centre by a quarter of the radius. Returns (red, green, blue),\n * each (constant, direction xyz).\n */\nexport function vdbFrameEmissionProbe(probe: Vec3, emitters: readonly VDBFrameEmitterLight[]): [Vec4, Vec4, Vec4] {\n const constant: Vec3 = [0, 0, 0];\n const dirs: [Vec3, Vec3, Vec3] = [\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ];\n for (const e of emitters) {\n if (!(e.center[3] > 0)) continue;\n const toProbe: Vec3 = [probe[0] - e.center[0], probe[1] - e.center[1], probe[2] - e.center[2]];\n const d2 = dot(toProbe, toProbe);\n const soft = e.intensity[3] * 0.25;\n const sd2 = d2 + soft * soft;\n const irradiance: Vec3 = [e.intensity[0] / sd2, e.intensity[1] / sd2, e.intensity[2] / sd2];\n const scale = (1 / Math.sqrt(Math.max(d2, 1e-12))) * (d2 / sd2) * -0.5;\n const toLight: Vec3 = [toProbe[0] * scale, toProbe[1] * scale, toProbe[2] * scale];\n for (let k = 0; k < 3; k++) {\n constant[k] = constant[k]! + irradiance[k]! * 0.25;\n for (let a = 0; a < 3; a++) dirs[k]![a] = dirs[k]![a]! + toLight[a]! * irradiance[k]!;\n }\n }\n return [\n [constant[0], ...dirs[0]],\n [constant[1], ...dirs[1]],\n [constant[2], ...dirs[2]],\n ];\n}\n\n/** The light node's irradiance from (filtered) probe values: max(x + dot(yzw, n), 0) per channel, × falloff. */\nexport function vdbFrameEmissionIrradiance(probe: readonly [Vec4, Vec4, Vec4], normal: Vec3, falloff = 1): Vec3 {\n return probe.map((p) => Math.max(0, p[0] + p[1] * normal[0] + p[2] * normal[1] + p[3] * normal[2]) * falloff) as Vec3;\n}\n\n/** Settings of the probe cascades (his `FrameEmissionLight` props). */\nexport interface VDBFrameEmissionGridSettings {\n resolution: number;\n range: number;\n cascades: number;\n distance: number;\n}\n\n/** The probe cascades (cascade 0 finest), the centre of all emitters, and a key that changes with them. */\nexport interface VDBFrameEmissionGrid {\n resolution: number;\n count: number;\n min: Vec3[];\n size: Vec3[];\n center: Vec3;\n key: string;\n}\n\n/**\n * updateProbeGrid (FrameEmissionLight core L186–241): the last cascade is the box of all emitters grown by\n * (range − 1)/2 of its longest side on each side; finer cascades are power-of-two-voxel cubes around the camera,\n * each half the next, snapped to their voxel; a fine cascade that is not finer than the last or holds no emitter is\n * skipped.\n */\nexport function vdbFrameEmissionProbeGrid(settings: VDBFrameEmissionGridSettings, emitterBoxes: readonly { min: Vec3; max: Vec3 }[], cameraPosition: Vec3): VDBFrameEmissionGrid {\n const resolution = Math.min(frameEmissionMaxResolution, Math.max(2, Math.round(settings.resolution)));\n const cascades = Math.min(frameEmissionMaxCascades, Math.max(1, Math.round(settings.cascades)));\n const gMin: Vec3 = [Infinity, Infinity, Infinity];\n const gMax: Vec3 = [-Infinity, -Infinity, -Infinity];\n for (const b of emitterBoxes) {\n for (let k = 0; k < 3; k++) {\n gMin[k] = Math.min(gMin[k]!, b.min[k]!);\n gMax[k] = Math.max(gMax[k]!, b.max[k]!);\n }\n }\n const center: Vec3 = [(gMin[0] + gMax[0]) / 2, (gMin[1] + gMax[1]) / 2, (gMin[2] + gMax[2]) / 2];\n let size: Vec3 = [gMax[0] - gMin[0], gMax[1] - gMin[1], gMax[2] - gMin[2]];\n const grow = (Math.max(size[0], size[1], size[2]) * Math.max(0, settings.range - 1)) / 2;\n for (let k = 0; k < 3; k++) {\n gMin[k] = gMin[k]! - grow;\n gMax[k] = gMax[k]! + grow;\n }\n size = [Math.max(gMax[0] - gMin[0], 1e-6), Math.max(gMax[1] - gMin[1], 1e-6), Math.max(gMax[2] - gMin[2], 1e-6)];\n const lastSize = Math.max(size[0], size[1], size[2]);\n const fineHalfSize = Math.min(settings.distance, lastSize / 2);\n const min: Vec3[] = [];\n const sizes: Vec3[] = [];\n for (let cascade = 0; cascade < cascades - 1; cascade++) {\n const halfSize = fineHalfSize / Math.pow(2, cascades - 1 - cascade);\n const voxel = Math.pow(2, Math.ceil(Math.log2((halfSize * 2) / (resolution - 1))));\n const s = voxel * resolution;\n const bMin = [0, 1, 2].map((k) => Math.floor((cameraPosition[k]! - halfSize) / voxel) * voxel) as Vec3;\n const bMax = [bMin[0] + s, bMin[1] + s, bMin[2] + s] as Vec3;\n const intersects = bMax[0] >= gMin[0] && bMin[0] <= gMax[0] && bMax[1] >= gMin[1] && bMin[1] <= gMax[1] && bMax[2] >= gMin[2] && bMin[2] <= gMax[2];\n if (s >= lastSize || !intersects) continue;\n min.push(bMin);\n sizes.push([s, s, s]);\n }\n min.push([gMin[0], gMin[1], gMin[2]]);\n sizes.push(size);\n const key = [resolution];\n for (let i = 0; i < min.length; i++) key.push(...min[i]!, ...sizes[i]!);\n return { resolution, count: min.length, min, size: sizes, center, key: key.join(\",\") };\n}\n\n/**\n * Past the last cascade (the light node, L490–506): the clamped edge probe's light falls off as the squared distance\n * ratio |edge − centre|² / |p − centre|² (≤ 1).\n */\nexport function vdbFrameEmissionFalloff(edge: Vec3, position: Vec3, center: Vec3): number {\n const a: Vec3 = [edge[0] - center[0], edge[1] - center[1], edge[2] - center[2]];\n const b: Vec3 = [position[0] - center[0], position[1] - center[1], position[2] - center[2]];\n return Math.min(1, dot(a, a) / Math.max(dot(b, b), 1e-6));\n}\n\n/**\n * The light node's probe read (L457–507) on CPU atlases (the probe target's three attachments, rows bottom first):\n * the finest cascade that holds the point (half a probe inside), blended into the next one over the last tenth of\n * each side; outside every cascade, the last cascade's clamped edge with {@link vdbFrameEmissionFalloff}. Returns the\n * (red, green, blue) L1 probe values and the falloff; {@link vdbFrameEmissionIrradiance} then gives E(n).\n */\nexport function vdbFrameEmissionLookup(atlases: readonly [VDBFrameAtlas, VDBFrameAtlas, VDBFrameAtlas], grid: VDBFrameGridLayout, center: Vec3, position: Vec3): { probe: [Vec4, Vec4, Vec4]; falloff: number } {\n return vdbFrameEmissionLookupWith((cascade, channel, uvw) => vdbFrameSampleGrid(atlases[channel]!, grid, cascade, uvw) as Vec4, grid, center, position);\n}\n\n/**\n * {@link vdbFrameEmissionLookup} on any probe store: `sample(cascade, channel, uvw)` returns the filtered L1 probe of\n * one colour channel (K6.5: the core's stacked 3D texture through `vdbFrameStackSample`; the CPU twin of\n * `vdbEmissionIrradiance`).\n */\nexport function vdbFrameEmissionLookupWith(sampleProbe: (cascade: number, channel: number, uvw: Vec3) => ArrayLike<number>, grid: VDBFrameGridLayout, center: Vec3, position: Vec3): { probe: [Vec4, Vec4, Vec4]; falloff: number } {\n let probe: [Vec4, Vec4, Vec4] = [\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n ];\n let falloff = 1;\n const sample = (cascade: number, uvw: Vec3, weight: number) => {\n probe = probe.map((p, k) => {\n const s = sampleProbe(cascade, k, uvw);\n return p.map((v, c) => v + (s[c]! - v) * weight) as Vec4;\n }) as [Vec4, Vec4, Vec4];\n };\n if (grid.count > 0) {\n const cascade = vdbFrameFindCascade(grid, position, 0);\n if (cascade >= 0) {\n const uvw = vdbFrameGridUvw(grid, cascade, position);\n sample(cascade, uvw, 1);\n const side = Math.min(uvw[0], uvw[1], uvw[2], 1 - uvw[0], 1 - uvw[1], 1 - uvw[2]);\n const t = Math.min(1, Math.max(0, side / 0.1));\n const blend = 1 - t * t * (3 - 2 * t);\n if (blend > 0) {\n const next = vdbFrameFindCascade(grid, position, cascade + 1);\n if (next >= 0) sample(next, vdbFrameGridUvw(grid, next, position), blend);\n }\n } else {\n const last = grid.count - 1;\n const inset = 0.5 / grid.resolution;\n const uvw = vdbFrameGridUvw(grid, last, position).map((v) => Math.min(1 - inset, Math.max(inset, v))) as Vec3;\n const m = grid.gridMin[last]!;\n const s = grid.gridSize[last]!;\n sample(last, uvw, 1);\n falloff = vdbFrameEmissionFalloff([m[0] + uvw[0] * s[0], m[1] + uvw[1] * s[1], m[2] + uvw[2] * s[2]], position, center);\n }\n }\n return { probe, falloff };\n}\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { type Vec3, type Vec4 } from "./index.js";
|
|
2
|
+
/** Work map size (design §3.3 envPrefilter). */
|
|
3
|
+
export declare const VDB_FRAME_ENV_WORK_WIDTH = 128;
|
|
4
|
+
export declare const VDB_FRAME_ENV_WORK_HEIGHT = 64;
|
|
5
|
+
/** GGX roughness of the blur (his PMREM roughness 0.4, `frameEnvironmentMapRoughness`). */
|
|
6
|
+
export declare const VDB_FRAME_ENV_ROUGHNESS = 0.4;
|
|
7
|
+
/** Most source texels per axis one work texel reads (larger maps are strided). */
|
|
8
|
+
export declare const VDB_FRAME_ENV_MAX_SPAN = 256;
|
|
9
|
+
/** Near-ties of the 'directional' extraction (brightest texel, nearest seed) go to the first candidate (f32 vs f64). */
|
|
10
|
+
export declare const VDB_FRAME_ENV_TIE = 0.00001;
|
|
11
|
+
/** Most cube sub-samples per axis of one work texel. */
|
|
12
|
+
export declare const VDB_FRAME_ENV_MAX_SUPERSAMPLE = 16;
|
|
13
|
+
/** A 3 × 3 column-major matrix (world → map). */
|
|
14
|
+
export type VDBFrameEnvRotation = ArrayLike<number>;
|
|
15
|
+
/** The identity map rotation. */
|
|
16
|
+
export declare const VDB_FRAME_ENV_IDENTITY: readonly number[];
|
|
17
|
+
/** m = R · d (R column-major). */
|
|
18
|
+
export declare function vdbFrameEnvToMap(r: VDBFrameEnvRotation, d: Vec3): Vec3;
|
|
19
|
+
/** d = Rᵀ · m (R orthogonal: its inverse). */
|
|
20
|
+
export declare function vdbFrameEnvToWorld(r: VDBFrameEnvRotation, m: Vec3): Vec3;
|
|
21
|
+
/** The map direction of an equirect point: u along x (u = atan2(z, x) / 2π + ½), v from the top row (+Y). */
|
|
22
|
+
export declare function vdbFrameEquirectDirection(u: number, v: number): Vec3;
|
|
23
|
+
/** Solid angle of work map row `y` (exact: Δφ · (cos θ₀ − cos θ₁)). */
|
|
24
|
+
export declare function vdbFrameEnvWorkSolidAngle(y: number, width?: number, height?: number): number;
|
|
25
|
+
/** An RGBA float image, rows from the top (row 0 is the first `width · 4` floats). */
|
|
26
|
+
export interface VDBFrameEnvImage {
|
|
27
|
+
data: ArrayLike<number>;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One work map texel from an equirect source: the solid-angle mean of the source over the texel's box (exact
|
|
33
|
+
* overlaps; sources wider than {@link VDB_FRAME_ENV_MAX_SPAN} texels per work texel are strided).
|
|
34
|
+
*/
|
|
35
|
+
export declare function vdbFrameEnvironmentAreaTexel(src: VDBFrameEnvImage, x: number, y: number, workWidth?: number, workHeight?: number): [number, number, number, number];
|
|
36
|
+
/** The face and texel of a cube direction (WebGPU's face order +X, −X, +Y, −Y, +Z, −Z and orientation). */
|
|
37
|
+
export declare function vdbFrameCubeTexel(m: Vec3, size: number): {
|
|
38
|
+
face: number;
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
};
|
|
42
|
+
/** Cube sub-samples per axis of a work texel for a face of `size` texels (about two per cube texel). */
|
|
43
|
+
export declare function vdbFrameEnvCubeSupersample(size: number, workHeight?: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* One work map texel from a cube source (`faces[f]` an RGBA image of `size`²): k × k sub-samples of the texel's box,
|
|
46
|
+
* each the nearest cube texel, weighted by sin θ (solid angle).
|
|
47
|
+
*/
|
|
48
|
+
export declare function vdbFrameEnvironmentCubeTexel(faces: readonly VDBFrameEnvImage[], size: number, x: number, y: number, workWidth?: number, workHeight?: number): [number, number, number, number];
|
|
49
|
+
/** The GGX weight of input direction cosine `c` around the output direction (n = v = r; D(h) · n·l). */
|
|
50
|
+
export declare function vdbFrameEnvGgxWeight(c: number, roughness?: number): number;
|
|
51
|
+
/**
|
|
52
|
+
* One texel (x, y) of his 64 × 32 map: the GGX (roughness 0.4) weighted mean of the work map around his direction
|
|
53
|
+
* of the texel centre (`vdbFrameEnvironmentMapDirection`), the work map in map space (`rotation` world → map).
|
|
54
|
+
*/
|
|
55
|
+
export declare function vdbFrameEnvironmentBlurTexel(work: VDBFrameEnvImage, rotation: VDBFrameEnvRotation, x: number, y: number, roughness?: number): [number, number, number, number];
|
|
56
|
+
/** three's SH9 basis (SphericalHarmonics3.getBasisAt). */
|
|
57
|
+
export declare function vdbFrameSh9Basis(d: Vec3): number[];
|
|
58
|
+
/** SH9 radiance coefficients (rgb each, three's basis) of the work map in world space: Σ L · Y(Rᵀ m) · Ω. */
|
|
59
|
+
export declare function vdbFrameEnvironmentIrradianceSh(work: VDBFrameEnvImage, rotation: VDBFrameEnvRotation): Vec3[];
|
|
60
|
+
/** Irradiance at a unit normal from SH9 radiance coefficients (three's getShIrradianceAt, Ramamoorthi–Hanrahan). */
|
|
61
|
+
export declare function vdbFrameEnvironmentIrradiance(sh: readonly Vec3[], n: Vec3): Vec3;
|
|
62
|
+
/** Environment modes as the buffer codes them. */
|
|
63
|
+
export declare const VDB_FRAME_ENV_MODE: {
|
|
64
|
+
readonly outward: 0;
|
|
65
|
+
readonly directional: 1;
|
|
66
|
+
readonly sphericalHarmonics: 2;
|
|
67
|
+
};
|
|
68
|
+
/** The environment buffer's content (`VdbFrameEnvironment`), as the twin computes it. */
|
|
69
|
+
export interface VDBFrameEnvironmentGpuResult {
|
|
70
|
+
/** An environment with finite, positive energy. */
|
|
71
|
+
valid: boolean;
|
|
72
|
+
mode: number;
|
|
73
|
+
count: number;
|
|
74
|
+
directions: Vec3[];
|
|
75
|
+
colors: Vec3[];
|
|
76
|
+
/** SH9 radiance coefficients × intensity (irradiance through {@link vdbFrameEnvironmentIrradiance}). */
|
|
77
|
+
sh: Vec3[];
|
|
78
|
+
}
|
|
79
|
+
/** The settings the reduction reads. */
|
|
80
|
+
export interface VDBFrameEnvironmentReduceSettings {
|
|
81
|
+
environmentLighting: string;
|
|
82
|
+
environmentSamples: number;
|
|
83
|
+
environmentShOrder: number;
|
|
84
|
+
/** Diffusion multiple scattering: the 'directional' seeds come in opposite pairs. */
|
|
85
|
+
pairs: boolean;
|
|
86
|
+
intensity: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The `envReduce` kernel's output from the read-back 64 × 32 map (`blurred`, his directions, rows from v = 0) and the
|
|
90
|
+
* work map SH (`sh`, before intensity): his lights ('directional' cells sorted by power, or 'spherical-harmonics'
|
|
91
|
+
* quadrature lights) through {@link VDBFrameEnvironmentLights}, colours and SH × intensity.
|
|
92
|
+
*/
|
|
93
|
+
export declare function vdbFrameEnvironmentReduce(blurred: ArrayLike<number>, sh: readonly Vec3[], s: VDBFrameEnvironmentReduceSettings): VDBFrameEnvironmentGpuResult;
|
|
94
|
+
/** The renderer's environment flags of 'frame' lighting (`VdbFrameUniforms.environment`, `lighting.z`, `lighting.w`). */
|
|
95
|
+
export interface VDBFrameEnvironmentFlags {
|
|
96
|
+
/** The shadow grid is in use. */
|
|
97
|
+
useShadows: boolean;
|
|
98
|
+
/** The dominant 'directional' light has a shadow slot. */
|
|
99
|
+
slot: boolean;
|
|
100
|
+
/** The environment grid holds this frame's lights. */
|
|
101
|
+
grid: boolean;
|
|
102
|
+
/** Diffusion multiple scattering. */
|
|
103
|
+
diffusion: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The environment term of his density pass in the core ('frame' lighting, K6.2b): the irradiance E a volume adds as
|
|
107
|
+
* albedo · E / π at its visible position. With environment-grid lights the grid (`gridAt`, null outside: then the
|
|
108
|
+
* unshadowed sum of those lights); with only the slot light nothing (the lighting adds it); else 'outward' SH
|
|
109
|
+
* irradiance along `outward`, shadowed between the sky down and up totals (diffusion: the outward and inward halves).
|
|
110
|
+
*/
|
|
111
|
+
export declare function vdbFrameEnvironmentDensityTerm(env: VDBFrameEnvironmentGpuResult, flags: VDBFrameEnvironmentFlags, outward: Vec3, sky: Vec3, skyTotals: [number, number], gridAt: () => Vec3 | null, octaves?: Vec4): Vec3;
|