@pmndrs/vdb 0.0.0-stage → 0.1.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 +137 -0
- package/LICENSE +21 -0
- package/README.md +448 -2
- package/THIRD_PARTY_NOTICES.md +147 -0
- package/dist/core/compute/atlas.d.ts +94 -0
- package/dist/core/compute/atlas.js +98 -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/pyramid.d.ts +105 -0
- package/dist/core/compute/pyramid.js +455 -0
- package/dist/core/compute/pyramid.js.map +1 -0
- package/dist/core/compute/shared.d.ts +115 -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 +71 -0
- package/dist/core/compute/stats.js +188 -0
- package/dist/core/compute/stats.js.map +1 -0
- package/dist/core/compute/value-transform.d.ts +23 -0
- package/dist/core/compute/value-transform.js +58 -0
- package/dist/core/compute/value-transform.js.map +1 -0
- package/dist/core/errors.d.ts +11 -0
- package/dist/core/errors.js +9 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +27 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +15 -0
- package/dist/core/internal.js +15 -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 +82 -0
- package/dist/core/pool/image-header.js +175 -0
- package/dist/core/pool/image-header.js.map +1 -0
- package/dist/core/pool/layout.d.ts +164 -0
- package/dist/core/pool/layout.js +267 -0
- package/dist/core/pool/layout.js.map +1 -0
- package/dist/core/pool/limits.d.ts +40 -0
- package/dist/core/pool/limits.js +79 -0
- package/dist/core/pool/limits.js.map +1 -0
- package/dist/core/pool/pool.d.ts +279 -0
- package/dist/core/pool/pool.js +953 -0
- package/dist/core/pool/pool.js.map +1 -0
- package/dist/core/source/dense.d.ts +19 -0
- package/dist/core/source/dense.js +287 -0
- package/dist/core/source/dense.js.map +1 -0
- package/dist/core/source/types.d.ts +63 -0
- package/dist/core/source/types.js +9 -0
- package/dist/core/source/types.js.map +1 -0
- package/dist/core/types.d.ts +28 -0
- package/dist/core/types.js +28 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wgsl/api.d.ts +41 -0
- package/dist/core/wgsl/api.js +463 -0
- package/dist/core/wgsl/api.js.map +1 -0
- package/dist/core/wgsl/generate.d.ts +82 -0
- package/dist/core/wgsl/generate.js +505 -0
- package/dist/core/wgsl/generate.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +54 -0
- package/dist/core/wgsl/level-set.js +194 -0
- package/dist/core/wgsl/level-set.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +330 -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 +104 -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 +162 -0
- package/dist/three/coarse-first.js +187 -0
- package/dist/three/coarse-first.js.map +1 -0
- package/dist/three/compute.d.ts +63 -0
- package/dist/three/compute.js +56 -0
- package/dist/three/compute.js.map +1 -0
- package/dist/three/device.d.ts +59 -0
- package/dist/three/device.js +59 -0
- package/dist/three/device.js.map +1 -0
- package/dist/three/frame/blackbody.d.ts +42 -0
- package/dist/three/frame/blackbody.js +74 -0
- package/dist/three/frame/blackbody.js.map +1 -0
- package/dist/three/frame/chunks.d.ts +157 -0
- package/dist/three/frame/chunks.js +559 -0
- package/dist/three/frame/chunks.js.map +1 -0
- package/dist/three/frame/density-material.d.ts +53 -0
- package/dist/three/frame/density-material.js +353 -0
- package/dist/three/frame/density-material.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +167 -0
- package/dist/three/frame/emission-light.js +655 -0
- package/dist/three/frame/emission-light.js.map +1 -0
- package/dist/three/frame/environment-grid-material.d.ts +21 -0
- package/dist/three/frame/environment-grid-material.js +184 -0
- package/dist/three/frame/environment-grid-material.js.map +1 -0
- package/dist/three/frame/environment-material.d.ts +22 -0
- package/dist/three/frame/environment-material.js +87 -0
- package/dist/three/frame/environment-material.js.map +1 -0
- package/dist/three/frame/grid-mip-material.d.ts +12 -0
- package/dist/three/frame/grid-mip-material.js +61 -0
- package/dist/three/frame/grid-mip-material.js.map +1 -0
- package/dist/three/frame/index.d.ts +39 -0
- package/dist/three/frame/index.js +35 -0
- package/dist/three/frame/index.js.map +1 -0
- package/dist/three/frame/inject-material.d.ts +56 -0
- package/dist/three/frame/inject-material.js +424 -0
- package/dist/three/frame/inject-material.js.map +1 -0
- package/dist/three/frame/integrate-material.d.ts +26 -0
- package/dist/three/frame/integrate-material.js +198 -0
- package/dist/three/frame/integrate-material.js.map +1 -0
- package/dist/three/frame/layout.d.ts +34 -0
- package/dist/three/frame/layout.js +48 -0
- package/dist/three/frame/layout.js.map +1 -0
- package/dist/three/frame/lighting-material.d.ts +41 -0
- package/dist/three/frame/lighting-material.js +257 -0
- package/dist/three/frame/lighting-material.js.map +1 -0
- package/dist/three/frame/lights.d.ts +11 -0
- package/dist/three/frame/lights.js +16 -0
- package/dist/three/frame/lights.js.map +1 -0
- package/dist/three/frame/medium.d.ts +21 -0
- package/dist/three/frame/medium.js +29 -0
- package/dist/three/frame/medium.js.map +1 -0
- package/dist/three/frame/neural.d.ts +14 -0
- package/dist/three/frame/neural.js +105 -0
- package/dist/three/frame/neural.js.map +1 -0
- package/dist/three/frame/phase.d.ts +44 -0
- package/dist/three/frame/phase.js +80 -0
- package/dist/three/frame/phase.js.map +1 -0
- package/dist/three/frame/renderer.d.ts +493 -0
- package/dist/three/frame/renderer.js +1498 -0
- package/dist/three/frame/renderer.js.map +1 -0
- package/dist/three/frame/shadow-density-material.d.ts +30 -0
- package/dist/three/frame/shadow-density-material.js +123 -0
- package/dist/three/frame/shadow-density-material.js.map +1 -0
- package/dist/three/frame/spectrum.d.ts +18 -0
- package/dist/three/frame/spectrum.js +36 -0
- package/dist/three/frame/spectrum.js.map +1 -0
- package/dist/three/frame/temporal-material.d.ts +29 -0
- package/dist/three/frame/temporal-material.js +152 -0
- package/dist/three/frame/temporal-material.js.map +1 -0
- package/dist/three/frame/three-internals.d.ts +65 -0
- package/dist/three/frame/three-internals.js +150 -0
- package/dist/three/frame/three-internals.js.map +1 -0
- package/dist/three/frame/transmittance-material.d.ts +31 -0
- package/dist/three/frame/transmittance-material.js +315 -0
- package/dist/three/frame/transmittance-material.js.map +1 -0
- package/dist/three/frame/view.d.ts +103 -0
- package/dist/three/frame/view.js +296 -0
- package/dist/three/frame/view.js.map +1 -0
- package/dist/three/frame/volume-shadow-material.d.ts +36 -0
- package/dist/three/frame/volume-shadow-material.js +128 -0
- package/dist/three/frame/volume-shadow-material.js.map +1 -0
- package/dist/three/frame/volume-shadows.d.ts +153 -0
- package/dist/three/frame/volume-shadows.js +756 -0
- package/dist/three/frame/volume-shadows.js.map +1 -0
- package/dist/three/frame/volume.d.ts +172 -0
- package/dist/three/frame/volume.js +256 -0
- package/dist/three/frame/volume.js.map +1 -0
- package/dist/three/grid-node.d.ts +196 -0
- package/dist/three/grid-node.js +510 -0
- package/dist/three/grid-node.js.map +1 -0
- package/dist/three/index.d.ts +43 -0
- package/dist/three/index.js +49 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/internal.d.ts +14 -0
- package/dist/three/internal.js +14 -0
- package/dist/three/internal.js.map +1 -0
- package/dist/three/level-set-material.d.ts +112 -0
- package/dist/three/level-set-material.js +204 -0
- package/dist/three/level-set-material.js.map +1 -0
- package/dist/three/material.d.ts +194 -0
- package/dist/three/material.js +359 -0
- package/dist/three/material.js.map +1 -0
- package/dist/three/points.d.ts +84 -0
- package/dist/three/points.js +130 -0
- package/dist/three/points.js.map +1 -0
- package/dist/three/sequence.d.ts +317 -0
- package/dist/three/sequence.js +526 -0
- package/dist/three/sequence.js.map +1 -0
- package/dist/three/sparse-source.d.ts +233 -0
- package/dist/three/sparse-source.js +876 -0
- package/dist/three/sparse-source.js.map +1 -0
- package/dist/three/volume-source.d.ts +167 -0
- package/dist/three/volume-source.js +353 -0
- package/dist/three/volume-source.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +97 -0
- package/dist/tools/cpu/compute.js +218 -0
- package/dist/tools/cpu/compute.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +72 -0
- package/dist/tools/cpu/level-set.js +261 -0
- package/dist/tools/cpu/level-set.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +206 -0
- package/dist/tools/cpu/march.js +575 -0
- package/dist/tools/cpu/march.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 +31 -0
- package/dist/tools/cpu/read-value.js +336 -0
- package/dist/tools/cpu/read-value.js.map +1 -0
- package/dist/tools/cpu/sample-trilinear.d.ts +30 -0
- package/dist/tools/cpu/sample-trilinear.js +156 -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 +1058 -0
- package/dist/tools/cpu/stride-tables.generated.js +1266 -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/errors.d.ts +57 -0
- package/dist/tools/errors.js +58 -0
- package/dist/tools/errors.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +42 -0
- package/dist/tools/frame/blackbody.js +116 -0
- package/dist/tools/frame/blackbody.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +128 -0
- package/dist/tools/frame/emission.js +282 -0
- package/dist/tools/frame/emission.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +105 -0
- package/dist/tools/frame/environment.js +268 -0
- package/dist/tools/frame/environment.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +302 -0
- package/dist/tools/frame/grid.js +703 -0
- package/dist/tools/frame/grid.js.map +1 -0
- package/dist/tools/frame/index.d.ts +136 -0
- package/dist/tools/frame/index.js +348 -0
- package/dist/tools/frame/index.js.map +1 -0
- package/dist/tools/frame/medium.d.ts +61 -0
- package/dist/tools/frame/medium.js +99 -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 +54 -0
- package/dist/tools/frame/mie.js +176 -0
- package/dist/tools/frame/mie.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +9 -0
- package/dist/tools/frame/neural-weights.js +245 -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/pyramid-layout.d.ts +38 -0
- package/dist/tools/frame/pyramid-layout.js +53 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -0
- package/dist/tools/frame/shadows.d.ts +80 -0
- package/dist/tools/frame/shadows.js +182 -0
- package/dist/tools/frame/shadows.js.map +1 -0
- package/dist/tools/frame/sparse.d.ts +65 -0
- package/dist/tools/frame/sparse.js +191 -0
- package/dist/tools/frame/sparse.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +203 -0
- package/dist/tools/frame/spectral.js +550 -0
- package/dist/tools/frame/spectral.js.map +1 -0
- package/dist/tools/index.d.ts +106 -0
- package/dist/tools/index.js +88 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal.d.ts +46 -0
- package/dist/tools/internal.js +31 -0
- package/dist/tools/internal.js.map +1 -0
- package/dist/tools/nanovdb/build-from-vdb.d.ts +50 -0
- package/dist/tools/nanovdb/build-from-vdb.js +92 -0
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
- package/dist/tools/nanovdb/bytes.d.ts +220 -0
- package/dist/tools/nanovdb/bytes.js +345 -0
- package/dist/tools/nanovdb/bytes.js.map +1 -0
- package/dist/tools/nanovdb/coarse-first.d.ts +62 -0
- package/dist/tools/nanovdb/coarse-first.js +86 -0
- package/dist/tools/nanovdb/coarse-first.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +32 -0
- package/dist/tools/nanovdb/index.js +24 -0
- package/dist/tools/nanovdb/index.js.map +1 -0
- package/dist/tools/nanovdb/inspect.d.ts +24 -0
- package/dist/tools/nanovdb/inspect.js +63 -0
- package/dist/tools/nanovdb/inspect.js.map +1 -0
- package/dist/tools/nanovdb/leaf-codec.d.ts +85 -0
- package/dist/tools/nanovdb/leaf-codec.js +320 -0
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
- package/dist/tools/nanovdb/quantize.d.ts +43 -0
- package/dist/tools/nanovdb/quantize.js +277 -0
- package/dist/tools/nanovdb/quantize.js.map +1 -0
- package/dist/tools/nanovdb/resample.d.ts +160 -0
- package/dist/tools/nanovdb/resample.js +679 -0
- package/dist/tools/nanovdb/resample.js.map +1 -0
- package/dist/tools/nanovdb/serialize.d.ts +145 -0
- package/dist/tools/nanovdb/serialize.js +395 -0
- package/dist/tools/nanovdb/serialize.js.map +1 -0
- package/dist/tools/nanovdb/stats.d.ts +58 -0
- package/dist/tools/nanovdb/stats.js +149 -0
- package/dist/tools/nanovdb/stats.js.map +1 -0
- package/dist/tools/nanovdb/transform.d.ts +26 -0
- package/dist/tools/nanovdb/transform.js +91 -0
- package/dist/tools/nanovdb/transform.js.map +1 -0
- package/dist/tools/nanovdb/tree.d.ts +175 -0
- package/dist/tools/nanovdb/tree.js +518 -0
- package/dist/tools/nanovdb/tree.js.map +1 -0
- package/dist/tools/nanovdb/write-nvdb.d.ts +39 -0
- package/dist/tools/nanovdb/write-nvdb.js +210 -0
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
- package/dist/tools/nvdb-file.d.ts +195 -0
- package/dist/tools/nvdb-file.js +606 -0
- package/dist/tools/nvdb-file.js.map +1 -0
- package/dist/tools/nvdb-stream.d.ts +138 -0
- package/dist/tools/nvdb-stream.js +365 -0
- package/dist/tools/nvdb-stream.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.d.ts +56 -0
- package/dist/tools/vdb/blosc.js +231 -0
- package/dist/tools/vdb/blosc.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +40 -0
- package/dist/tools/vdb/byte-reader.js +139 -0
- package/dist/tools/vdb/byte-reader.js.map +1 -0
- package/dist/tools/vdb/compression.d.ts +73 -0
- package/dist/tools/vdb/compression.js +249 -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 +147 -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 +3 -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/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 +25 -0
- package/dist/tools/vdb/parse.js +171 -0
- package/dist/tools/vdb/parse.js.map +1 -0
- package/dist/tools/vdb/point-render-data.d.ts +31 -0
- package/dist/tools/vdb/point-render-data.js +57 -0
- package/dist/tools/vdb/point-render-data.js.map +1 -0
- package/dist/tools/vdb/points.d.ts +160 -0
- package/dist/tools/vdb/points.js +794 -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 +138 -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 +116 -0
- package/dist/tools/wvdb/bake.js +311 -0
- package/dist/tools/wvdb/bake.js.map +1 -0
- package/dist/tools/wvdb/dense.d.ts +112 -0
- package/dist/tools/wvdb/dense.js +309 -0
- package/dist/tools/wvdb/dense.js.map +1 -0
- package/dist/tools/wvdb/format.d.ts +161 -0
- package/dist/tools/wvdb/format.js +303 -0
- package/dist/tools/wvdb/format.js.map +1 -0
- package/dist/tools/wvdb/index.d.ts +13 -0
- package/dist/tools/wvdb/index.js +14 -0
- package/dist/tools/wvdb/index.js.map +1 -0
- package/dist/tools/wvdb/level-set.d.ts +48 -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 +54 -0
- package/dist/tools/wvdb/nanovdb.js +60 -0
- package/dist/tools/wvdb/nanovdb.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +260 -0
- package/dist/tools/wvdb/read.js +743 -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 +127 -0
- package/dist/tools/wvdb/write.js +396 -0
- package/dist/tools/wvdb/write.js.map +1 -0
- package/package.json +82 -4
- package/vendor/LICENSE +201 -0
- package/vendor/NOTICE +19 -0
- package/vendor/VENDOR.md +85 -0
- package/vendor/pnanovdb.wgsl +1539 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"volume-shadows.js","sourceRoot":"","sources":["../../../src/three/frame/volume-shadows.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6GAA6G;AAC7G,8GAA8G;AAC9G,wCAAwC;AACxC,4GAA4G;AAC5G,mHAAmH;AACnH,mHAAmH;AACnH,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxO,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,gBAAgB,EAA0B,MAAM,6BAA6B,CAAC;AACvK,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AA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adows.js L34–1027 (targets, the light shadow reset, receiver\n// uniforms, cascade lookup, FrameVolumeShadowNode, FrameVolumeShadows: entries, install, cameras, cascades,\n// the budgeted map updates, dispose).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; every three r187 internal goes through `three-internals.ts`, which self-tests it and throws\n// VDB_ENGINE_MISMATCH (his: a warning, then no volume shadow); the receiver depth and cascade maths have CPU twins\n// (`@pmndrs/vdb/tools` `vdbFrameShadow*`). Divergences: DIVERGES.md (K3.6 rows).\n\n/**\n * K3.6: shadows of `VDBFrameVolume`s on meshes (`frameRenderer.settings.castShadows`, his `FrameVolumeShadows`).\n * Each shadow-casting directional, spot or point light gets a Beer shadow map made from the world shadow grid's\n * last cascade ({@link VDBFrameVolumeShadowMaterial}); the light's `shadow.filterNode` multiplies three's shadow\n * by the volume transmittance at the receiver. Directional lights: cascades of the view (three's CSMShadowNode\n * split), tiles of one atlas. Spot: the light's shadow camera. Point: a cube map. A map piece is drawn again only\n * when its camera or the grid changes, at most `castShadowUpdatesPerFrame` pieces per render (oldest first).\n *\n * three: receivers need `receiveShadow`, the light `castShadow`, and `renderer.shadowMap.enabled`. The maps are\n * drawn before the first receiver of each render (the node's `updateBefore`), so the grid is ready before the\n * volumes draw.\n */\n\nimport * as THREE from \"three\";\nimport { CubeRenderTarget, Node } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport type { WebGPURenderer } from \"three/webgpu\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport { frameMaxShadowMapCascades, frameShadowCascadeMargin, frameShadowCoarseMapSize, frameShadowCoarseSteps, frameShadowMinOpticalDepth, vdbFrameShadowCascadeBreaks, vdbFrameShadowCascadeFar } from \"../../tools/frame/shadows.js\";\nimport { VDBFrameVolumeShadowMaterial, createShadowRayUniforms, frameMaxCastShadowSteps, frameShadowDepth, type ShadowRayUniforms } from \"./volume-shadow-material.js\";\nimport { vdbFrameCheckFilterInputs, vdbFrameCheckLightReset, vdbFrameRenderUpdateType, vdbFrameShadowFilters, vdbFrameSharedLightNode } from \"./three-internals.js\";\nimport type { VDBFrameRenderer } from \"./renderer.js\";\n\nconst { Fn, If, clamp, cubeTexture, dot, exp, float, int, max, positionView, positionWorld, renderGroup, select, texture, uniform, vec2, vec3, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\ntype N = VDBTslNode;\ntype RendererLike = WebGPURenderer & { isWebGPURenderer?: boolean; coordinateSystem: number };\n\nexport { frameMaxShadowMapCascades };\n\nconst clearColor = new THREE.Color();\nconst lightDirection = new THREE.Vector3();\nconst lightUp = new THREE.Vector3();\nconst point = new THREE.Vector3();\nconst lightView = new THREE.Matrix4();\nconst lightViewInverse = new THREE.Matrix4();\nconst casterBox = new THREE.Box3();\nconst casterWorldBox = new THREE.Box3();\nconst sliceBox = new THREE.Box3();\nconst tileViewport = new THREE.Vector4();\nconst nearCorners = [0, 1, 2, 3].map(() => new THREE.Vector3());\nconst farCorners = [0, 1, 2, 3].map(() => new THREE.Vector3());\n\n// NOTE Values for change checks. One array, reused for each check.\nconst signature: number[] = [];\n\n// NOTE Fullscreen triangle. Positions are clip coordinates.\nconst createFullscreenGeometry = () => new THREE.BufferGeometry().setAttribute(\"position\", new THREE.Float32BufferAttribute([-1, -1, 0, 3, -1, 0, -1, 3, 0], 3));\n\nconst targetOptions: THREE.RenderTargetOptions = {\n type: THREE.HalfFloatType,\n format: THREE.RGBAFormat,\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n generateMipmaps: false,\n depthBuffer: false,\n};\n\ntype ShadowLight = THREE.DirectionalLight | THREE.SpotLight | THREE.PointLight;\n\n// NOTE Directional lights: an atlas with one tile for each cascade, in a row\nconst createTarget = (size: number, light: ShadowLight): THREE.RenderTarget => {\n if ((light as THREE.PointLight).isPointLight) {\n return new CubeRenderTarget(size, targetOptions) as unknown as THREE.RenderTarget;\n }\n\n const tiles = (light as THREE.DirectionalLight).isDirectionalLight ? frameMaxShadowMapCascades : 1;\n\n return new THREE.RenderTarget(size * tiles, size, targetOptions);\n};\n\n// NOTE Clears a new map one time. Then three makes its GPU texture as a render target texture now.\n// Else the first render makes a new GPU texture, and receivers that sampled the map before keep the destroyed one.\nconst initTarget = (renderer: RendererLike, target: THREE.RenderTarget, cube: boolean): THREE.RenderTarget => {\n const currentRenderTarget = renderer.getRenderTarget();\n const currentActiveCubeFace = renderer.getActiveCubeFace();\n const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n const currentClearAlpha = renderer.getClearAlpha();\n\n renderer.getClearColor(clearColor);\n renderer.setClearColor(0x000000, 0.0);\n\n for (let face = 0; face < (cube ? 6 : 1); face++) {\n renderer.setRenderTarget(target, face);\n renderer.clear(true, false, false);\n }\n\n renderer.setClearColor(clearColor, currentClearAlpha);\n renderer.setRenderTarget(currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel);\n\n return target;\n};\n\nconst isShadowLight = (light: THREE.Object3D): light is ShadowLight => {\n const l = light as THREE.Light & { isDirectionalLight?: boolean; isSpotLight?: boolean; isPointLight?: boolean };\n\n return !!(l.isDirectionalLight || l.isSpotLight || l.isPointLight) && l.castShadow;\n};\n\n// NOTE Corners of the view between two depths, in world space. Corners 0 and 2 are diagonal.\nconst getSliceCorners = (camera: THREE.Camera, near: number, far: number): void => {\n const corners = [\n [-1, -1],\n [1, -1],\n [1, 1],\n [-1, 1],\n ] as const;\n const perspective = (camera as THREE.PerspectiveCamera).isPerspectiveCamera;\n\n corners.forEach(([x, y], index) => {\n for (const [target, depth] of [\n [nearCorners[index]!, near],\n [farCorners[index]!, far],\n ] as const) {\n // NOTE A point on the corner ray, then moved to the depth (perspective) or set to it (orthographic)\n target.set(x, y, 0.5).applyMatrix4(camera.projectionMatrixInverse);\n\n if (perspective) {\n target.multiplyScalar(depth / -target.z);\n } else {\n target.z = -depth;\n }\n\n target.applyMatrix4(camera.matrixWorld);\n }\n });\n};\n\n// NOTE A light shadow node is built one time; a new filterNode has no effect until it is built again.\n// disposeShadow of the shared light node makes the receivers build a new shadow node (three-internals.ts, internal 1).\n// Returns the old shadow node, or null when there is none. Receivers can use it until the end of this render.\nconst resetLightShadow = (light: ShadowLight): { dispose(): void } | null => {\n vdbFrameCheckLightReset();\n\n const lightNode = vdbFrameSharedLightNode(light) as { shadowNode: { dispose(): void } | null; disposeShadow(): void } | null;\n\n if (!lightNode || !lightNode.shadowNode) {\n return null;\n }\n\n const { shadowNode } = lightNode;\n\n // NOTE disposeShadow without the GPU dispose\n lightNode.shadowNode = { dispose() {} };\n lightNode.disposeShadow();\n\n return shadowNode;\n};\n\n// NOTE A uniform that copies a value of the entry one time in each render (the render group).\n// A light shadow node is built one time; its object-group uniforms would keep the value of the first build.\nconst renderUniform = (value: unknown, type: string, read: () => unknown): N => uniform(value, type).setGroup(renderGroup).onRenderUpdate(read);\n\ninterface Cascade {\n camera: THREE.OrthographicCamera;\n viewProjection: THREE.Matrix4;\n origin: THREE.Vector3;\n far: number;\n signature: number[];\n lastDraw: number;\n drawn: { viewProjection: THREE.Matrix4; origin: THREE.Vector3; far: number };\n}\n\ninterface Receiver {\n enabled: N;\n rayUniforms: ShadowRayUniforms;\n cascades: { count: N; breaks: N; items: { viewProjection: N; origin: N; far: N }[] } | null;\n}\n\n/** One shadow light's maps and state. */\nexport interface VDBFrameShadowEntry {\n light: ShadowLight;\n isPoint: boolean;\n target: THREE.RenderTarget;\n size: number;\n spectral: boolean;\n spectralTarget: THREE.RenderTarget | null;\n spectralMap: N | null;\n renderId: number;\n cubeCamera: THREE.CubeCamera | null;\n map: N;\n enabled: N;\n rayUniforms: ShadowRayUniforms;\n drawn: { origin: THREE.Vector3; forward: THREE.Vector3; perspective: number; far: number; cascadeCount: number; cascadeBreaks: THREE.Vector4 };\n item: { signature: number[]; lastDraw: number };\n cascadeCount: number;\n cascadeBreaks: THREE.Vector4;\n cascades: Cascade[] | null;\n receiver: Receiver;\n userFilter: ((inputs: unknown) => N) | null;\n}\n\n// NOTE Receivers read the drawn state: the values of the camera that drew each map or cascade tile.\n// A map that waits for the frame budget is older, but its values match, so its shadow stays in place.\nconst createReceiverUniforms = (entry: VDBFrameShadowEntry): Receiver => {\n const { drawn, cascades } = entry;\n\n return {\n enabled: renderUniform(0, \"int\", () => entry.enabled.value),\n rayUniforms: {\n frameShadowOrigin: renderUniform(new THREE.Vector3(), \"vec3\", () => drawn.origin),\n frameShadowForward: renderUniform(new THREE.Vector3(), \"vec3\", () => drawn.forward),\n frameShadowPerspective: renderUniform(0, \"int\", () => drawn.perspective),\n frameShadowFar: renderUniform(1.0, \"float\", () => drawn.far),\n },\n cascades: cascades\n ? {\n count: renderUniform(0, \"int\", () => drawn.cascadeCount),\n breaks: renderUniform(new THREE.Vector4(), \"vec4\", () => drawn.cascadeBreaks),\n items: cascades.map((cascade) => ({\n viewProjection: renderUniform(new THREE.Matrix4(), \"mat4\", () => cascade.drawn.viewProjection),\n origin: renderUniform(new THREE.Vector3(), \"vec3\", () => cascade.drawn.origin),\n far: renderUniform(1.0, \"float\", () => cascade.drawn.far),\n })),\n }\n : null,\n };\n};\n\n// NOTE Picks the cascade of the receiver by its view depth, as three's CSMShadowNode (twin: vdbFrameShadowCascadeIndex / Uv).\n// Returns the atlas uv, the ray uniforms of the cascade, and whether the receiver is in a cascade.\nconst getCascadeLookup = (receiver: Receiver, size: number): { uv: N; inside: N; rayUniforms: ShadowRayUniforms } => {\n const { count, breaks, items } = receiver.cascades!;\n const { frameShadowForward } = receiver.rayUniforms;\n const depth = positionView.z.negate();\n const breakList = [breaks.x, breaks.y, breaks.z, breaks.w];\n\n // NOTE Cascade index: the number of cascade far distances in front of the receiver\n let index: N = int(0);\n\n for (let i = 0; i < frameMaxShadowMapCascades - 1; i++) {\n index = index.add(select(depth.greaterThan(breakList[i]).and(int(i + 1).lessThan(count)), int(1), int(0)));\n }\n\n const pick = (key: \"viewProjection\" | \"origin\" | \"far\"): N => items.reduce<N>((result, item, i) => (i === 0 ? item[key] : select(index.equal(i), item[key], result)), null);\n\n const viewProjection = pick(\"viewProjection\");\n const clip = viewProjection.mul(vec4(positionWorld, 1.0));\n const tileUv = vec2(clip.x.mul(0.5).add(0.5), float(0.5).sub(clip.y.mul(0.5)));\n const lastBreak = breakList.reduce<N>((result, value, i) => (i === 0 ? value : select(count.equal(i + 1), value, result)), null);\n\n // NOTE Half a texel in from the tile sides. Then the linear filter does not read the next tile.\n const inset = float(0.5 / size);\n const clampedUv = clamp(tileUv, vec2(inset), vec2(float(1.0).sub(inset)));\n\n return {\n uv: vec2(clampedUv.x.add(float(index)).div(frameMaxShadowMapCascades), clampedUv.y),\n inside: depth.lessThanEqual(lastBreak).and(tileUv.x.greaterThanEqual(0.0)).and(tileUv.x.lessThanEqual(1.0)).and(tileUv.y.greaterThanEqual(0.0)).and(tileUv.y.lessThanEqual(1.0)),\n rayUniforms: {\n frameShadowOrigin: pick(\"origin\"),\n frameShadowForward,\n frameShadowPerspective: int(0),\n frameShadowFar: pick(\"far\"),\n },\n };\n};\n\n/**\n * Volume transmittance at a receiver from the Beer shadow map of the light (part of the light's shadow filter).\n * `uv` is the shadow map uv (spot) or the direction from the light (point); directional lights pick a cascade.\n * `updateBefore` draws the maps before the first receiver of each render. Twin: `vdbFrameShadowReceiver`.\n */\nexport class VDBFrameVolumeShadowNode extends Node {\n static get type(): string {\n return \"VDBFrameVolumeShadowNode\";\n }\n\n readonly shadows: VDBFrameVolumeShadows;\n readonly entry: VDBFrameShadowEntry;\n readonly uv: N;\n\n constructor(shadows: VDBFrameVolumeShadows, entry: VDBFrameShadowEntry, uv: N) {\n super(\"float\");\n\n this.shadows = shadows;\n this.entry = entry;\n this.uv = uv;\n (this as unknown as { updateBeforeType: string }).updateBeforeType = vdbFrameRenderUpdateType();\n }\n\n // NOTE Spectral maps: transmittance of each channel. ShadowMaterial has one shadow mask, so it gets the mean.\n isSpectral(builder: { material?: { isShadowNodeMaterial?: boolean } }): boolean {\n return this.entry.spectralMap !== null && builder.material?.isShadowNodeMaterial !== true;\n }\n\n override getNodeType(builder: never): string {\n return this.isSpectral(builder) ? \"vec3\" : \"float\";\n }\n\n override updateBefore(frame: never): boolean | undefined {\n const { renderer, scene, camera, renderId } = frame as { renderer: RendererLike; scene: THREE.Scene; camera: THREE.Camera; renderId: number };\n\n this.shadows.render(renderer, scene, camera, renderId, this.entry);\n\n return undefined;\n }\n\n override setup(builder: never): N {\n const { entry } = this;\n const { map, spectralMap, isPoint, receiver } = entry;\n const spectral = this.isSpectral(builder);\n let { uv } = this;\n let { rayUniforms } = receiver;\n let inside: N = receiver.enabled.equal(1);\n\n if (receiver.cascades) {\n const lookup = getCascadeLookup(receiver, entry.size);\n\n uv = lookup.uv;\n rayUniforms = lookup.rayUniforms;\n inside = inside.and(lookup.inside);\n } else if (!isPoint) {\n inside = inside.and(uv.x.greaterThanEqual(0.0)).and(uv.x.lessThanEqual(1.0)).and(uv.y.greaterThanEqual(0.0)).and(uv.y.lessThanEqual(1.0));\n }\n\n return Fn(() => {\n const result = (spectral ? vec3(1.0) : float(1.0)).toVar();\n\n If(inside, () => {\n const texel = map.sample(uv).level(0).toVar();\n const opticalDepth = texel.w;\n\n If(opticalDepth.greaterThan(frameShadowMinOpticalDepth), () => {\n const far = rayUniforms.frameShadowFar;\n const first = texel.x.div(opticalDepth).mul(far);\n const last = texel.y.div(opticalDepth).mul(far);\n const depth = frameShadowDepth(rayUniforms, positionWorld);\n\n // NOTE Beer shadow map: optical depth grows linearly from the first to the last density\n const along = clamp(depth.sub(first).div(max(last.sub(first), 1e-4)), 0.0, 1.0);\n\n if (spectral) {\n result.assign(exp(spectralMap.sample(uv).level(0).rgb.mul(along).negate()));\n } else if (spectralMap) {\n // NOTE ShadowMaterial with spectral maps: mean transmittance of the channels\n result.assign(dot(exp(spectralMap.sample(uv).level(0).rgb.mul(along).negate()), vec3(1.0 / 3.0)));\n } else {\n result.assign(exp(opticalDepth.mul(along).negate()));\n }\n });\n });\n\n return result;\n })();\n }\n}\n\n// NOTE An object and all its parents are visible\nconst isVisible = (object: THREE.Object3D): boolean => {\n for (let current: THREE.Object3D | null = object; current; current = current.parent) {\n if (!current.visible) {\n return false;\n }\n }\n\n return true;\n};\n\n// NOTE The object is in a scene. A removed light is not.\nconst isInScene = (object: THREE.Object3D): boolean => {\n let root = object;\n\n while (root.parent) {\n root = root.parent;\n }\n\n return (root as THREE.Scene).isScene === true;\n};\n\n// NOTE Compares the signature with the one of the item. Stores it when it is different.\nconst changed = (item: { signature: number[] }): boolean => {\n const same = signature.length === item.signature.length && signature.every((value, i) => value === item.signature[i]);\n\n if (!same) {\n item.signature.length = 0;\n item.signature.push(...signature);\n }\n\n return !same;\n};\n\ninterface WorkPiece {\n item: { signature: number[]; lastDraw: number };\n cost: number;\n draw(): void;\n}\n\n/** Shadow filter marker (his `isFrameVolumeShadowFilter`). */\ntype VolumeFilter = ((inputs: N) => N) & { isVDBFrameVolumeShadowFilter?: true };\n\n/** Shadows of `VDBFrameVolume`s on meshes, owned by a {@link VDBFrameRenderer} (`frameRenderer.volumeShadows`). */\nexport class VDBFrameVolumeShadows {\n readonly entries = new Map<THREE.Light, VDBFrameShadowEntry>();\n readonly scene = new THREE.Scene();\n readonly rayUniforms = createShadowRayUniforms() as unknown as ShadowRayUniforms;\n readonly material: VDBFrameVolumeShadowMaterial;\n readonly mesh: THREE.Mesh;\n readonly frameRenderer: VDBFrameRenderer;\n // NOTE Replaced and freed maps and shadow nodes. update() runs mid-render, so the next update() disposes them.\n retired: { dispose(): void }[] = [];\n renderCount = 0;\n mapsRenderId = -1;\n mapsCamera: THREE.Camera | null = null;\n /** Map pieces drawn in the last render, and how many waited for the budget (not his; tests and timing). */\n readonly lastUpdate = { drawn: 0, waiting: 0 };\n\n constructor(frameRenderer: VDBFrameRenderer) {\n this.frameRenderer = frameRenderer;\n this.material = new VDBFrameVolumeShadowMaterial(frameRenderer, this.rayUniforms);\n this.mesh = new THREE.Mesh(createFullscreenGeometry(), this.material);\n this.mesh.frustumCulled = false;\n this.scene.matrixWorldAutoUpdate = false;\n this.scene.add(this.mesh);\n }\n\n getMapSize(): number {\n const { settings } = this.frameRenderer;\n\n return settings.castShadowCoarse ? frameShadowCoarseMapSize : Math.max(1, Math.round(settings.castShadowMapSize));\n }\n\n isSpectral(): boolean {\n return this.frameRenderer.settings.spectral === true;\n }\n\n getSteps(): number {\n const { settings } = this.frameRenderer;\n\n return settings.castShadowCoarse ? frameShadowCoarseSteps : THREE.MathUtils.clamp(Math.round(settings.castShadowSteps), 1, frameMaxCastShadowSteps);\n }\n\n getEntry(renderer: RendererLike, light: ShadowLight): VDBFrameShadowEntry {\n let entry = this.entries.get(light);\n\n if (!entry) {\n const isPoint = (light as THREE.PointLight).isPointLight === true;\n const size = this.getMapSize();\n const spectral = this.isSpectral();\n const target = initTarget(renderer, createTarget(size, light), isPoint);\n const spectralTarget = spectral ? initTarget(renderer, createTarget(size, light), isPoint) : null;\n\n entry = {\n light,\n isPoint,\n target,\n size,\n // NOTE settings.spectral: a second map with the optical depth of each channel\n spectral,\n spectralTarget,\n spectralMap: spectralTarget ? (isPoint ? cubeTexture(spectralTarget.texture) : texture(spectralTarget.texture)) : null,\n renderId: -1,\n cubeCamera: isPoint ? new THREE.CubeCamera(0.5, 500.0, target as unknown as THREE.WebGLCubeRenderTarget) : null,\n map: isPoint ? cubeTexture(target.texture) : texture(target.texture),\n enabled: uniform(0, \"int\"),\n // NOTE Current camera values. drawn: the values of the last draw, for the receivers.\n rayUniforms: createShadowRayUniforms() as unknown as ShadowRayUniforms,\n drawn: {\n origin: new THREE.Vector3(),\n forward: new THREE.Vector3(0.0, 0.0, -1.0),\n perspective: 0,\n far: 1.0,\n cascadeCount: 0,\n cascadeBreaks: new THREE.Vector4(),\n },\n // NOTE Spot map or cube map (all faces in one draw), or the split layout of the cascades\n item: { signature: [], lastDraw: -1 },\n cascadeCount: 0,\n cascadeBreaks: new THREE.Vector4(),\n cascades: (light as THREE.DirectionalLight).isDirectionalLight\n ? Array.from({ length: frameMaxShadowMapCascades }, () => ({\n camera: new THREE.OrthographicCamera(),\n viewProjection: new THREE.Matrix4(),\n origin: new THREE.Vector3(),\n far: 1.0,\n signature: [],\n lastDraw: -1,\n drawn: { viewProjection: new THREE.Matrix4(), origin: new THREE.Vector3(), far: 1.0 },\n }))\n : null,\n receiver: null as unknown as Receiver,\n userFilter: null,\n };\n\n entry.receiver = createReceiverUniforms(entry);\n this.entries.set(light, entry);\n }\n\n return entry;\n }\n\n // NOTE A new map for a new size or a spectral change: a new texture, texture node and shadow node (shadow nodes keep texture bindings)\n resizeMap(renderer: RendererLike, entry: VDBFrameShadowEntry, size: number, spectral: boolean): void {\n const oldTargets = entry.spectralTarget ? [entry.target, entry.spectralTarget] : [entry.target];\n\n entry.target = initTarget(renderer, createTarget(size, entry.light), entry.isPoint);\n entry.size = size;\n entry.map = entry.isPoint ? cubeTexture(entry.target.texture) : texture(entry.target.texture);\n entry.spectral = spectral;\n entry.spectralTarget = spectral ? initTarget(renderer, createTarget(size, entry.light), entry.isPoint) : null;\n entry.spectralMap = entry.spectralTarget ? (entry.isPoint ? cubeTexture(entry.spectralTarget.texture) : texture(entry.spectralTarget.texture)) : null;\n\n entry.item.signature.length = 0;\n entry.cascades?.forEach((cascade) => (cascade.signature.length = 0));\n entry.drawn.cascadeCount = 0;\n\n if (entry.cubeCamera) {\n entry.cubeCamera.renderTarget = entry.target as unknown as THREE.WebGLCubeRenderTarget;\n }\n\n this.retire(resetLightShadow(entry.light), oldTargets);\n }\n\n // NOTE Old maps are disposed in the next update()\n retire(oldShadowNode: { dispose(): void } | null, targets: THREE.RenderTarget[]): void {\n this.retired.push(...targets);\n\n if (oldShadowNode) {\n this.retired.push(oldShadowNode);\n }\n }\n\n // NOTE Frees the maps of a light and puts back its own filter. Receivers build again without the volume shadow.\n freeEntry(entry: VDBFrameShadowEntry): void {\n const { light } = entry;\n const targets = entry.spectralTarget ? [entry.target, entry.spectralTarget] : [entry.target];\n const shadow = light.shadow as THREE.LightShadow & { filterNode?: VolumeFilter | null };\n\n // NOTE Receivers that still have the volume shadow node until they build again read no volume shadow\n entry.enabled.value = 0;\n\n if (shadow.filterNode?.isVDBFrameVolumeShadowFilter) {\n shadow.filterNode = entry.userFilter as VolumeFilter | null;\n }\n\n this.retire(resetLightShadow(light), targets);\n this.entries.delete(light);\n }\n\n disposeRetired(): void {\n this.retired.forEach((resource) => resource.dispose());\n this.retired.length = 0;\n }\n\n // NOTE Puts the volume filter on each shadow light. Each frame, then new lights and new filters are found.\n // Frees the entries of lights with no shadow or not in a scene, and all entries when castShadows is off.\n update(renderer: RendererLike, scene: THREE.Object3D): void {\n this.disposeRetired();\n\n if (!this.frameRenderer.settings.castShadows) {\n this.entries.forEach((entry) => this.freeEntry(entry));\n\n return;\n }\n\n // NOTE The light-shadow reset (three internal) is self-tested before the first filter goes on a light\n vdbFrameCheckLightReset();\n\n const size = this.getMapSize();\n const spectral = this.isSpectral();\n\n this.entries.forEach((entry) => {\n if (!isShadowLight(entry.light) || !isInScene(entry.light)) {\n this.freeEntry(entry);\n } else if (entry.size !== size || entry.spectral !== spectral) {\n this.resizeMap(renderer, entry, size, spectral);\n }\n });\n\n scene.traverse((light) => {\n if (isShadowLight(light)) {\n this.install(renderer, light);\n }\n });\n }\n\n install(renderer: RendererLike, light: ShadowLight): void {\n const shadow = light.shadow as THREE.LightShadow & { filterNode?: VolumeFilter | null; map: THREE.RenderTarget | null };\n\n if (shadow.filterNode?.isVDBFrameVolumeShadowFilter) {\n return;\n }\n\n const entry = this.getEntry(renderer, light);\n const userFilter = (shadow.filterNode as VolumeFilter | null | undefined) ?? null;\n const filters = vdbFrameShadowFilters();\n\n entry.userFilter = userFilter;\n\n // NOTE ShadowNode calls the filter when it builds. The base filter is three's or the user's.\n // Point lights give the direction from the light (bd3D), other lights give shadowCoord.\n const filter: VolumeFilter = (inputs) => {\n vdbFrameCheckFilterInputs(inputs, entry.isPoint);\n\n const type = renderer.shadowMap.type as number;\n const baseFilter = (userFilter ?? (entry.isPoint ? (type === THREE.BasicShadowMap ? filters.basicPoint : filters.point) : filters.maps[type])) as ((i: unknown) => N) | null;\n\n if (!baseFilter) {\n throw new Error(\"THREE.WebGPURenderer: Shadow map type not supported yet.\");\n }\n\n // NOTE PointShadowNode calls the filter in a TSL function, and its parameter proxy loses the shadow object.\n // So the base filter gets a plain object with the light shadow.\n const baseInputs: Record<string, unknown> = entry.isPoint\n ? { depthTexture: inputs.depthTexture, bd3D: inputs.bd3D, dp: inputs.dp, distance: inputs.distance }\n : { depthTexture: inputs.depthTexture, shadowCoord: inputs.shadowCoord, depthLayer: inputs.depthLayer };\n\n baseInputs.shadow = shadow;\n\n const uv = entry.isPoint ? inputs.bd3D : (inputs.shadowCoord as N).xy;\n\n return baseFilter(baseInputs).mul(new VDBFrameVolumeShadowNode(this, entry, uv));\n };\n\n filter.isVDBFrameVolumeShadowFilter = true;\n shadow.filterNode = filter;\n\n // NOTE The map exists when the shadow node was built before this filter\n if (shadow.map) {\n this.retire(resetLightShadow(light), []);\n }\n }\n\n // NOTE Spot lights: the light shadow camera. Point lights: a cube camera at the light. Sets the ray uniforms.\n prepareCamera(entry: VDBFrameShadowEntry): THREE.Camera {\n const { light, rayUniforms } = entry;\n const shadowCamera = light.shadow.camera as THREE.PerspectiveCamera;\n\n if (!entry.isPoint) {\n light.shadow.updateMatrices(light);\n\n rayUniforms.frameShadowOrigin.value.setFromMatrixPosition(shadowCamera.matrixWorld);\n shadowCamera.getWorldDirection(rayUniforms.frameShadowForward.value);\n rayUniforms.frameShadowPerspective.value = shadowCamera.isPerspectiveCamera ? 1 : 0;\n rayUniforms.frameShadowFar.value = shadowCamera.far;\n\n return shadowCamera;\n }\n\n const cubeCamera = entry.cubeCamera!;\n const near = shadowCamera.near;\n const far = (light as THREE.PointLight).distance || shadowCamera.far;\n\n for (const camera of cubeCamera.children as THREE.PerspectiveCamera[]) {\n if (camera.near !== near || camera.far !== far) {\n camera.near = near;\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n }\n\n cubeCamera.position.setFromMatrixPosition(light.matrixWorld);\n cubeCamera.updateMatrixWorld();\n\n rayUniforms.frameShadowOrigin.value.copy(cubeCamera.position);\n rayUniforms.frameShadowPerspective.value = 1;\n rayUniforms.frameShadowFar.value = far;\n\n return cubeCamera.children[0] as THREE.Camera;\n }\n\n // NOTE Cascade cameras of a directional light, the method of three's CSMShadowNode: practical split of the view\n // depth, a light-aligned orthographic camera for each slice, size from the slice diagonal, position snapped to\n // texels. The depth range of each camera covers the slice and the volume box (the last grid cascade). Cascades end\n // at the far corner of the volume box plus one box diagonal, up to castShadowDistance, rounded to half octaves.\n fitCascades(entry: VDBFrameShadowEntry, camera: THREE.Camera, renderer: RendererLike): number {\n const { light, size, rayUniforms } = entry;\n const cascades = entry.cascades!;\n const { settings, gridUniforms } = this.frameRenderer;\n const count = THREE.MathUtils.clamp(Math.round(settings.castShadowCascades), 1, frameMaxShadowMapCascades);\n const last = (gridUniforms.frameGridCount.value as number) - 1;\n const cam = camera as THREE.PerspectiveCamera;\n const near = cam.near;\n const gridMin = gridUniforms.frameGridMin.array as THREE.Vector3[];\n const gridSize = gridUniforms.frameGridSize.array as THREE.Vector3[];\n\n casterWorldBox.min.copy(gridMin[last]!);\n casterWorldBox.max.copy(gridMin[last]!).add(gridSize[last]!);\n\n let boxFar = 0.0;\n\n for (let i = 0; i < 8; i++) {\n point\n .set(i & 1 ? casterWorldBox.max.x : casterWorldBox.min.x, i & 2 ? casterWorldBox.max.y : casterWorldBox.min.y, i & 4 ? casterWorldBox.max.z : casterWorldBox.min.z)\n .applyMatrix4(camera.matrixWorldInverse);\n\n boxFar = Math.max(boxFar, -point.z);\n }\n\n const far = vdbFrameShadowCascadeFar(near, cam.far, settings.castShadowDistance, boxFar, casterWorldBox.getSize(point).length());\n const breaks = vdbFrameShadowCascadeBreaks(count, near, far);\n\n lightDirection.setFromMatrixPosition((light as THREE.DirectionalLight).target.matrixWorld).sub(point.setFromMatrixPosition(light.matrixWorld)).normalize();\n\n // NOTE Rotation of a camera that looks along the light (Object3D.lookAt of a camera). Up is +z for vertical light.\n lightUp.set(0.0, 1.0, 0.0);\n\n if (Math.abs(lightDirection.y) > 0.999) {\n lightUp.set(0.0, 0.0, 1.0);\n }\n\n lightView.lookAt(point.set(0.0, 0.0, 0.0), lightDirection, lightUp);\n lightViewInverse.copy(lightView).invert();\n\n casterBox.copy(casterWorldBox).applyMatrix4(lightViewInverse);\n\n entry.cascadeCount = count;\n entry.cascadeBreaks.set(breaks[Math.min(0, count - 1)]!, breaks[Math.min(1, count - 1)]!, breaks[Math.min(2, count - 1)]!, breaks[Math.min(3, count - 1)]!);\n\n for (let i = 0; i < count; i++) {\n const cascade = cascades[i]!;\n const cascadeCamera = cascade.camera;\n\n getSliceCorners(camera, i === 0 ? near : breaks[i - 1]!, breaks[i]!);\n\n const width = Math.max(farCorners[0]!.distanceTo(farCorners[2]!), farCorners[0]!.distanceTo(nearCorners[2]!));\n const texel = width / size;\n\n sliceBox.makeEmpty();\n for (const corner of [...nearCorners, ...farCorners]) {\n sliceBox.expandByPoint(point.copy(corner).applyMatrix4(lightViewInverse));\n }\n\n const centerX = Math.floor(((sliceBox.min.x + sliceBox.max.x) * 0.5) / texel) * texel;\n const centerY = Math.floor(((sliceBox.min.y + sliceBox.max.y) * 0.5) / texel) * texel;\n const front = Math.max(sliceBox.max.z, casterBox.max.z) + frameShadowCascadeMargin;\n const back = Math.min(sliceBox.min.z, casterBox.min.z) - frameShadowCascadeMargin;\n\n cascadeCamera.left = -width * 0.5;\n cascadeCamera.right = width * 0.5;\n cascadeCamera.top = width * 0.5;\n cascadeCamera.bottom = -width * 0.5;\n cascadeCamera.near = 0.0;\n cascadeCamera.far = front - back;\n cascadeCamera.coordinateSystem = renderer.coordinateSystem as THREE.CoordinateSystem;\n cascadeCamera.updateProjectionMatrix();\n\n // NOTE Light view looks along -z, so the camera is at the front (largest z)\n cascadeCamera.position.set(centerX, centerY, front).applyMatrix4(lightView);\n cascadeCamera.quaternion.setFromRotationMatrix(lightView);\n cascadeCamera.updateMatrixWorld();\n\n cascade.viewProjection.multiplyMatrices(cascadeCamera.projectionMatrix, cascadeCamera.matrixWorldInverse);\n cascade.origin.copy(cascadeCamera.position);\n cascade.far = cascadeCamera.far;\n }\n\n cascades[0]!.camera.getWorldDirection(rayUniforms.frameShadowForward.value);\n rayUniforms.frameShadowPerspective.value = 0;\n\n return count;\n }\n\n // NOTE Copies ray values to the uniforms of the pass material\n setPassRay(origin: THREE.Vector3, forward: THREE.Vector3, perspective: number, far: number): void {\n this.rayUniforms.frameShadowOrigin.value.copy(origin);\n this.rayUniforms.frameShadowForward.value.copy(forward);\n this.rayUniforms.frameShadowPerspective.value = perspective;\n this.rayUniforms.frameShadowFar.value = far;\n }\n\n // NOTE Draws the pass into the map of the entry: one tile of it (viewport), or all cube faces (point lights)\n drawPass(renderer: RendererLike, entry: VDBFrameShadowEntry, camera: THREE.Camera, viewport: THREE.Vector4): void {\n const currentRenderTarget = renderer.getRenderTarget();\n const currentActiveCubeFace = renderer.getActiveCubeFace();\n const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n const currentAutoClear = renderer.autoClear;\n const currentClearAlpha = renderer.getClearAlpha();\n const currentScissorTest = renderer.getScissorTest();\n\n renderer.getClearColor(clearColor);\n renderer.autoClear = false;\n renderer.setScissorTest(false);\n this.mesh.layers.mask = camera.layers.mask;\n\n // NOTE Spectral: the second draw writes the optical depth of each channel into the second map\n const targets = entry.spectralTarget ? [entry.target, entry.spectralTarget] : [entry.target];\n\n targets.forEach((target, output) => {\n this.material.frameShadowOutput.value = output;\n\n if (entry.isPoint) {\n const cubeCamera = entry.cubeCamera!;\n\n cubeCamera.renderTarget = target as unknown as THREE.WebGLCubeRenderTarget;\n cubeCamera.update(renderer as never, this.scene);\n } else {\n target.viewport.copy(viewport);\n renderer.setRenderTarget(target);\n renderer.render(this.scene, camera);\n }\n });\n\n if (entry.isPoint) {\n entry.cubeCamera!.renderTarget = entry.target as unknown as THREE.WebGLCubeRenderTarget;\n }\n\n renderer.setScissorTest(currentScissorTest);\n renderer.autoClear = currentAutoClear;\n renderer.setClearColor(clearColor, currentClearAlpha);\n renderer.setRenderTarget(currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel);\n }\n\n // NOTE Adds the changed map pieces of one light to the work list\n collectWork(entry: VDBFrameShadowEntry, camera: THREE.Camera, renderer: RendererLike, work: WorkPiece[]): void {\n const castVersion = this.frameRenderer.gridState.castVersion;\n const steps = this.getSteps();\n const { drawn, rayUniforms } = entry;\n\n if (entry.cascades) {\n const cascades = entry.cascades;\n const count = this.fitCascades(entry, camera, renderer);\n const forward = rayUniforms.frameShadowForward.value as THREE.Vector3;\n\n const drawCascade = (i: number) => {\n const cascade = cascades[i]!;\n\n this.setPassRay(cascade.origin, forward, 0, cascade.far);\n this.drawPass(renderer, entry, cascade.camera, tileViewport.set(i * entry.size, 0, entry.size, entry.size));\n cascade.drawn.viewProjection.copy(cascade.viewProjection);\n cascade.drawn.origin.copy(cascade.origin);\n cascade.drawn.far = cascade.far;\n cascade.lastDraw = this.renderCount;\n drawn.forward.copy(forward);\n };\n\n const cascadeChanged = (i: number) => {\n const cascade = cascades[i]!;\n\n signature.length = 0;\n signature.push(entry.size, castVersion, steps, ...cascade.camera.matrixWorld.elements);\n signature.push(...cascade.camera.projectionMatrix.elements);\n\n return changed(cascade);\n };\n\n // NOTE A new split layout: one piece draws all cascades, then the receivers switch to the layout.\n // Receivers never mix tiles of two layouts.\n signature.length = 0;\n signature.push(entry.size, count, ...entry.cascadeBreaks.toArray());\n\n if (changed(entry.item)) {\n for (let i = 0; i < count; i++) {\n cascadeChanged(i);\n }\n\n work.push({\n item: entry.item,\n cost: count,\n draw: () => {\n for (let i = 0; i < count; i++) {\n drawCascade(i);\n }\n\n drawn.cascadeCount = count;\n drawn.cascadeBreaks.copy(entry.cascadeBreaks);\n },\n });\n\n return;\n }\n\n for (let i = 0; i < count; i++) {\n if (cascadeChanged(i)) {\n work.push({ item: cascades[i]!, cost: 1, draw: () => drawCascade(i) });\n }\n }\n\n return;\n }\n\n const shadowCamera = this.prepareCamera(entry);\n\n signature.length = 0;\n signature.push(entry.size, castVersion, steps, ...(entry.isPoint ? entry.cubeCamera! : shadowCamera).matrixWorld.elements);\n signature.push(...(shadowCamera as THREE.PerspectiveCamera).projectionMatrix.elements);\n\n if (!changed(entry.item)) {\n return;\n }\n\n work.push({\n item: entry.item,\n // NOTE All six cube faces in one draw, then the faces always match\n cost: entry.isPoint ? 6 : 1,\n draw: () => {\n this.setPassRay(rayUniforms.frameShadowOrigin.value, rayUniforms.frameShadowForward.value, rayUniforms.frameShadowPerspective.value, rayUniforms.frameShadowFar.value);\n this.drawPass(renderer, entry, shadowCamera, tileViewport.set(0, 0, entry.size, entry.size));\n drawn.origin.copy(rayUniforms.frameShadowOrigin.value);\n drawn.forward.copy(rayUniforms.frameShadowForward.value);\n drawn.perspective = rayUniforms.frameShadowPerspective.value;\n drawn.far = rayUniforms.frameShadowFar.value;\n },\n });\n }\n\n // NOTE Volume shadow maps of all lights, one time in each render, before the first receiver.\n // Changed pieces are drawn oldest first, up to castShadowUpdatesPerFrame (a tile or spot map costs 1, a cube map 6).\n // The oldest piece is always drawn. Then a large piece does not wait forever.\n updateMaps(renderer: RendererLike, scene: THREE.Scene, camera: THREE.Camera, renderId: number): void {\n if (this.mapsRenderId === renderId && this.mapsCamera === camera) {\n return;\n }\n\n this.mapsRenderId = renderId;\n this.mapsCamera = camera;\n this.renderCount++;\n this.lastUpdate.drawn = 0;\n this.lastUpdate.waiting = 0;\n\n const { frameRenderer } = this;\n const ready = frameRenderer.settings.castShadows && !!renderer.isWebGPURenderer && frameRenderer.prepareShadowGrid(renderer, scene, camera, renderId);\n\n if (!ready) {\n this.entries.forEach((entry) => {\n entry.enabled.value = 0;\n entry.item.signature.length = 0;\n entry.cascades?.forEach((cascade) => (cascade.signature.length = 0));\n });\n\n return;\n }\n\n this.material.setSpectral(this.isSpectral());\n this.material.frameShadowDensityMap.value = frameRenderer.shadowDensityTarget!.textures[0];\n this.material.frameShadowSteps.value = this.getSteps();\n\n const work: WorkPiece[] = [];\n\n this.entries.forEach((entry) => {\n const active = entry.light.castShadow && isVisible(entry.light);\n\n entry.enabled.value = active ? 1 : 0;\n\n if (active) {\n this.collectWork(entry, camera, renderer, work);\n }\n });\n\n work.sort((a, b) => a.item.lastDraw - b.item.lastDraw);\n\n let budget = Math.max(1, Math.round(frameRenderer.settings.castShadowUpdatesPerFrame));\n\n frameRenderer.passHook?.begin?.(\"volumeShadows\");\n\n work.forEach((piece, index) => {\n if (index > 0 && piece.cost > budget) {\n // NOTE Not drawn: the next check sees the change again\n piece.item.signature.length = 0;\n this.lastUpdate.waiting++;\n\n return;\n }\n\n piece.draw();\n piece.item.lastDraw = this.renderCount;\n budget -= piece.cost;\n this.lastUpdate.drawn++;\n });\n\n frameRenderer.passHook?.end?.(\"volumeShadows\");\n }\n\n // NOTE Called by the receivers of a light, one time in each render\n render(renderer: RendererLike, scene: THREE.Scene, camera: THREE.Camera, renderId: number, entry: VDBFrameShadowEntry): void {\n if (entry.renderId === renderId) {\n return;\n }\n\n entry.renderId = renderId;\n this.updateMaps(renderer, scene, camera, renderId);\n }\n\n // NOTE Puts back the filter of each light. Then a new VDBFrameVolumeShadows installs again.\n dispose(): void {\n if (this.entries.size > 0) {\n this.entries.forEach((entry) => this.freeEntry(entry));\n }\n\n this.disposeRetired();\n this.material.dispose();\n this.mesh.geometry.dispose();\n }\n}\n"]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the
|
|
3
|
+
* frame. Its props are his (same names and defaults) for the ported subset; density is read only
|
|
4
|
+
* through the source's nodes (`vdbVolumeNodes`), so Step 2 swaps in the sparse source.
|
|
5
|
+
*
|
|
6
|
+
* const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));
|
|
7
|
+
* const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)
|
|
8
|
+
* scene.add(volume); // then renderer.render(scene, camera) as usual
|
|
9
|
+
* volume.frameRenderer.settings.multipleScattering = false;
|
|
10
|
+
* volume.setMedium("fog"); // a measured medium: albedo, spectrum, the renderer's phase
|
|
11
|
+
*
|
|
12
|
+
* The phase (K5.9): the renderer's `settings.phase*` is the phase of every volume it draws. `'frame'`
|
|
13
|
+
* lighting lights all volumes in one pass with it; in `'volume'` lighting (each volume marches its own
|
|
14
|
+
* light) a volume's own `phase*` props, when set, override it for that volume. The source (dense or
|
|
15
|
+
* sparse), its kind and its LOD are fixed at construction: make a new source and a new volume to change
|
|
16
|
+
* them (`source.replace` swaps a dense frame of the same channels; the volume follows it by itself). A sparse
|
|
17
|
+
* source made with `followImage` follows a `pool.replace` of its grid (a coarse-first swap), box included (G16a).
|
|
18
|
+
*/
|
|
19
|
+
import * as THREE from "three";
|
|
20
|
+
import type { VDBThreeVolumeSource, VDBVolumeNodesOptions, VDBVolumeUniforms } from "../volume-source.js";
|
|
21
|
+
import type { VDBFrameDensityMaterial } from "./density-material.js";
|
|
22
|
+
import type { VDBFrameInjectMaterial } from "./inject-material.js";
|
|
23
|
+
import type { VDBFrameShadowDensityMaterial } from "./shadow-density-material.js";
|
|
24
|
+
import type { VDBFrameEmissionDirectionMaterial } from "./emission-light.js";
|
|
25
|
+
import type { VDBFramePhase, VDBFramePhaseSource } from "./phase.js";
|
|
26
|
+
import { type VDBFrameMediumVolumeProps } from "./medium.js";
|
|
27
|
+
import { type VDBFrameRenderer } from "./renderer.js";
|
|
28
|
+
import type { FrameVolumeRecord } from "./view.js";
|
|
29
|
+
/** Props of {@link VDBFrameVolume}: his `FrameVolume` props (names and defaults) for the ported subset. */
|
|
30
|
+
export interface VDBFrameVolumeProps {
|
|
31
|
+
/**
|
|
32
|
+
* The froxel renderer (default: the shared {@link vdbFrameRenderer}). Its `settings` apply to every
|
|
33
|
+
* volume that uses it; pass your own `new VDBFrameRenderer()` (or `vdbFrameRenderer(threeRenderer)`)
|
|
34
|
+
* for separate settings.
|
|
35
|
+
*/
|
|
36
|
+
frameRenderer?: VDBFrameRenderer;
|
|
37
|
+
/**
|
|
38
|
+
* Box of the volume in its local space (default: the source's box: the `.wvdb` bbox or the sparse grid's world
|
|
39
|
+
* box; else the unit box at the origin). Read back as {@link VDBFrameVolume.bbox}.
|
|
40
|
+
*/
|
|
41
|
+
bbox?: THREE.Box3 | [[number, number, number], [number, number, number]];
|
|
42
|
+
baseColor?: THREE.ColorRepresentation;
|
|
43
|
+
scatterColor?: THREE.ColorRepresentation;
|
|
44
|
+
/** With normalizeDensity: optical depth of the longest box side at the mean density (default 100). */
|
|
45
|
+
extinction?: number;
|
|
46
|
+
/** Extinction scale of each channel (renderer `settings.spectral`; with `angstromExponent`, spectrum.ts). */
|
|
47
|
+
extinctionScale?: [number, number, number] | THREE.Vector3Like;
|
|
48
|
+
/** Ångström exponent of the extinction spectrum: a number or a name of `frameAngstromExponents` (default 'cloud': 0, grey). */
|
|
49
|
+
angstromExponent?: string | number;
|
|
50
|
+
/**
|
|
51
|
+
* `'volume'` lighting only: this volume's phase, overriding the renderer's `settings.phase` (default: unset, the
|
|
52
|
+
* renderer's). `'frame'` lighting always uses the renderer's (one lighting pass for all volumes). The same for
|
|
53
|
+
* `phaseG`, `phaseBackG`, `phaseBackWeight` and `phaseGExponent`, field by field.
|
|
54
|
+
*/
|
|
55
|
+
phase?: VDBFramePhase | null;
|
|
56
|
+
phaseG?: number | null;
|
|
57
|
+
phaseBackG?: number | null;
|
|
58
|
+
phaseBackWeight?: number | null;
|
|
59
|
+
phaseGExponent?: number | null;
|
|
60
|
+
densityScale?: number;
|
|
61
|
+
normalizeDensity?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The mean density `normalizeDensity` divides by (default: unset, the source's `stats.meanNonZero`, which follows
|
|
64
|
+
* `source.replace`). Set one value for a sequence so every frame has the same extinction scale: his sequences divide
|
|
65
|
+
* by the mean of all frames' non-zero texels (`FrameVolume.getDensityScale`).
|
|
66
|
+
*/
|
|
67
|
+
densityMean?: number | null;
|
|
68
|
+
densityCutoff?: number;
|
|
69
|
+
absorbance?: number;
|
|
70
|
+
opacity?: number;
|
|
71
|
+
emissiveIntensity?: number;
|
|
72
|
+
/** Kelvin at emission values 0 and 1. */
|
|
73
|
+
temperatureRange?: [number, number];
|
|
74
|
+
offset3D?: THREE.Vector3Like;
|
|
75
|
+
wrap3D?: THREE.Wrapping;
|
|
76
|
+
/** Light types bitmask ({@link vdbFrameLights}); default all. */
|
|
77
|
+
lights?: number;
|
|
78
|
+
shadowSteps?: number;
|
|
79
|
+
/** Sample the source's mip levels (default true; needs a source with a mip atlas). */
|
|
80
|
+
mipmaps?: boolean;
|
|
81
|
+
/** Emission colour hook (DIVERGES V24); default white. */
|
|
82
|
+
emissionColor?: VDBVolumeNodesOptions["emissionColor"];
|
|
83
|
+
/**
|
|
84
|
+
* HDDA empty-space skipping in the shadow march (sparse sources; K3.2). Skipped samples are exactly
|
|
85
|
+
* 0, so the image does not change (within float noise); dense sources ignore it. Default false (D30: on the Apple GPU it
|
|
86
|
+
* slowed the shadow march 1.07–3.31× in all 12 paired runs, +7 to +26 ms per frame; owner rule D29 was "on
|
|
87
|
+
* unless the cost is large"). Timings in docs/archive/handoffs/K3-2a.md.
|
|
88
|
+
*/
|
|
89
|
+
hdda?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export declare class VDBFrameVolume extends THREE.Group {
|
|
92
|
+
readonly isVDBFrameVolume: true;
|
|
93
|
+
readonly source: VDBThreeVolumeSource;
|
|
94
|
+
readonly sourceUniforms: VDBVolumeUniforms;
|
|
95
|
+
readonly frameRenderer: VDBFrameRenderer;
|
|
96
|
+
readonly proxy: THREE.Mesh<THREE.InstancedBufferGeometry>;
|
|
97
|
+
readonly volumes: FrameVolumeRecord[];
|
|
98
|
+
/** Built by the renderer on first use (the source is compiled into it). */
|
|
99
|
+
injectMaterial: VDBFrameInjectMaterial | null;
|
|
100
|
+
/** 'frame' lighting: the density and shadow density materials, built by the renderer on first use (K3.3). */
|
|
101
|
+
densityMaterial: VDBFrameDensityMaterial | null;
|
|
102
|
+
shadowDensityMaterial: VDBFrameShadowDensityMaterial | null;
|
|
103
|
+
/** K3.6: the emission light's direction-pass material of this volume (made by the light on first use). */
|
|
104
|
+
emissionDirectionMaterial: VDBFrameEmissionDirectionMaterial | null;
|
|
105
|
+
readonly emissionColor: VDBVolumeNodesOptions["emissionColor"];
|
|
106
|
+
baseColor: THREE.Color;
|
|
107
|
+
scatterColor: THREE.Color;
|
|
108
|
+
extinction: number;
|
|
109
|
+
extinctionScale: THREE.Vector3;
|
|
110
|
+
angstromExponent: string | number;
|
|
111
|
+
/** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */
|
|
112
|
+
phase: VDBFramePhase | null;
|
|
113
|
+
phaseG: number | null;
|
|
114
|
+
phaseBackG: number | null;
|
|
115
|
+
phaseBackWeight: number | null;
|
|
116
|
+
phaseGExponent: number | null;
|
|
117
|
+
densityScale: number;
|
|
118
|
+
normalizeDensity: boolean;
|
|
119
|
+
/** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */
|
|
120
|
+
densityMean: number | null;
|
|
121
|
+
densityCutoff: number;
|
|
122
|
+
absorbance: number;
|
|
123
|
+
opacity: number;
|
|
124
|
+
emissiveIntensity: number;
|
|
125
|
+
temperatureRange: THREE.Vector2;
|
|
126
|
+
offset3D: THREE.Vector3;
|
|
127
|
+
wrap3D: THREE.Wrapping;
|
|
128
|
+
lights: number;
|
|
129
|
+
shadowSteps: number;
|
|
130
|
+
mipmaps: boolean;
|
|
131
|
+
hdda: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The volume's box in its local space: the `bbox` prop, else the source's box, re-read
|
|
134
|
+
* when the source's `version` moves: a dense frame with another `.wvdb` box (a sequence frame; RV, as his WVDB sequences)
|
|
135
|
+
* or a sparse source made with `followImage` after its grid's image changed (G16a, e.g. a coarse-first
|
|
136
|
+
* swap), so this object is updated in place then. Do not mutate.
|
|
137
|
+
*/
|
|
138
|
+
readonly bbox: THREE.Box3;
|
|
139
|
+
/** The medium fields at construction, for `setMedium(null)`. */
|
|
140
|
+
private readonly initialMedium;
|
|
141
|
+
/** `source.version` the uniforms were last updated for. */
|
|
142
|
+
private sourceVersion;
|
|
143
|
+
/** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */
|
|
144
|
+
private readonly boxFromSource;
|
|
145
|
+
private readonly resolvedPhase;
|
|
146
|
+
constructor(source: VDBThreeVolumeSource, props?: VDBFrameVolumeProps);
|
|
147
|
+
/** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */
|
|
148
|
+
get meanDensity(): number;
|
|
149
|
+
/** The phase this volume is drawn with in `'volume'` lighting: its own `phase*` fields where set, else the renderer's `settings` (a reused object). */
|
|
150
|
+
getPhase(): Readonly<VDBFramePhaseSource>;
|
|
151
|
+
/**
|
|
152
|
+
* A measured medium in one call (`'cloud'`, `'fog'`, `'ice'`, `'soot'`, `'white-smoke'`, `'dark-smoke'`, `'haze'`,
|
|
153
|
+
* `'dust'`, or {@link VDBFrameMediumVolumeProps} from `vdbFrameMedium`), as his GUI's 'Medium' field: the volume's
|
|
154
|
+
* `baseColor`, `extinctionScale` and `angstromExponent`; the phase on the renderer (`frameRenderer.settings.phase`,
|
|
155
|
+
* `phaseG`, `phaseGExponent`: the phase of 'frame' lighting and the default of 'volume' lighting; the volume's own
|
|
156
|
+
* phase overrides are cleared) and `settings.spectral` on. The renderer's settings are shared by every volume it
|
|
157
|
+
* draws. `null` restores the volume's constructor colour, extinction scale and Ångström exponent (the renderer is left
|
|
158
|
+
* as it is). Returns the props applied (null for `null`); an unknown name throws `VDB_BAD_OPTION`.
|
|
159
|
+
*/
|
|
160
|
+
setMedium(medium: string | VDBFrameMediumVolumeProps | null): VDBFrameMediumVolumeProps | null;
|
|
161
|
+
/** densityScale for the shaders. normalizeDensity divides it by the mean density. */
|
|
162
|
+
getDensityScale(): number;
|
|
163
|
+
/**
|
|
164
|
+
* Re-read the source (textures, sizes, LOD levels). The renderer calls {@link VDBFrameVolume.syncSource} before
|
|
165
|
+
* every draw, so a `source.replace()` needs no call; this forces it.
|
|
166
|
+
*/
|
|
167
|
+
updateSource(): void;
|
|
168
|
+
/** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per draw. */
|
|
169
|
+
syncSource(): void;
|
|
170
|
+
/** Frees the proxy geometry and the pass materials, and stops following the source (its uniforms). The source belongs to the caller. */
|
|
171
|
+
dispose(): void;
|
|
172
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/core/FrameVolume.js L8–11 (render order, all lights), L152–270 (props,
|
|
3
|
+
// proxy), L339–353 (box matrix), L554–568 (getDensityScale), L624–650 (dispose).
|
|
4
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
5
|
+
// Changes: TypeScript; takes a VDBVolumeSource (dense `.wvdb`, or the sparse pool since K3.2) instead of resampling grids
|
|
6
|
+
// on the CPU (his L279–552: conversion, progressive upload, level sets, points, instances); one
|
|
7
|
+
// volume per frame volume; the mean density is the source's. Divergences: DIVERGES.md (K3.1 rows),
|
|
8
|
+
// V23–V25.
|
|
9
|
+
/**
|
|
10
|
+
* A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the
|
|
11
|
+
* frame. Its props are his (same names and defaults) for the ported subset; density is read only
|
|
12
|
+
* through the source's nodes (`vdbVolumeNodes`), so Step 2 swaps in the sparse source.
|
|
13
|
+
*
|
|
14
|
+
* const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));
|
|
15
|
+
* const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)
|
|
16
|
+
* scene.add(volume); // then renderer.render(scene, camera) as usual
|
|
17
|
+
* volume.frameRenderer.settings.multipleScattering = false;
|
|
18
|
+
* volume.setMedium("fog"); // a measured medium: albedo, spectrum, the renderer's phase
|
|
19
|
+
*
|
|
20
|
+
* The phase (K5.9): the renderer's `settings.phase*` is the phase of every volume it draws. `'frame'`
|
|
21
|
+
* lighting lights all volumes in one pass with it; in `'volume'` lighting (each volume marches its own
|
|
22
|
+
* light) a volume's own `phase*` props, when set, override it for that volume. The source (dense or
|
|
23
|
+
* sparse), its kind and its LOD are fixed at construction: make a new source and a new volume to change
|
|
24
|
+
* them (`source.replace` swaps a dense frame of the same channels; the volume follows it by itself). A sparse
|
|
25
|
+
* source made with `followImage` follows a `pool.replace` of its grid (a coarse-first swap), box included (G16a).
|
|
26
|
+
*/
|
|
27
|
+
import * as THREE from "three";
|
|
28
|
+
import { VDBError } from "../../core/errors.js";
|
|
29
|
+
import { vdbVolumeUniforms } from "../volume-source.js";
|
|
30
|
+
import { vdbFrameAllLights } from "./lights.js";
|
|
31
|
+
import { getFrameMediumProps } from "./medium.js";
|
|
32
|
+
import { vdbFrameRenderer } from "./renderer.js";
|
|
33
|
+
// NOTE Draw the frame after all other transparent objects
|
|
34
|
+
const frameRenderOrder = 1000000;
|
|
35
|
+
const toBox = (bbox, source) => {
|
|
36
|
+
if (bbox instanceof THREE.Box3)
|
|
37
|
+
return bbox.clone();
|
|
38
|
+
const b = bbox ?? (source.kind === "dense" ? source.volume.bbox : source.bbox);
|
|
39
|
+
if (!b)
|
|
40
|
+
return new THREE.Box3(new THREE.Vector3(-0.5, -0.5, -0.5), new THREE.Vector3(0.5, 0.5, 0.5));
|
|
41
|
+
return new THREE.Box3(new THREE.Vector3(...b[0]), new THREE.Vector3(...b[1]));
|
|
42
|
+
};
|
|
43
|
+
/** FrameVolume.js L339–353: the volume box as a matrix of the unit box (into `target`). */
|
|
44
|
+
const boxMatrix = (box, target) => {
|
|
45
|
+
const center = box.getCenter(new THREE.Vector3());
|
|
46
|
+
const size = box.getSize(new THREE.Vector3()).max(new THREE.Vector3(1e-6, 1e-6, 1e-6));
|
|
47
|
+
return target.compose(center, new THREE.Quaternion(), size);
|
|
48
|
+
};
|
|
49
|
+
export class VDBFrameVolume extends THREE.Group {
|
|
50
|
+
isVDBFrameVolume = true;
|
|
51
|
+
source;
|
|
52
|
+
sourceUniforms;
|
|
53
|
+
frameRenderer;
|
|
54
|
+
proxy;
|
|
55
|
+
volumes;
|
|
56
|
+
/** Built by the renderer on first use (the source is compiled into it). */
|
|
57
|
+
injectMaterial = null;
|
|
58
|
+
/** 'frame' lighting: the density and shadow density materials, built by the renderer on first use (K3.3). */
|
|
59
|
+
densityMaterial = null;
|
|
60
|
+
shadowDensityMaterial = null;
|
|
61
|
+
/** K3.6: the emission light's direction-pass material of this volume (made by the light on first use). */
|
|
62
|
+
emissionDirectionMaterial = null;
|
|
63
|
+
emissionColor;
|
|
64
|
+
baseColor;
|
|
65
|
+
scatterColor;
|
|
66
|
+
extinction;
|
|
67
|
+
extinctionScale;
|
|
68
|
+
angstromExponent;
|
|
69
|
+
/** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */
|
|
70
|
+
phase;
|
|
71
|
+
phaseG;
|
|
72
|
+
phaseBackG;
|
|
73
|
+
phaseBackWeight;
|
|
74
|
+
phaseGExponent;
|
|
75
|
+
densityScale;
|
|
76
|
+
normalizeDensity;
|
|
77
|
+
/** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */
|
|
78
|
+
densityMean;
|
|
79
|
+
densityCutoff;
|
|
80
|
+
absorbance;
|
|
81
|
+
opacity;
|
|
82
|
+
emissiveIntensity;
|
|
83
|
+
temperatureRange;
|
|
84
|
+
offset3D;
|
|
85
|
+
wrap3D;
|
|
86
|
+
lights;
|
|
87
|
+
shadowSteps;
|
|
88
|
+
mipmaps;
|
|
89
|
+
hdda;
|
|
90
|
+
/**
|
|
91
|
+
* The volume's box in its local space: the `bbox` prop, else the source's box, re-read
|
|
92
|
+
* when the source's `version` moves: a dense frame with another `.wvdb` box (a sequence frame; RV, as his WVDB sequences)
|
|
93
|
+
* or a sparse source made with `followImage` after its grid's image changed (G16a, e.g. a coarse-first
|
|
94
|
+
* swap), so this object is updated in place then. Do not mutate.
|
|
95
|
+
*/
|
|
96
|
+
bbox;
|
|
97
|
+
/** The medium fields at construction, for `setMedium(null)`. */
|
|
98
|
+
initialMedium;
|
|
99
|
+
/** `source.version` the uniforms were last updated for. */
|
|
100
|
+
sourceVersion;
|
|
101
|
+
/** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */
|
|
102
|
+
boxFromSource;
|
|
103
|
+
resolvedPhase = { phase: "henyey-greenstein", phaseG: 0.8, phaseBackG: -0.3, phaseBackWeight: 0.2, phaseGExponent: 0.0 };
|
|
104
|
+
constructor(source, props = {}) {
|
|
105
|
+
super();
|
|
106
|
+
const ok = source && ((source.kind === "dense" && !!source.textures?.density) || (source.kind === "sparse" && typeof source.createNodes === "function"));
|
|
107
|
+
if (!ok) {
|
|
108
|
+
throw new VDBError("VDB_BAD_OPTION", "VDBFrameVolume: pass a volume source from vdbDenseTextures() or vdbSparseSource() (@pmndrs/vdb/three).");
|
|
109
|
+
}
|
|
110
|
+
const { frameRenderer = vdbFrameRenderer(), bbox, baseColor = 0xffffff, scatterColor = 0x000000, extinction = 100.0, extinctionScale = [1.0, 1.0, 1.0], angstromExponent = "cloud", phase = null, phaseG = null, phaseBackG = null, phaseBackWeight = null, phaseGExponent = null, densityScale = 1.0, normalizeDensity = true, densityMean = null, densityCutoff = 0.0, absorbance = 1.0, opacity = 1.0, emissiveIntensity = 1.0, temperatureRange = [0.0, 6500.0], offset3D = new THREE.Vector3(), wrap3D = THREE.ClampToEdgeWrapping, lights = vdbFrameAllLights, shadowSteps = 32, mipmaps = true, emissionColor, hdda = false, } = props;
|
|
111
|
+
this.source = source;
|
|
112
|
+
this.frameRenderer = frameRenderer;
|
|
113
|
+
this.emissionColor = emissionColor;
|
|
114
|
+
this.baseColor = new THREE.Color(baseColor);
|
|
115
|
+
this.scatterColor = new THREE.Color(scatterColor);
|
|
116
|
+
this.extinction = extinction;
|
|
117
|
+
this.extinctionScale = Array.isArray(extinctionScale) ? new THREE.Vector3().fromArray(extinctionScale) : new THREE.Vector3().copy(extinctionScale);
|
|
118
|
+
this.angstromExponent = angstromExponent;
|
|
119
|
+
this.phase = phase;
|
|
120
|
+
this.phaseG = phaseG;
|
|
121
|
+
this.phaseBackG = phaseBackG;
|
|
122
|
+
this.phaseBackWeight = phaseBackWeight;
|
|
123
|
+
this.phaseGExponent = phaseGExponent;
|
|
124
|
+
this.densityScale = densityScale;
|
|
125
|
+
this.normalizeDensity = normalizeDensity;
|
|
126
|
+
this.densityMean = densityMean;
|
|
127
|
+
this.densityCutoff = densityCutoff;
|
|
128
|
+
this.absorbance = absorbance;
|
|
129
|
+
this.opacity = opacity;
|
|
130
|
+
this.emissiveIntensity = emissiveIntensity;
|
|
131
|
+
this.temperatureRange = new THREE.Vector2().fromArray(temperatureRange);
|
|
132
|
+
this.offset3D = new THREE.Vector3().copy(offset3D);
|
|
133
|
+
this.wrap3D = wrap3D;
|
|
134
|
+
this.lights = lights;
|
|
135
|
+
this.shadowSteps = shadowSteps;
|
|
136
|
+
this.mipmaps = mipmaps;
|
|
137
|
+
this.hdda = hdda;
|
|
138
|
+
this.initialMedium = { baseColor: this.baseColor.clone(), extinctionScale: this.extinctionScale.clone(), angstromExponent };
|
|
139
|
+
this.sourceUniforms = vdbVolumeUniforms(source, { extinction, densityScale, normalizeDensity });
|
|
140
|
+
this.sourceVersion = source.version;
|
|
141
|
+
this.proxy = new THREE.Mesh(frameRenderer.createProxyGeometry(), frameRenderer.integrateMaterial);
|
|
142
|
+
this.proxy.frustumCulled = false;
|
|
143
|
+
this.proxy.renderOrder = frameRenderOrder;
|
|
144
|
+
this.proxy.onBeforeRender = (renderer, scene, camera) => {
|
|
145
|
+
frameRenderer.render(renderer, scene, camera, this.proxy);
|
|
146
|
+
};
|
|
147
|
+
this.add(this.proxy);
|
|
148
|
+
// FrameVolume.js L339–353: the volume box as a matrix of the unit box.
|
|
149
|
+
const box = toBox(bbox, source);
|
|
150
|
+
this.bbox = box;
|
|
151
|
+
this.boxFromSource = bbox === undefined;
|
|
152
|
+
this.volumes = [
|
|
153
|
+
{
|
|
154
|
+
matrix: boxMatrix(box, new THREE.Matrix4()),
|
|
155
|
+
matrixWorld: new THREE.Matrix4(),
|
|
156
|
+
localToView: new THREE.Matrix4(),
|
|
157
|
+
viewToLocal: new THREE.Matrix4(),
|
|
158
|
+
worldToLocal: new THREE.Matrix4(),
|
|
159
|
+
worldBox: new THREE.Box3(),
|
|
160
|
+
viewNear: 0.0,
|
|
161
|
+
viewFar: 0.0,
|
|
162
|
+
ready: true,
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
/** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */
|
|
167
|
+
get meanDensity() {
|
|
168
|
+
return this.densityMean ?? this.source.stats.meanNonZero;
|
|
169
|
+
}
|
|
170
|
+
/** The phase this volume is drawn with in `'volume'` lighting: its own `phase*` fields where set, else the renderer's `settings` (a reused object). */
|
|
171
|
+
getPhase() {
|
|
172
|
+
const s = this.frameRenderer.settings;
|
|
173
|
+
const p = this.resolvedPhase;
|
|
174
|
+
p.phase = this.phase ?? s.phase;
|
|
175
|
+
p.phaseG = this.phaseG ?? s.phaseG;
|
|
176
|
+
p.phaseBackG = this.phaseBackG ?? s.phaseBackG;
|
|
177
|
+
p.phaseBackWeight = this.phaseBackWeight ?? s.phaseBackWeight;
|
|
178
|
+
p.phaseGExponent = this.phaseGExponent ?? s.phaseGExponent;
|
|
179
|
+
return p;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A measured medium in one call (`'cloud'`, `'fog'`, `'ice'`, `'soot'`, `'white-smoke'`, `'dark-smoke'`, `'haze'`,
|
|
183
|
+
* `'dust'`, or {@link VDBFrameMediumVolumeProps} from `vdbFrameMedium`), as his GUI's 'Medium' field: the volume's
|
|
184
|
+
* `baseColor`, `extinctionScale` and `angstromExponent`; the phase on the renderer (`frameRenderer.settings.phase`,
|
|
185
|
+
* `phaseG`, `phaseGExponent`: the phase of 'frame' lighting and the default of 'volume' lighting; the volume's own
|
|
186
|
+
* phase overrides are cleared) and `settings.spectral` on. The renderer's settings are shared by every volume it
|
|
187
|
+
* draws. `null` restores the volume's constructor colour, extinction scale and Ångström exponent (the renderer is left
|
|
188
|
+
* as it is). Returns the props applied (null for `null`); an unknown name throws `VDB_BAD_OPTION`.
|
|
189
|
+
*/
|
|
190
|
+
setMedium(medium) {
|
|
191
|
+
if (medium === null) {
|
|
192
|
+
this.baseColor.copy(this.initialMedium.baseColor);
|
|
193
|
+
this.extinctionScale.copy(this.initialMedium.extinctionScale);
|
|
194
|
+
this.angstromExponent = this.initialMedium.angstromExponent;
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const props = typeof medium === "string" ? getFrameMediumProps(medium) : medium;
|
|
198
|
+
if (!props)
|
|
199
|
+
throw new VDBError("VDB_BAD_OPTION", `VDBFrameVolume.setMedium: unknown medium ${JSON.stringify(medium)}; use one of vdbFrameMediumNames (@pmndrs/vdb/tools).`);
|
|
200
|
+
this.baseColor.copy(props.baseColor);
|
|
201
|
+
this.extinctionScale.copy(props.extinctionScale);
|
|
202
|
+
this.angstromExponent = props.angstromExponent;
|
|
203
|
+
this.phase = this.phaseG = this.phaseBackG = this.phaseBackWeight = this.phaseGExponent = null;
|
|
204
|
+
const s = this.frameRenderer.settings;
|
|
205
|
+
s.phase = props.phase;
|
|
206
|
+
s.phaseG = props.phaseG;
|
|
207
|
+
s.phaseGExponent = props.phaseGExponent;
|
|
208
|
+
s.spectral = true;
|
|
209
|
+
return props;
|
|
210
|
+
}
|
|
211
|
+
/** densityScale for the shaders. normalizeDensity divides it by the mean density. */
|
|
212
|
+
getDensityScale() {
|
|
213
|
+
const meanDensity = this.meanDensity;
|
|
214
|
+
return this.normalizeDensity && meanDensity > 0.0 ? this.densityScale / meanDensity : this.densityScale;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Re-read the source (textures, sizes, LOD levels). The renderer calls {@link VDBFrameVolume.syncSource} before
|
|
218
|
+
* every draw, so a `source.replace()` needs no call; this forces it.
|
|
219
|
+
*/
|
|
220
|
+
updateSource() {
|
|
221
|
+
this.sourceVersion = this.source.version;
|
|
222
|
+
this.sourceUniforms.update(this.source, { densityScale: this.densityScale, normalizeDensity: this.normalizeDensity });
|
|
223
|
+
// G16a: a sparse source's box (a followImage source re-reads it after an image change). RV: a dense frame's
|
|
224
|
+
// .wvdb box (his WVDB sequences give every frame its own box; a null box, an empty frame, keeps the last one).
|
|
225
|
+
const sourceBox = this.source.kind === "sparse" ? this.source.bbox : this.source.volume.bbox;
|
|
226
|
+
if (this.boxFromSource && sourceBox) {
|
|
227
|
+
const [min, max] = sourceBox;
|
|
228
|
+
const b = this.bbox;
|
|
229
|
+
if (b.min.x !== min[0] || b.min.y !== min[1] || b.min.z !== min[2] || b.max.x !== max[0] || b.max.y !== max[1] || b.max.z !== max[2]) {
|
|
230
|
+
b.min.set(...min);
|
|
231
|
+
b.max.set(...max);
|
|
232
|
+
for (const volume of this.volumes)
|
|
233
|
+
boxMatrix(b, volume.matrix);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per draw. */
|
|
238
|
+
syncSource() {
|
|
239
|
+
if (this.source.version !== this.sourceVersion)
|
|
240
|
+
this.updateSource();
|
|
241
|
+
}
|
|
242
|
+
/** Frees the proxy geometry and the pass materials, and stops following the source (its uniforms). The source belongs to the caller. */
|
|
243
|
+
dispose() {
|
|
244
|
+
this.sourceUniforms.dispose();
|
|
245
|
+
this.injectMaterial?.dispose();
|
|
246
|
+
this.injectMaterial = null;
|
|
247
|
+
this.densityMaterial?.dispose();
|
|
248
|
+
this.densityMaterial = null;
|
|
249
|
+
this.shadowDensityMaterial?.dispose();
|
|
250
|
+
this.shadowDensityMaterial = null;
|
|
251
|
+
this.emissionDirectionMaterial?.dispose();
|
|
252
|
+
this.emissionDirectionMaterial = null;
|
|
253
|
+
this.proxy.geometry.dispose();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=volume.js.map
|