@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":"emission-light.js","sourceRoot":"","sources":["../../../src/three/frame/emission-light.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6GAA6G;AAC7G,iHAAiH;AACjH,+GAA+G;AAC/G,mDAAmD;AACnD,4GAA4G;AAC5G,kHAAkH;AAClH,kHAAkH;AAClH,kHAAkH;AAClH,mGAAmG;AACnG,8GAA8G;AAC9G,6GAA6G;AAE7G;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAiF,MAAM,qBAAqB,CAAC;AACpI,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,cAAc,EAAE,qBAAqB,EAAE,SAAS,EAA+C,MAAM,aAAa,CAAC;AACxK,OAAO,EACL,yBAAyB,IAAI,YAAY,EACzC,sBAAsB,IAAI,SAAS,EACnC,uBAAuB,IAAI,cAAc,EACzC,wBAAwB,IAAI,WAAW,EACvC,wBAAwB,IAAI,WAAW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AG,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAE7B,KAAK,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACvD,KAAK,CAAC,QAAQ,CAAC,CAAC,CAA4B,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpE,CAAC;IACH,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/core/FrameEmissionLight.js L1–287 (FrameEmissionLightBase: emitters, keys, probe\n// cascades, prepareProbes); src/three-openvdb/frame/webgpu/FrameEmissionLight.js L59–658 (probe grid uniforms,\n// the direction / reduce / probe pass materials, FrameEmissionLightNode, FrameEmissionLight: targets, slots,\n// updateProbes, dispose, the node registration).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; one class (his CPU base and WebGPU subclass merged); the direction pass reads each emitter\n// through its own volume source (one direction material per source, as the other passes, DIVERGES V30) instead of\n// one material that swaps 3D textures; no CPU mip step (the sources hold their LOD); the pass materials belong to\n// the light (his are shared by all lights and never freed); the probe cascade maths is engine-free\n// (`@pmndrs/vdb/tools` `vdbFrameEmissionProbeGrid`, with twins of every pass); every three r187 internal goes\n// through `three-internals.ts` (VDB_ENGINE_MISMATCH on another three). Divergences: DIVERGES.md (K3.6 rows).\n\n/**\n * K3.6: light from the emissive grids of every visible `VDBFrameVolume` (his `FrameEmissionLight`). Add one to the\n * scene; three's lit node materials (`MeshStandardMaterial`, `MeshLambertMaterial`, …) receive it as irradiance, like a\n * light probe. Per changed volume: its emitted light along 16 directions × 8² rays (direction pass), the mean and the\n * luminance-weighted centre (reduce pass); then L1 irradiance probes of all volumes as point lights, in up to 4\n * cascades of ≤ 32³ (probe pass). A lit pixel reads 6 texels (12 near a cascade side), for any number of volumes.\n * The passes run before the first lit mesh of each render and only when a volume or the cascades changed.\n *\n * const light = new VDBFrameEmissionLight({ intensity: 25, resolution: 32 });\n * scene.add(light); // volumes need an emission channel; colour: VDBFrameVolume `emissionColor`\n */\n\nimport * as THREE from \"three\";\nimport { AnalyticLightNode, NodeMaterial } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport { vdbVolumeNodes, type VDBThreeVolumeSource, type VDBVolumeNodesOptions, type VDBVolumeUniforms } from \"../volume-source.js\";\nimport { createFrameVolumeUniforms, createGridNodes, frameFragCoord, frameFullscreenVertex, frameLoad, type FrameVolumeUniforms, type GridUniforms } from \"./chunks.js\";\nimport {\n frameEmissionAtlasColumns as atlasColumns,\n frameEmissionAtlasSize as atlasSize,\n frameEmissionDirections as directionCount,\n frameEmissionGoldenAngle as goldenAngle,\n frameEmissionMaxCascades as maxCascades,\n frameEmissionRays as rayCount,\n vdbFrameEmissionProbeGrid,\n vdbFrameEmitterBounds,\n} from \"../../tools/frame/emission.js\";\nimport { setVolumeUniforms } from \"./renderer.js\";\nimport { vdbFramePrecompiling, vdbFrameRegisterLightNode, vdbFrameRenderUpdateType, vdbFrameRendererUtils } from \"./three-internals.js\";\nimport type { VDBFrameVolume } from \"./volume.js\";\nimport type { FrameVolumeRecord } from \"./view.js\";\nimport type { Vec3 } from \"../../tools/frame/index.js\";\n\nconst { Discard, Fn, If, Loop, Break, abs, clamp, cos, cross, dot, exp, float, floor, int, inverseSqrt, ivec2, luminance, max, min, mix, normalWorld, normalize, outputStruct, positionGeometry, positionWorld, property, renderGroup, select, sin, smoothstep, sqrt, texture, uniform, uniformArray, vec3, vec4 } =\n TSL as unknown as Record<string, VDBTslNode>;\n\ntype N = VDBTslNode;\ntype RendererLike = { render(scene: THREE.Object3D, camera: THREE.Camera): void; setRenderTarget(t: THREE.RenderTarget | null): void; autoClear: boolean };\n\n// NOTE Probe cascades in the uniform names of createGridNodes. Cascade 0 is the finest.\nconst createProbeGridUniforms = (group: N | null = null) => {\n const nodes = {\n frameGridMin: uniformArray(\n Array.from({ length: maxCascades }, () => new THREE.Vector3()),\n \"vec3\",\n ),\n frameGridSize: uniformArray(\n Array.from({ length: maxCascades }, () => new THREE.Vector3(1.0, 1.0, 1.0)),\n \"vec3\",\n ),\n frameGridCount: uniform(0, \"int\"),\n frameGridResolution: uniform(1.0),\n frameGridColumns: uniform(atlasColumns),\n frameGridAtlasSize: uniform(new THREE.Vector2(atlasSize, atlasSize)),\n };\n\n if (group) {\n Object.values(nodes).forEach((node) => node.setGroup(group));\n }\n\n return nodes as unknown as GridUniforms;\n};\n\nconst setProbeGridUniforms = (uniforms: GridUniforms, light: VDBFrameEmissionLight) => {\n const min = uniforms.frameGridMin.array as THREE.Vector3[];\n const size = uniforms.frameGridSize.array as THREE.Vector3[];\n\n for (let i = 0; i < maxCascades; i++) {\n min[i]!.copy(light.cascadeMin[i]!);\n size[i]!.copy(light.cascadeSize[i]!);\n }\n\n uniforms.frameGridCount.value = light.cascadeCount;\n uniforms.frameGridResolution.value = light.probeResolution;\n};\n\nconst fullscreenPositions = [-1, -1, 0, 3, -1, 0, -1, 3, 0];\nconst quadPositions = [-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0];\n\nconst createGeometry = (positions: number[]) => {\n const geometry = new THREE.BufferGeometry();\n geometry.setAttribute(\"position\", new THREE.Float32BufferAttribute(positions, 3));\n\n return geometry;\n};\n\nconst createTarget = (count: number, type: THREE.TextureDataType, filter: THREE.MinificationTextureFilter & THREE.MagnificationTextureFilter, width = 1, height = 1) =>\n new THREE.RenderTarget(width, height, {\n count,\n type,\n format: THREE.RGBAFormat,\n minFilter: filter,\n magFilter: filter,\n generateMipmaps: false,\n depthBuffer: false,\n });\n\nconst setPassMaterial = (material: THREE.Material) => {\n material.side = THREE.DoubleSide;\n material.depthTest = false;\n material.depthWrite = false;\n material.blending = THREE.NoBlending;\n};\n\n/**\n * Light that one volume sends in each of 16 directions: one texel per direction, one row per volume (slot). Parallel\n * rays cover the bounding sphere; each adds the emission with the volume's transmittance. Output 0: intensity\n * (emission × ray area) and the radius. Output 1: the luminance-weighted world position. One material per volume\n * source (the source is compiled in). Twin: `vdbFrameEmissionDirectionTexel`.\n */\nexport class VDBFrameEmissionDirectionMaterial extends NodeMaterial {\n readonly volumeUniforms: FrameVolumeUniforms = createFrameVolumeUniforms();\n readonly sourceUniforms: VDBVolumeUniforms;\n readonly source: VDBThreeVolumeSource;\n readonly emissionColor: VDBVolumeNodesOptions[\"emissionColor\"];\n readonly frameSlot = uniform(0.0);\n readonly frameTargetSize = uniform(new THREE.Vector2(directionCount, 1.0));\n readonly frameEmitterCenter = uniform(new THREE.Vector3());\n readonly frameEmitterRadius = uniform(1.0);\n readonly frameSteps = uniform(24, \"int\");\n mipmaps: boolean;\n\n constructor(o: { source: VDBThreeVolumeSource; sourceUniforms: VDBVolumeUniforms; mipmaps: boolean; emissionColor?: VDBVolumeNodesOptions[\"emissionColor\"] }) {\n super();\n\n this.name = \"VDBFrameEmissionDirectionMaterial\";\n this.source = o.source;\n this.sourceUniforms = o.sourceUniforms;\n this.mipmaps = o.mipmaps;\n this.emissionColor = o.emissionColor;\n this.buildNodes();\n\n setPassMaterial(this);\n }\n\n setMipmaps(mipmaps: boolean): void {\n if (mipmaps !== this.mipmaps) {\n this.mipmaps = mipmaps;\n this.buildNodes();\n this.needsUpdate = true;\n }\n }\n\n buildNodes(): void {\n const volume = vdbVolumeNodes(this.source, this.sourceUniforms, { useMipmaps: this.mipmaps, ...(this.emissionColor ? { emissionColor: this.emissionColor } : {}) });\n const { frameWorldToLocal, frameAbsorbance } = this.volumeUniforms;\n const frameWorldScale = this.sourceUniforms.worldScale;\n const { frameSlot, frameTargetSize, frameEmitterCenter, frameEmitterRadius, frameSteps } = this;\n\n const outputIntensity = property(\"vec4\");\n const outputCenter = property(\"vec4\");\n\n // NOTE The quad covers the row of the slot\n this.vertexNode = vec4(positionGeometry.x, frameSlot.add(positionGeometry.y.mul(0.5).add(0.5)).div(frameTargetSize.y).mul(2.0).sub(1.0), 0.0, 1.0);\n\n this.colorNode = Fn(() => {\n const index = floor(frameFragCoord(frameTargetSize).x).toVar();\n\n // NOTE Fibonacci sphere direction, from the volume to the viewer\n const y = float(1.0).sub(index.mul(2.0).add(1.0).div(directionCount)).toVar();\n const ring = sqrt(max(0.0, float(1.0).sub(y.mul(y))));\n const phi = index.mul(goldenAngle);\n const direction = vec3(cos(phi).mul(ring), y, sin(phi).mul(ring)).toVar();\n const helper = select(abs(direction.y).lessThan(0.999), vec3(0.0, 1.0, 0.0), vec3(1.0, 0.0, 0.0));\n const tangent = normalize(cross(helper, direction)).toVar();\n const bitangent = cross(direction, tangent).toVar();\n\n const diameter = frameEmitterRadius.mul(2.0).toVar();\n const spacing = diameter.div(rayCount).toVar();\n const stepCount = float(frameSteps).toVar();\n const intensity = vec3(0.0).toVar();\n const center = vec4(0.0).toVar();\n\n Loop({ start: int(0), end: int(rayCount * rayCount), type: \"int\", condition: \"<\", name: \"r\" }, ({ r }: { r: N }) => {\n const u = float(r.mod(int(rayCount))).add(0.5).div(rayCount).mul(2.0).sub(1.0);\n const v = float(r.div(int(rayCount))).add(0.5).div(rayCount).mul(2.0).sub(1.0);\n const worldStart = frameEmitterCenter.add(direction.mul(frameEmitterRadius)).add(tangent.mul(u.mul(frameEmitterRadius))).add(bitangent.mul(v.mul(frameEmitterRadius))).toVar();\n const worldEnd = worldStart.sub(direction.mul(diameter)).toVar();\n const localStart = frameWorldToLocal.mul(vec4(worldStart, 1.0)).xyz.toVar();\n const localEnd = frameWorldToLocal.mul(vec4(worldEnd, 1.0)).xyz.toVar();\n const segment = volume.boxSegment(localStart, localEnd).toVar();\n\n If(segment.x.lessThan(segment.y), () => {\n const segmentLength = segment.y.sub(segment.x).toVar();\n const stepLength = segmentLength.mul(diameter).div(stepCount).toVar();\n // NOTE Smoke uses the mip level of the step. Emission uses level 0: power grows with temperature^4, mipmaps lose it.\n const lod = volume.getLod(stepLength.div(frameWorldScale)).toVar();\n const transmittance = float(1.0).toVar();\n\n Loop({ start: int(0), end: frameSteps, type: \"int\", condition: \"<\", name: \"s\" }, ({ s }: { s: N }) => {\n const t = segment.x.add(segmentLength.mul(float(s).add(0.5).div(stepCount))).toVar();\n const localPosition = mix(localStart, localEnd, t).toVar();\n const extinction = volume.sampleExtinction(localPosition, lod).toVar();\n\n If(extinction.greaterThan(0.0), () => {\n // NOTE Absorbance scales the shadow of the volume, the same as for scene lights\n const alpha = float(1.0).sub(exp(extinction.mul(stepLength).negate()));\n const radiance = volume.sampleEmission(localPosition, float(0.0)).mul(transmittance.mul(alpha)).toVar();\n\n intensity.addAssign(radiance);\n center.addAssign(vec4(mix(worldStart, worldEnd, t), 1.0).mul(luminance(radiance)));\n transmittance.mulAssign(exp(extinction.mul(frameAbsorbance).mul(stepLength).negate()));\n\n If(transmittance.lessThan(0.01), () => {\n Break();\n });\n });\n });\n });\n });\n\n const area = spacing.mul(spacing);\n\n outputIntensity.assign(vec4(intensity.mul(area), frameEmitterRadius));\n outputCenter.assign(center.mul(area));\n\n return vec4(0.0);\n })();\n\n this.outputNode = outputStruct(outputIntensity, outputCenter);\n }\n}\n\n/** One texel per volume: the mean intensity of all directions, and the centre of the visible emission. Twin: `vdbFrameEmissionReduce`. */\nexport class VDBFrameEmissionReduceMaterial extends NodeMaterial {\n readonly frameTargetSize = uniform(new THREE.Vector2(1.0, 1.0));\n readonly frameDirectionSize = uniform(new THREE.Vector2(directionCount, 1.0));\n readonly frameDirectionIntensity = texture(new THREE.Texture());\n readonly frameDirectionCenter = texture(new THREE.Texture());\n\n constructor() {\n super();\n\n this.name = \"VDBFrameEmissionReduceMaterial\";\n\n const outputIntensity = property(\"vec4\");\n const outputCenter = property(\"vec4\");\n\n this.vertexNode = frameFullscreenVertex;\n\n this.colorNode = Fn(() => {\n const row = int(floor(frameFragCoord(this.frameTargetSize).y)).toVar();\n const intensity = vec4(0.0).toVar();\n const center = vec4(0.0).toVar();\n\n Loop(directionCount, ({ i }: { i: N }) => {\n const texel = ivec2(i, row);\n\n intensity.addAssign(frameLoad(this.frameDirectionIntensity, texel, this.frameDirectionSize));\n center.addAssign(frameLoad(this.frameDirectionCenter, texel, this.frameDirectionSize));\n });\n\n const visible = center.w.greaterThan(0.0);\n\n outputIntensity.assign(intensity.div(directionCount));\n outputCenter.assign(select(visible, vec4(center.xyz.div(max(center.w, 1e-12)), 1.0), vec4(0.0)));\n\n return vec4(0.0);\n })();\n\n this.outputNode = outputStruct(outputIntensity, outputCenter);\n\n setPassMaterial(this);\n }\n}\n\n/**\n * L1 irradiance of all volumes at each probe, E(n) = x + dot(yzw, n) per colour channel: each volume is a point light\n * at its emission centre, its radius softening the distance near it. Twin: `vdbFrameEmissionProbe`.\n */\nexport class VDBFrameEmissionProbeMaterial extends NodeMaterial {\n readonly gridUniforms = createProbeGridUniforms();\n readonly frameEmitterCount = uniform(0, \"int\");\n readonly frameEmitterSize = uniform(new THREE.Vector2(1.0, 1.0));\n readonly frameEmitterIntensity = texture(new THREE.Texture());\n readonly frameEmitterCenter = texture(new THREE.Texture());\n\n constructor() {\n super();\n\n this.name = \"VDBFrameEmissionProbeMaterial\";\n\n const outputRed = property(\"vec4\");\n const outputGreen = property(\"vec4\");\n const outputBlue = property(\"vec4\");\n\n const grid = createGridNodes(this.gridUniforms);\n const { frameGridMin, frameGridSize, frameGridCount, frameGridResolution, frameGridAtlasSize } = this.gridUniforms;\n\n this.vertexNode = frameFullscreenVertex;\n\n this.colorNode = Fn(() => {\n const fragCoord = frameFragCoord(frameGridAtlasSize).toVar();\n\n // NOTE Tiles right of the atlas columns are not used. Smaller grids leave them empty.\n If(fragCoord.x.greaterThanEqual(frameGridResolution.mul(atlasColumns)), () => {\n Discard();\n });\n\n const cell = grid.getGridCell(fragCoord);\n\n If(cell.cascade.greaterThanEqual(frameGridCount), () => {\n Discard();\n });\n\n const probe = frameGridMin.element(cell.cascade).add(cell.gridUvw.mul(frameGridSize.element(cell.cascade))).toVar();\n\n const constant = vec3(0.0).toVar();\n const directionRed = vec3(0.0).toVar();\n const directionGreen = vec3(0.0).toVar();\n const directionBlue = vec3(0.0).toVar();\n\n Loop(this.frameEmitterCount, ({ i }: { i: N }) => {\n const texel = ivec2(int(0), i);\n const center = frameLoad(this.frameEmitterCenter, texel, this.frameEmitterSize).toVar();\n\n If(center.w.greaterThan(0.0), () => {\n const emitter = frameLoad(this.frameEmitterIntensity, texel, this.frameEmitterSize).toVar();\n const toProbe = probe.sub(center.xyz).toVar();\n const distanceSquared = dot(toProbe, toProbe).toVar();\n const soft = emitter.w.mul(0.25);\n const softDistanceSquared = distanceSquared.add(soft.mul(soft)).toVar();\n const irradiance = emitter.rgb.div(softDistanceSquared).toVar();\n\n // NOTE L1 projection of a point light: E(n) = E / 4 + E / 2 * dot(l, n). The direction fades near the centre.\n const toLight = toProbe.mul(inverseSqrt(max(distanceSquared, 1e-12))).mul(distanceSquared.div(softDistanceSquared).mul(-0.5)).toVar();\n\n constant.addAssign(irradiance.mul(0.25));\n directionRed.addAssign(toLight.mul(irradiance.r));\n directionGreen.addAssign(toLight.mul(irradiance.g));\n directionBlue.addAssign(toLight.mul(irradiance.b));\n });\n });\n\n outputRed.assign(vec4(constant.r, directionRed));\n outputGreen.assign(vec4(constant.g, directionGreen));\n outputBlue.assign(vec4(constant.b, directionBlue));\n\n return vec4(0.0);\n })();\n\n this.outputNode = outputStruct(outputRed, outputGreen, outputBlue);\n\n setPassMaterial(this);\n }\n}\n\n/**\n * The irradiance at a lit point from the finest probe cascade that contains it; near a cascade side the next one\n * blends in (as the shadow grid); past the last cascade its clamped edge probes fall off with distance squared.\n */\nexport class VDBFrameEmissionLightNode extends AnalyticLightNode<THREE.Light> {\n static get type(): string {\n return \"VDBFrameEmissionLightNode\";\n }\n\n readonly probeMaps: N[];\n readonly gridUniforms: GridUniforms;\n readonly probeCenter: N;\n readonly probeActive: N;\n\n constructor(light: VDBFrameEmissionLight | null = null) {\n super(light as never);\n\n // NOTE The passes run before the first lit mesh of each render, as shadow maps\n const render = vdbFrameRenderUpdateType();\n (this as unknown as { updateType: string; updateBeforeType: string }).updateType = render;\n (this as unknown as { updateType: string; updateBeforeType: string }).updateBeforeType = render;\n\n const maps = light ? light.probeTarget.textures : [new THREE.Texture(), new THREE.Texture(), new THREE.Texture()];\n\n this.probeMaps = maps.map((map) => texture(map));\n\n // NOTE Render group, as three's lights: lit materials without node changes update only shared uniforms\n this.gridUniforms = createProbeGridUniforms(renderGroup);\n this.probeCenter = uniform(new THREE.Vector3()).setGroup(renderGroup);\n this.probeActive = uniform(0.0).setGroup(renderGroup);\n }\n\n private get emissionLight(): VDBFrameEmissionLight {\n return (this as unknown as { light: VDBFrameEmissionLight }).light;\n }\n\n override updateBefore(frame: never): boolean | undefined {\n const { renderer, scene, camera } = frame as { renderer: object; scene: THREE.Scene; camera: THREE.Camera };\n\n // NOTE No passes while three precompiles materials (compileAsync), as shadow maps\n if (vdbFramePrecompiling(renderer)) {\n return undefined;\n }\n\n this.emissionLight.updateProbes(renderer as unknown as RendererLike, scene, camera);\n\n return undefined;\n }\n\n override update(frame: never): boolean | undefined {\n super.update(frame);\n\n const light = this.emissionLight;\n\n setProbeGridUniforms(this.gridUniforms, light);\n this.probeCenter.value.copy(light.probeCenter);\n this.probeActive.value = light.emitterCount > 0 ? 1.0 : 0.0;\n\n return undefined;\n }\n\n override setup(builder: never): null {\n const grid = createGridNodes(this.gridUniforms);\n const { frameGridMin, frameGridSize, frameGridCount, frameGridResolution } = this.gridUniforms;\n const { probeCenter, probeActive } = this;\n const [redMap, greenMap, blueMap] = this.probeMaps;\n\n const irradiance = Fn(() => {\n const position = positionWorld.toVar();\n const red = vec4(0.0).toVar();\n const green = vec4(0.0).toVar();\n const blue = vec4(0.0).toVar();\n const falloff = float(1.0).toVar();\n\n const sampleProbes = (cascade: N, uvw: N, weight: N) => {\n red.assign(mix(red, grid.sampleGrid(redMap, cascade, uvw), weight));\n green.assign(mix(green, grid.sampleGrid(greenMap, cascade, uvw), weight));\n blue.assign(mix(blue, grid.sampleGrid(blueMap, cascade, uvw), weight));\n };\n\n If(frameGridCount.greaterThan(0), () => {\n const cascade = grid.findCascade(position, int(0)).toVar();\n\n If(cascade.greaterThanEqual(0), () => {\n const uvw = grid.gridUvw(cascade, position).toVar();\n\n sampleProbes(cascade, uvw, float(1.0));\n\n const sideDistance = min(uvw, vec3(1.0).sub(uvw));\n const blend = float(1.0).sub(smoothstep(0.0, 0.1, min(sideDistance.x, min(sideDistance.y, sideDistance.z)))).toVar();\n\n If(blend.greaterThan(0.0), () => {\n const nextCascade = grid.findCascade(position, cascade.add(1)).toVar();\n\n If(nextCascade.greaterThanEqual(0), () => {\n sampleProbes(nextCascade, grid.gridUvw(nextCascade, position), blend);\n });\n });\n }).Else(() => {\n const lastCascade = frameGridCount.sub(1).toVar();\n const inset = float(0.5).div(frameGridResolution);\n const uvw = clamp(grid.gridUvw(lastCascade, position), vec3(inset), vec3(float(1.0).sub(inset))).toVar();\n const toEdge = frameGridMin.element(lastCascade).add(uvw.mul(frameGridSize.element(lastCascade))).sub(probeCenter);\n const toPoint = position.sub(probeCenter);\n\n sampleProbes(lastCascade, uvw, float(1.0));\n falloff.assign(min(1.0, dot(toEdge, toEdge).div(max(dot(toPoint, toPoint), 1e-6))));\n });\n });\n\n const normal = normalWorld;\n\n return max(vec3(red.x.add(dot(red.yzw, normal)), green.x.add(dot(green.yzw, normal)), blue.x.add(dot(blue.yzw, normal))), vec3(0.0)).mul(falloff.mul(probeActive));\n })();\n\n const b = builder as unknown as { context: { irradiance: N } };\n const colorNode = (this as unknown as { colorNode: N }).colorNode;\n\n b.context.irradiance.addAssign(colorNode.mul(irradiance));\n\n return null;\n }\n}\n\n/** Props of {@link VDBFrameEmissionLight} (his `FrameEmissionLight` props; same names and defaults). */\nexport interface VDBFrameEmissionLightProps {\n color?: THREE.ColorRepresentation;\n intensity?: number;\n /** Probes on each axis of each cascade, 2–32 (default 16). */\n resolution?: number;\n /** Size of the last cascade as a multiple of the box of all emitting volumes; past it light falls off with distance² (default 3). */\n range?: number;\n /** 1: one grid for all volumes. Up to 4: finer grids around the camera (default 1). */\n cascades?: number;\n /** The finer cascades cover this distance from the camera (default 512). */\n distance?: number;\n /** Steps of each ray in a volume (default 24). */\n steps?: number;\n}\n\n/** One emitting volume of the current render (his `createEmitter`; the record `setVolumeUniforms` reads). */\ninterface Emitter extends FrameVolumeRecord {\n frameVolume: VDBFrameVolume | null;\n key: string;\n center: THREE.Vector3;\n radius: number;\n}\n\nconst unitBox = new THREE.Box3(new THREE.Vector3(-0.5, -0.5, -0.5), new THREE.Vector3(0.5, 0.5, 0.5));\nconst cameraPosition = new THREE.Vector3();\n\nconst createEmitter = (): Emitter => ({\n frameVolume: null,\n key: \"\",\n matrix: new THREE.Matrix4(),\n matrixWorld: new THREE.Matrix4(),\n worldToLocal: new THREE.Matrix4(),\n localToView: new THREE.Matrix4(),\n viewToLocal: new THREE.Matrix4(),\n worldBox: new THREE.Box3(),\n viewNear: 0,\n viewFar: 0,\n ready: true,\n center: new THREE.Vector3(),\n radius: 0.0,\n});\n\n// NOTE An id for each source object (the emitter key: a new source or a replaced grid draws again)\nconst sourceIds = new WeakMap<object, number>();\nlet nextSourceId = 1;\n\nconst sourceKey = (frameVolume: VDBFrameVolume): string => {\n const source = frameVolume.source as unknown as { version?: number; lod?: string; lodLevels: number; textures?: Record<string, { map: THREE.Texture; mip: THREE.Texture | null } | null> };\n let id = sourceIds.get(source);\n\n if (id === undefined) {\n id = nextSourceId++;\n sourceIds.set(source, id);\n }\n\n const values: (number | string)[] = [id, source.version ?? -1, source.lodLevels, source.lod ?? \"-\"];\n\n if (source.textures) {\n for (const name of [\"density\", \"mask\", \"emission\"]) {\n const t = source.textures[name];\n\n values.push(t ? `${t.map.id}.${t.map.version}` : \"-\", t?.mip ? `${t.mip.id}.${t.mip.version}` : \"-\");\n }\n }\n\n // NOTE The colour hook's runtime value (vdbFrameBlackbodyEmission: the soot exponent)\n const hook = frameVolume.emissionColor as unknown as { sootExponent?: { value: number } } | undefined;\n\n values.push(hook?.sootExponent ? hook.sootExponent.value : \"-\");\n\n return values.join(\":\");\n};\n\n/** One registration of the light node class (internal 4), checked at the first construction. */\nlet registered = false;\n\nexport class VDBFrameEmissionLight extends THREE.Light {\n readonly isVDBFrameEmissionLight = true as const;\n\n resolution: number;\n range: number;\n cascades: number;\n distance: number;\n steps: number;\n\n readonly cascadeMin = Array.from({ length: maxCascades }, () => new THREE.Vector3());\n readonly cascadeSize = Array.from({ length: maxCascades }, () => new THREE.Vector3(1.0, 1.0, 1.0));\n cascadeCount = 0;\n probeResolution = 2;\n readonly probeCenter = new THREE.Vector3();\n\n emitters: Emitter[] = [];\n emitterCount = 0;\n slotKeys: string[] = [];\n slotCount = 0;\n probeKey = \"\";\n\n // NOTE Float targets for the volumes: intensities in world units do not overflow\n directionTarget = createTarget(2, THREE.FloatType, THREE.NearestFilter);\n emitterTarget = createTarget(2, THREE.FloatType, THREE.NearestFilter);\n // NOTE The probe atlas has the size for the largest grid and all cascades: lit materials keep its binding\n readonly probeTarget = createTarget(3, THREE.HalfFloatType, THREE.LinearFilter, atlasSize, atlasSize);\n\n // NOTE One draw for each changed volume, in one render\n readonly directionScene = new THREE.Scene();\n directionPool: THREE.Mesh[] = [];\n readonly reduceMaterial = new VDBFrameEmissionReduceMaterial();\n readonly probeMaterial = new VDBFrameEmissionProbeMaterial();\n readonly reduceScene: THREE.Scene;\n readonly probeScene: THREE.Scene;\n // NOTE WebGPURenderer calls updateProjectionMatrix() on the camera\n readonly passCamera = new THREE.OrthographicCamera();\n // NOTE RendererUtils fills this object\n rendererState: object = {};\n /** Volumes drawn in the last probe update and whether the probes were drawn (not his; tests and timing). */\n readonly lastUpdate = { directions: 0, probes: false };\n\n constructor(props: VDBFrameEmissionLightProps = {}) {\n const { color = 0xffffff, intensity = 1.0, resolution = 16, range = 3.0, cascades = 1, distance = 512, steps = 24 } = props;\n\n super(color, intensity);\n\n if (!registered) {\n vdbFrameRegisterLightNode(VDBFrameEmissionLight as unknown as typeof THREE.Light, VDBFrameEmissionLightNode);\n registered = true;\n }\n\n (this as { type: string }).type = \"VDBFrameEmissionLight\";\n this.resolution = resolution;\n this.range = range;\n this.cascades = cascades;\n this.distance = distance;\n this.steps = steps;\n\n this.directionScene.matrixWorldAutoUpdate = false;\n\n const createPassScene = (material: THREE.Material) => {\n const scene = new THREE.Scene();\n const mesh = new THREE.Mesh(createGeometry(fullscreenPositions), material);\n\n mesh.frustumCulled = false;\n scene.matrixWorldAutoUpdate = false;\n scene.add(mesh);\n\n return scene;\n };\n\n this.reduceScene = createPassScene(this.reduceMaterial);\n this.probeScene = createPassScene(this.probeMaterial);\n }\n\n getSteps(): number {\n return Math.max(1, Math.round(this.steps));\n }\n\n /** The direction-pass material of a volume (its source compiled in), made on first use. */\n getDirectionMaterial(frameVolume: VDBFrameVolume): VDBFrameEmissionDirectionMaterial {\n const mipmaps = frameVolume.mipmaps && frameVolume.source.lodLevels > 0;\n let material = frameVolume.emissionDirectionMaterial;\n\n if (!material) {\n material = new VDBFrameEmissionDirectionMaterial({ source: frameVolume.source, sourceUniforms: frameVolume.sourceUniforms, mipmaps, ...(frameVolume.emissionColor ? { emissionColor: frameVolume.emissionColor } : {}) });\n frameVolume.emissionDirectionMaterial = material;\n }\n\n material.setMipmaps(mipmaps);\n\n return material;\n }\n\n // NOTE Emissive volumes of the scene (visible, with an emission channel)\n collectEmitters(scene: THREE.Object3D): void {\n let count = 0;\n const steps = this.getSteps();\n\n scene.traverseVisible((object) => {\n const frameVolume = object as VDBFrameVolume;\n\n if (!frameVolume.isVDBFrameVolume || !frameVolume.source.channels.emission) {\n return;\n }\n\n for (const volume of frameVolume.volumes) {\n if (!volume.ready) {\n continue;\n }\n\n if (!this.emitters[count]) {\n this.emitters[count] = createEmitter();\n }\n\n const emitter = this.emitters[count++]!;\n\n emitter.frameVolume = frameVolume;\n emitter.matrixWorld.multiplyMatrices(frameVolume.matrixWorld, volume.matrix);\n emitter.worldToLocal.copy(emitter.matrixWorld).invert();\n emitter.worldBox.copy(unitBox).applyMatrix4(emitter.matrixWorld);\n\n const bounds = vdbFrameEmitterBounds(emitter.matrixWorld.elements);\n\n emitter.center.fromArray(bounds.center);\n emitter.radius = bounds.radius;\n emitter.key = [\n sourceKey(frameVolume),\n frameVolume.extinction,\n frameVolume.getDensityScale(),\n frameVolume.densityCutoff,\n frameVolume.absorbance,\n frameVolume.emissiveIntensity,\n frameVolume.temperatureRange.x,\n frameVolume.temperatureRange.y,\n frameVolume.offset3D.x,\n frameVolume.offset3D.y,\n frameVolume.offset3D.z,\n frameVolume.wrap3D,\n frameVolume.mipmaps,\n steps,\n ...emitter.matrixWorld.elements,\n ].join(\",\");\n }\n });\n\n this.emitterCount = count;\n }\n\n // NOTE The probe cascades (tools/frame/emission.ts). Returns a key that changes with them.\n updateProbeGrid(camera: THREE.Camera): string {\n cameraPosition.setFromMatrixPosition(camera.matrixWorld);\n\n const boxes = this.emitters.slice(0, this.emitterCount).map((e) => ({ min: e.worldBox.min.toArray() as Vec3, max: e.worldBox.max.toArray() as Vec3 }));\n const grid = vdbFrameEmissionProbeGrid({ resolution: this.resolution, range: this.range, cascades: this.cascades, distance: this.distance }, boxes, cameraPosition.toArray() as Vec3);\n\n this.probeResolution = grid.resolution;\n this.probeCenter.fromArray(grid.center);\n\n for (let i = 0; i < grid.count; i++) {\n this.cascadeMin[i]!.fromArray(grid.min[i]!);\n this.cascadeSize[i]!.fromArray(grid.size[i]!);\n }\n\n this.cascadeCount = grid.count;\n\n return grid.key;\n }\n\n // NOTE The changed volumes as { emitter, slot }, or null when the probes stay the same.\n // Slots grow to the next power of two. New targets are empty, so all volumes draw again.\n prepareProbes(scene: THREE.Object3D, camera: THREE.Camera): { emitter: Emitter; slot: number }[] | null {\n this.collectEmitters(scene);\n\n if (this.emitterCount > this.slotCount) {\n this.slotCount = Math.pow(2, Math.ceil(Math.log2(this.emitterCount)));\n this.slotKeys = [];\n this.resizeSlots();\n }\n\n const changed: { emitter: Emitter; slot: number }[] = [];\n\n for (let i = 0; i < this.emitterCount; i++) {\n const emitter = this.emitters[i]!;\n\n if (this.slotKeys[i] !== emitter.key) {\n this.slotKeys[i] = emitter.key;\n changed.push({ emitter, slot: i });\n }\n }\n\n if (this.emitterCount === 0) {\n this.probeKey = \"\";\n\n return null;\n }\n\n const probeKey = `${this.emitterCount},${this.updateProbeGrid(camera)}`;\n\n if (changed.length === 0 && probeKey === this.probeKey) {\n return null;\n }\n\n this.probeKey = probeKey;\n\n return changed;\n }\n\n // NOTE New targets, because setSize() destroys the GPU textures that materials still bind\n resizeSlots(): void {\n this.directionTarget.dispose();\n this.emitterTarget.dispose();\n this.directionTarget = createTarget(2, THREE.FloatType, THREE.NearestFilter, directionCount, this.slotCount);\n this.emitterTarget = createTarget(2, THREE.FloatType, THREE.NearestFilter, 1, this.slotCount);\n }\n\n getDirectionMesh(index: number): THREE.Mesh {\n if (!this.directionPool[index]) {\n const mesh = new THREE.Mesh(createGeometry(quadPositions), new THREE.MeshBasicMaterial());\n\n mesh.frustumCulled = false;\n mesh.matrixAutoUpdate = false;\n mesh.onBeforeRender = () => {\n const { emitter, slot } = mesh.userData as { emitter: Emitter; slot: number };\n const material = mesh.material as unknown as VDBFrameEmissionDirectionMaterial;\n\n setVolumeUniforms(material, emitter.frameVolume!, emitter);\n material.frameSlot.value = slot;\n material.frameTargetSize.value.set(directionCount, this.slotCount);\n material.frameEmitterCenter.value.copy(emitter.center);\n material.frameEmitterRadius.value = emitter.radius;\n material.frameSteps.value = this.getSteps();\n };\n\n this.directionScene.add(mesh);\n this.directionPool[index] = mesh;\n }\n\n return this.directionPool[index]!;\n }\n\n /** Runs the passes of changed volumes. The light node calls it before the lit meshes of each render. */\n updateProbes(renderer: RendererLike, scene: THREE.Object3D, viewCamera: THREE.Camera): void {\n this.lastUpdate.directions = 0;\n this.lastUpdate.probes = false;\n\n const changed = this.prepareProbes(scene, viewCamera);\n\n if (!changed) {\n return;\n }\n\n changed.forEach(({ emitter, slot }, index) => {\n const mesh = this.getDirectionMesh(index);\n\n mesh.material = this.getDirectionMaterial(emitter.frameVolume!);\n mesh.userData.emitter = emitter;\n mesh.userData.slot = slot;\n });\n\n const { reduceMaterial, probeMaterial, reduceScene, probeScene, passCamera: camera } = this;\n const utils = vdbFrameRendererUtils();\n\n this.rendererState = utils.resetRendererState(renderer, this.rendererState);\n\n // NOTE Each pass writes all its texels. Rows of volumes that did not change stay.\n renderer.autoClear = false;\n\n try {\n if (changed.length > 0) {\n this.directionPool.forEach((mesh, index) => {\n mesh.visible = index < changed.length;\n });\n\n renderer.setRenderTarget(this.directionTarget);\n renderer.render(this.directionScene, camera);\n\n reduceMaterial.frameTargetSize.value.set(1, this.slotCount);\n reduceMaterial.frameDirectionSize.value.set(directionCount, this.slotCount);\n reduceMaterial.frameDirectionIntensity.value = this.directionTarget.textures[0];\n reduceMaterial.frameDirectionCenter.value = this.directionTarget.textures[1];\n\n renderer.setRenderTarget(this.emitterTarget);\n renderer.render(reduceScene, camera);\n }\n\n setProbeGridUniforms(probeMaterial.gridUniforms, this);\n probeMaterial.frameEmitterCount.value = this.emitterCount;\n probeMaterial.frameEmitterSize.value.set(1, this.slotCount);\n probeMaterial.frameEmitterIntensity.value = this.emitterTarget.textures[0];\n probeMaterial.frameEmitterCenter.value = this.emitterTarget.textures[1];\n\n renderer.setRenderTarget(this.probeTarget);\n renderer.render(probeScene, camera);\n this.lastUpdate.directions = changed.length;\n this.lastUpdate.probes = true;\n } finally {\n utils.restoreRendererState(renderer, this.rendererState);\n }\n }\n\n override dispose(): void {\n super.dispose();\n\n this.slotKeys = [];\n this.slotCount = 0;\n this.probeKey = \"\";\n this.directionTarget.dispose();\n this.emitterTarget.dispose();\n this.probeTarget.dispose();\n this.directionPool.forEach((mesh) => mesh.geometry.dispose());\n this.directionPool = [];\n this.reduceMaterial.dispose();\n this.probeMaterial.dispose();\n\n for (const scene of [this.reduceScene, this.probeScene]) {\n (scene.children[0] as THREE.Mesh | undefined)?.geometry.dispose();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NodeMaterial } from "three/webgpu";
|
|
2
|
+
import { type EnvironmentGridUniforms, type GridUniforms, type LightUniforms } from "./chunks.js";
|
|
3
|
+
export interface VDBFrameEnvironmentGridMaterialOptions {
|
|
4
|
+
gridUniforms: GridUniforms;
|
|
5
|
+
environmentGridUniforms: EnvironmentGridUniforms;
|
|
6
|
+
lightUniforms: LightUniforms;
|
|
7
|
+
}
|
|
8
|
+
export declare class VDBFrameEnvironmentGridMaterial extends NodeMaterial {
|
|
9
|
+
readonly frameUniforms: VDBFrameEnvironmentGridMaterialOptions;
|
|
10
|
+
readonly frameShadowDensityMap: any;
|
|
11
|
+
readonly frameLightCount: any;
|
|
12
|
+
readonly frameLightDirections: any;
|
|
13
|
+
readonly frameLightColors: any;
|
|
14
|
+
readonly frameMultipleScattering: any;
|
|
15
|
+
readonly frameScatteringOctaves: any;
|
|
16
|
+
readonly frameShadowAbsorptionMap: any;
|
|
17
|
+
spectral: boolean;
|
|
18
|
+
constructor(frameUniforms: VDBFrameEnvironmentGridMaterialOptions);
|
|
19
|
+
setSpectral(spectral: boolean): void;
|
|
20
|
+
buildNodes(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/webgpu/FrameEnvironmentGridMaterial.js L35–283 (the grey pass; K3.4: the
|
|
3
|
+
// octave uniform and terms; K3.5: the absorption map, setSpectral and the spectral branch L104–197).
|
|
4
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
5
|
+
// Changes: TypeScript.
|
|
6
|
+
// Divergences: DIVERGES.md (K3.3 rows).
|
|
7
|
+
/**
|
|
8
|
+
* The environment grid of `'frame'` lighting (K3.3): the environment light of each voxel of the last
|
|
9
|
+
* shadow grid cascade, from the environment lights with no shadow slot. Sum of colour × transmittance,
|
|
10
|
+
* with a one-voxel-step march that stays in the last cascade (which fits every caster and does not
|
|
11
|
+
* follow the camera). Diffusion multiple scattering uses the two-sided isotropic total, which needs
|
|
12
|
+
* the opposite march too. The renderer draws it only when its signature changes. Spectral (K3.5): the
|
|
13
|
+
* march of each channel through the grid's extinction and absorption targets; octaves use the voxel's
|
|
14
|
+
* per-channel albedo.
|
|
15
|
+
*/
|
|
16
|
+
import * as THREE from "three";
|
|
17
|
+
import { NodeMaterial } from "three/webgpu";
|
|
18
|
+
import * as TSL from "three/tsl";
|
|
19
|
+
import { createGridNodes, frameFragCoord, frameFullscreenVertex, frameIsotropicDiffusion, frameMaxEnvironmentLights, frameShadowMarchDepth, frameShadowStep, frameShadowTotal, frameShadowTransmittance, frameSpectralGridAlbedo, frameSpectralShadowStep, frameSpectralShadowTotal, frameSpectralShadowTransmittance, minComponent, } from "./chunks.js";
|
|
20
|
+
const { Break, Fn, If, Loop, abs, float, floor, max, select, texture, uniform, uniformArray, vec3, vec4 } = TSL;
|
|
21
|
+
const maxSteps = 1024;
|
|
22
|
+
export class VDBFrameEnvironmentGridMaterial extends NodeMaterial {
|
|
23
|
+
frameUniforms;
|
|
24
|
+
frameShadowDensityMap = texture(new THREE.Texture());
|
|
25
|
+
frameLightCount = uniform(0, "int");
|
|
26
|
+
frameLightDirections = uniformArray(Array.from({ length: frameMaxEnvironmentLights }, () => new THREE.Vector3(0.0, 1.0, 0.0)), "vec3");
|
|
27
|
+
frameLightColors = uniformArray(Array.from({ length: frameMaxEnvironmentLights }, () => new THREE.Vector3()), "vec3");
|
|
28
|
+
// NOTE Multiple scattering of the renderer settings (phase.ts). 0.0 is single scattering.
|
|
29
|
+
frameMultipleScattering = uniform(0.0);
|
|
30
|
+
// NOTE Scattering octaves of the renderer settings (phase.ts). Count 0 is off.
|
|
31
|
+
frameScatteringOctaves = uniform(new THREE.Vector4());
|
|
32
|
+
// NOTE Renderer settings.spectral: the absorption target of the grid. The march is done for each channel.
|
|
33
|
+
frameShadowAbsorptionMap = texture(new THREE.Texture());
|
|
34
|
+
spectral = false;
|
|
35
|
+
constructor(frameUniforms) {
|
|
36
|
+
super();
|
|
37
|
+
this.frameUniforms = frameUniforms;
|
|
38
|
+
this.name = "VDBFrameEnvironmentGridMaterial";
|
|
39
|
+
this.vertexNode = frameFullscreenVertex;
|
|
40
|
+
this.buildNodes();
|
|
41
|
+
this.side = THREE.DoubleSide;
|
|
42
|
+
this.forceSinglePass = true;
|
|
43
|
+
this.depthTest = false;
|
|
44
|
+
this.depthWrite = false;
|
|
45
|
+
this.blending = THREE.NoBlending;
|
|
46
|
+
}
|
|
47
|
+
setSpectral(spectral) {
|
|
48
|
+
if (spectral !== this.spectral) {
|
|
49
|
+
this.spectral = spectral;
|
|
50
|
+
this.buildNodes();
|
|
51
|
+
this.needsUpdate = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
buildNodes() {
|
|
55
|
+
const { spectral } = this;
|
|
56
|
+
const { gridUniforms, environmentGridUniforms, lightUniforms } = this.frameUniforms;
|
|
57
|
+
const grid = createGridNodes(gridUniforms);
|
|
58
|
+
const { frameGridMin, frameGridSize, frameGridVoxel, frameGridResolution } = gridUniforms;
|
|
59
|
+
const { frameEnvironmentGridCascade, frameEnvironmentGridColumns, frameEnvironmentGridAtlasSize } = environmentGridUniforms;
|
|
60
|
+
const { frameEnvironmentUnshadowed } = lightUniforms;
|
|
61
|
+
const ms = this.frameMultipleScattering;
|
|
62
|
+
const octaves = this.frameScatteringOctaves;
|
|
63
|
+
this.colorNode = Fn(() => {
|
|
64
|
+
const cascade = frameEnvironmentGridCascade;
|
|
65
|
+
const resolution = frameGridResolution;
|
|
66
|
+
const fragCoord = frameFragCoord(frameEnvironmentGridAtlasSize).toVar();
|
|
67
|
+
const tile = floor(fragCoord.div(resolution)).toVar();
|
|
68
|
+
const z = tile.y.mul(frameEnvironmentGridColumns).add(tile.x);
|
|
69
|
+
const gridUvw = vec3(fragCoord.sub(tile.mul(resolution)), z.add(0.5)).div(resolution);
|
|
70
|
+
const voxel = frameGridVoxel.element(cascade).toVar();
|
|
71
|
+
const gridMin = frameGridMin.element(cascade).toVar();
|
|
72
|
+
const gridSize = frameGridSize.element(cascade).toVar();
|
|
73
|
+
const worldPosition = gridMin.add(gridUvw.mul(gridSize)).toVar();
|
|
74
|
+
// NOTE Octaves: unshadowed light also gets the octaves
|
|
75
|
+
const unshadowedTotal = spectral ? frameSpectralShadowTotal(vec3(1.0), octaves, vec3(1.0)) : frameShadowTotal(float(1.0), octaves);
|
|
76
|
+
const result = vec4(frameEnvironmentUnshadowed.mul(unshadowedTotal), 1.0).toVar();
|
|
77
|
+
// NOTE Spectral: extinction of all channels
|
|
78
|
+
const extinctionAt = (position) => {
|
|
79
|
+
const sample = grid.sampleGrid(this.frameShadowDensityMap, cascade, position.sub(gridMin).div(gridSize));
|
|
80
|
+
return spectral ? sample.r.add(sample.g).add(sample.b) : sample.r;
|
|
81
|
+
};
|
|
82
|
+
// NOTE Skip voxels with no extinction near them. The density pass does not read them.
|
|
83
|
+
let nearExtinction = float(0.0);
|
|
84
|
+
for (let i = 0; i < 8; i++) {
|
|
85
|
+
const corner = vec3(i & 1, (i >> 1) & 1, (i >> 2) & 1).sub(0.5);
|
|
86
|
+
nearExtinction = nearExtinction.add(extinctionAt(worldPosition.add(corner.mul(voxel))));
|
|
87
|
+
}
|
|
88
|
+
if (spectral) {
|
|
89
|
+
If(z.lessThan(resolution).and(nearExtinction.greaterThan(0.0)), () => {
|
|
90
|
+
// NOTE Octaves use the albedo of the medium at this voxel
|
|
91
|
+
const albedo = frameSpectralGridAlbedo(grid.sampleGrid(this.frameShadowDensityMap, cascade, gridUvw).rgb, grid.sampleGrid(this.frameShadowAbsorptionMap, cascade, gridUvw).rgb).toVar();
|
|
92
|
+
const irradiance = vec3(0.0).toVar();
|
|
93
|
+
// NOTE Depths of each channel { x: extinction, y: effective, z: reduced } of the march from worldPosition along direction
|
|
94
|
+
const marchDepths = (direction) => {
|
|
95
|
+
const voxelsPerUnit = abs(direction).div(voxel);
|
|
96
|
+
const stepLength = float(1.0).div(max(voxelsPerUnit.x, max(voxelsPerUnit.y, voxelsPerUnit.z))).toVar();
|
|
97
|
+
const probe = worldPosition.add(direction.mul(stepLength).mul(0.5)).toVar();
|
|
98
|
+
const depths = { x: vec3(0.0).toVar(), y: vec3(0.0).toVar(), z: vec3(0.0).toVar() };
|
|
99
|
+
Loop(maxSteps, () => {
|
|
100
|
+
const uvw = probe.sub(gridMin).div(gridSize);
|
|
101
|
+
If(uvw.x
|
|
102
|
+
.lessThan(0.0)
|
|
103
|
+
.or(uvw.y.lessThan(0.0))
|
|
104
|
+
.or(uvw.z.lessThan(0.0))
|
|
105
|
+
.or(uvw.x.greaterThan(1.0))
|
|
106
|
+
.or(uvw.y.greaterThan(1.0))
|
|
107
|
+
.or(uvw.z.greaterThan(1.0))
|
|
108
|
+
.or(minComponent(frameShadowMarchDepth(depths, ms, octaves)).greaterThan(6.0)), () => {
|
|
109
|
+
Break();
|
|
110
|
+
});
|
|
111
|
+
const step = frameSpectralShadowStep(grid.sampleGrid(this.frameShadowDensityMap, cascade, uvw).rgb, grid.sampleGrid(this.frameShadowAbsorptionMap, cascade, uvw).rgb, ms);
|
|
112
|
+
depths.x.addAssign(step.x.mul(stepLength));
|
|
113
|
+
depths.y.addAssign(step.y.mul(stepLength));
|
|
114
|
+
depths.z.addAssign(step.z.mul(stepLength));
|
|
115
|
+
probe.addAssign(direction.mul(stepLength));
|
|
116
|
+
});
|
|
117
|
+
return depths;
|
|
118
|
+
};
|
|
119
|
+
Loop(this.frameLightCount, ({ i }) => {
|
|
120
|
+
const direction = this.frameLightDirections.element(i).toVar();
|
|
121
|
+
const depths = marchDepths(direction);
|
|
122
|
+
// NOTE Environment lights are isotropic: total transmittance, no phase
|
|
123
|
+
const shadow = frameSpectralShadowTransmittance(depths, ms, octaves);
|
|
124
|
+
// NOTE Diffusion: two-sided total of each channel (frameIsotropicDiffusion). It needs the opposite march too.
|
|
125
|
+
const diffusion = ms.greaterThan(0.0);
|
|
126
|
+
const backReduced = vec3(0.0).toVar();
|
|
127
|
+
If(diffusion, () => {
|
|
128
|
+
backReduced.assign(marchDepths(direction.negate()).z);
|
|
129
|
+
});
|
|
130
|
+
const total = select(diffusion, frameIsotropicDiffusion(depths.z, backReduced, depths.y), frameSpectralShadowTotal(shadow.y, octaves, albedo));
|
|
131
|
+
irradiance.addAssign(this.frameLightColors.element(i).mul(total));
|
|
132
|
+
});
|
|
133
|
+
result.assign(vec4(max(irradiance, vec3(0.0)), 1.0));
|
|
134
|
+
});
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
If(z.lessThan(resolution).and(nearExtinction.greaterThan(0.0)), () => {
|
|
138
|
+
const irradiance = vec3(0.0).toVar();
|
|
139
|
+
// NOTE (extinction, effective, reduced) depths of the march from worldPosition along direction
|
|
140
|
+
const marchDepths = (direction) => {
|
|
141
|
+
const voxelsPerUnit = abs(direction).div(voxel);
|
|
142
|
+
const stepLength = float(1.0).div(max(voxelsPerUnit.x, max(voxelsPerUnit.y, voxelsPerUnit.z))).toVar();
|
|
143
|
+
const step = direction.mul(stepLength).toVar();
|
|
144
|
+
const probe = worldPosition.add(step.mul(0.5)).toVar();
|
|
145
|
+
const depths = vec3(0.0).toVar();
|
|
146
|
+
Loop(maxSteps, () => {
|
|
147
|
+
const uvw = probe.sub(gridMin).div(gridSize);
|
|
148
|
+
If(uvw.x
|
|
149
|
+
.lessThan(0.0)
|
|
150
|
+
.or(uvw.y.lessThan(0.0))
|
|
151
|
+
.or(uvw.z.lessThan(0.0))
|
|
152
|
+
.or(uvw.x.greaterThan(1.0))
|
|
153
|
+
.or(uvw.y.greaterThan(1.0))
|
|
154
|
+
.or(uvw.z.greaterThan(1.0))
|
|
155
|
+
.or(frameShadowMarchDepth(depths, ms, octaves).greaterThan(6.0)), () => {
|
|
156
|
+
Break();
|
|
157
|
+
});
|
|
158
|
+
const sample = grid.sampleGrid(this.frameShadowDensityMap, cascade, uvw).toVar();
|
|
159
|
+
depths.addAssign(frameShadowStep(sample.r, sample.g, ms).mul(stepLength));
|
|
160
|
+
probe.addAssign(step);
|
|
161
|
+
});
|
|
162
|
+
return depths;
|
|
163
|
+
};
|
|
164
|
+
Loop(this.frameLightCount, ({ i }) => {
|
|
165
|
+
const direction = this.frameLightDirections.element(i).toVar();
|
|
166
|
+
const depths = marchDepths(direction);
|
|
167
|
+
// NOTE Environment lights are isotropic: total transmittance, no phase
|
|
168
|
+
const shadow = frameShadowTransmittance(depths, ms, octaves);
|
|
169
|
+
// NOTE Diffusion: two-sided total (frameIsotropicDiffusion). It needs the march in the opposite direction too.
|
|
170
|
+
const diffusion = ms.greaterThan(0.0);
|
|
171
|
+
const backDepths = vec3(0.0).toVar();
|
|
172
|
+
If(diffusion, () => {
|
|
173
|
+
backDepths.assign(marchDepths(direction.negate()));
|
|
174
|
+
});
|
|
175
|
+
const total = select(diffusion, frameIsotropicDiffusion(depths.z, backDepths.z, depths.y), frameShadowTotal(shadow.y, octaves));
|
|
176
|
+
irradiance.addAssign(this.frameLightColors.element(i).mul(total));
|
|
177
|
+
});
|
|
178
|
+
result.assign(vec4(max(irradiance, vec3(0.0)), 1.0));
|
|
179
|
+
});
|
|
180
|
+
return result;
|
|
181
|
+
})();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=environment-grid-material.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-grid-material.js","sourceRoot":"","sources":["../../../src/three/frame/environment-grid-material.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qGAAqG;AACrG,uGAAuG;AACvG,4GAA4G;AAC5G,uBAAuB;AACvB,wCAAwC;AAExC;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EAChC,YAAY,GAIb,MAAM,aAAa,CAAC;AAErB,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAA4C,CAAC;AAEzJ,MAAM,QAAQ,GAAG,IAAI,CAAC;AAQtB,MAAM,OAAO,+BAAgC,SAAQ,YAAY;IAmB1C;IAlBZ,qBAAqB,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,eAAe,GAAG,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,oBAAoB,GAAG,YAAY,CAC1C,KAAK,CAA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C,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/FrameEnvironmentGridMaterial.js L35–283 (the grey pass; K3.4: the\n// octave uniform and terms; K3.5: the absorption map, setSpectral and the spectral branch L104–197).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript.\n// Divergences: DIVERGES.md (K3.3 rows).\n\n/**\n * The environment grid of `'frame'` lighting (K3.3): the environment light of each voxel of the last\n * shadow grid cascade, from the environment lights with no shadow slot. Sum of colour × transmittance,\n * with a one-voxel-step march that stays in the last cascade (which fits every caster and does not\n * follow the camera). Diffusion multiple scattering uses the two-sided isotropic total, which needs\n * the opposite march too. The renderer draws it only when its signature changes. Spectral (K3.5): the\n * march of each channel through the grid's extinction and absorption targets; octaves use the voxel's\n * per-channel albedo.\n */\n\nimport * as THREE from \"three\";\nimport { NodeMaterial } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport {\n createGridNodes,\n frameFragCoord,\n frameFullscreenVertex,\n frameIsotropicDiffusion,\n frameMaxEnvironmentLights,\n frameShadowMarchDepth,\n frameShadowStep,\n frameShadowTotal,\n frameShadowTransmittance,\n frameSpectralGridAlbedo,\n frameSpectralShadowStep,\n frameSpectralShadowTotal,\n frameSpectralShadowTransmittance,\n minComponent,\n type EnvironmentGridUniforms,\n type GridUniforms,\n type LightUniforms,\n} from \"./chunks.js\";\n\nconst { Break, Fn, If, Loop, abs, float, floor, max, select, texture, uniform, uniformArray, vec3, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\nconst maxSteps = 1024;\n\nexport interface VDBFrameEnvironmentGridMaterialOptions {\n gridUniforms: GridUniforms;\n environmentGridUniforms: EnvironmentGridUniforms;\n lightUniforms: LightUniforms;\n}\n\nexport class VDBFrameEnvironmentGridMaterial extends NodeMaterial {\n readonly frameShadowDensityMap = texture(new THREE.Texture());\n readonly frameLightCount = uniform(0, \"int\");\n readonly frameLightDirections = uniformArray(\n Array.from({ length: frameMaxEnvironmentLights }, () => new THREE.Vector3(0.0, 1.0, 0.0)),\n \"vec3\",\n );\n readonly frameLightColors = uniformArray(\n Array.from({ length: frameMaxEnvironmentLights }, () => new THREE.Vector3()),\n \"vec3\",\n );\n // NOTE Multiple scattering of the renderer settings (phase.ts). 0.0 is single scattering.\n readonly frameMultipleScattering = uniform(0.0);\n // NOTE Scattering octaves of the renderer settings (phase.ts). Count 0 is off.\n readonly frameScatteringOctaves = uniform(new THREE.Vector4());\n // NOTE Renderer settings.spectral: the absorption target of the grid. The march is done for each channel.\n readonly frameShadowAbsorptionMap = texture(new THREE.Texture());\n spectral = false;\n\n constructor(readonly frameUniforms: VDBFrameEnvironmentGridMaterialOptions) {\n super();\n\n this.name = \"VDBFrameEnvironmentGridMaterial\";\n this.vertexNode = frameFullscreenVertex;\n this.buildNodes();\n\n this.side = THREE.DoubleSide;\n this.forceSinglePass = true;\n this.depthTest = false;\n this.depthWrite = false;\n this.blending = THREE.NoBlending;\n }\n\n setSpectral(spectral: boolean): void {\n if (spectral !== this.spectral) {\n this.spectral = spectral;\n this.buildNodes();\n this.needsUpdate = true;\n }\n }\n\n buildNodes(): void {\n const { spectral } = this;\n const { gridUniforms, environmentGridUniforms, lightUniforms } = this.frameUniforms;\n const grid = createGridNodes(gridUniforms);\n const { frameGridMin, frameGridSize, frameGridVoxel, frameGridResolution } = gridUniforms;\n const { frameEnvironmentGridCascade, frameEnvironmentGridColumns, frameEnvironmentGridAtlasSize } = environmentGridUniforms;\n const { frameEnvironmentUnshadowed } = lightUniforms;\n const ms = this.frameMultipleScattering;\n const octaves = this.frameScatteringOctaves;\n\n this.colorNode = Fn(() => {\n const cascade = frameEnvironmentGridCascade;\n const resolution = frameGridResolution;\n const fragCoord = frameFragCoord(frameEnvironmentGridAtlasSize).toVar();\n const tile = floor(fragCoord.div(resolution)).toVar();\n const z = tile.y.mul(frameEnvironmentGridColumns).add(tile.x);\n const gridUvw = vec3(fragCoord.sub(tile.mul(resolution)), z.add(0.5)).div(resolution);\n const voxel = frameGridVoxel.element(cascade).toVar();\n const gridMin = frameGridMin.element(cascade).toVar();\n const gridSize = frameGridSize.element(cascade).toVar();\n const worldPosition = gridMin.add(gridUvw.mul(gridSize)).toVar();\n // NOTE Octaves: unshadowed light also gets the octaves\n const unshadowedTotal = spectral ? frameSpectralShadowTotal(vec3(1.0), octaves, vec3(1.0)) : frameShadowTotal(float(1.0), octaves);\n const result = vec4(frameEnvironmentUnshadowed.mul(unshadowedTotal), 1.0).toVar();\n\n // NOTE Spectral: extinction of all channels\n const extinctionAt = (position: VDBTslNode) => {\n const sample = grid.sampleGrid(this.frameShadowDensityMap, cascade, position.sub(gridMin).div(gridSize));\n\n return spectral ? sample.r.add(sample.g).add(sample.b) : sample.r;\n };\n\n // NOTE Skip voxels with no extinction near them. The density pass does not read them.\n let nearExtinction: VDBTslNode = float(0.0);\n\n for (let i = 0; i < 8; i++) {\n const corner = vec3(i & 1, (i >> 1) & 1, (i >> 2) & 1).sub(0.5);\n\n nearExtinction = nearExtinction.add(extinctionAt(worldPosition.add(corner.mul(voxel))));\n }\n\n if (spectral) {\n If(z.lessThan(resolution).and(nearExtinction.greaterThan(0.0)), () => {\n // NOTE Octaves use the albedo of the medium at this voxel\n const albedo = frameSpectralGridAlbedo(grid.sampleGrid(this.frameShadowDensityMap, cascade, gridUvw).rgb, grid.sampleGrid(this.frameShadowAbsorptionMap, cascade, gridUvw).rgb).toVar();\n const irradiance = vec3(0.0).toVar();\n\n // NOTE Depths of each channel { x: extinction, y: effective, z: reduced } of the march from worldPosition along direction\n const marchDepths = (direction: VDBTslNode) => {\n const voxelsPerUnit = abs(direction).div(voxel);\n const stepLength = float(1.0).div(max(voxelsPerUnit.x, max(voxelsPerUnit.y, voxelsPerUnit.z))).toVar();\n const probe = worldPosition.add(direction.mul(stepLength).mul(0.5)).toVar();\n const depths = { x: vec3(0.0).toVar(), y: vec3(0.0).toVar(), z: vec3(0.0).toVar() };\n\n Loop(maxSteps, () => {\n const uvw = probe.sub(gridMin).div(gridSize);\n\n If(\n uvw.x\n .lessThan(0.0)\n .or(uvw.y.lessThan(0.0))\n .or(uvw.z.lessThan(0.0))\n .or(uvw.x.greaterThan(1.0))\n .or(uvw.y.greaterThan(1.0))\n .or(uvw.z.greaterThan(1.0))\n .or(minComponent(frameShadowMarchDepth(depths, ms, octaves)).greaterThan(6.0)),\n () => {\n Break();\n },\n );\n\n const step = frameSpectralShadowStep(grid.sampleGrid(this.frameShadowDensityMap, cascade, uvw).rgb, grid.sampleGrid(this.frameShadowAbsorptionMap, cascade, uvw).rgb, ms);\n\n depths.x.addAssign(step.x.mul(stepLength));\n depths.y.addAssign(step.y.mul(stepLength));\n depths.z.addAssign(step.z.mul(stepLength));\n probe.addAssign(direction.mul(stepLength));\n });\n\n return depths;\n };\n\n Loop(this.frameLightCount, ({ i }: { i: VDBTslNode }) => {\n const direction = this.frameLightDirections.element(i).toVar();\n const depths = marchDepths(direction);\n\n // NOTE Environment lights are isotropic: total transmittance, no phase\n const shadow = frameSpectralShadowTransmittance(depths, ms, octaves);\n\n // NOTE Diffusion: two-sided total of each channel (frameIsotropicDiffusion). It needs the opposite march too.\n const diffusion = ms.greaterThan(0.0);\n const backReduced = vec3(0.0).toVar();\n\n If(diffusion, () => {\n backReduced.assign(marchDepths(direction.negate()).z);\n });\n\n const total = select(diffusion, frameIsotropicDiffusion(depths.z, backReduced, depths.y), frameSpectralShadowTotal(shadow.y, octaves, albedo));\n\n irradiance.addAssign(this.frameLightColors.element(i).mul(total));\n });\n\n result.assign(vec4(max(irradiance, vec3(0.0)), 1.0));\n });\n\n return result;\n }\n\n If(z.lessThan(resolution).and(nearExtinction.greaterThan(0.0)), () => {\n const irradiance = vec3(0.0).toVar();\n\n // NOTE (extinction, effective, reduced) depths of the march from worldPosition along direction\n const marchDepths = (direction: VDBTslNode) => {\n const voxelsPerUnit = abs(direction).div(voxel);\n const stepLength = float(1.0).div(max(voxelsPerUnit.x, max(voxelsPerUnit.y, voxelsPerUnit.z))).toVar();\n const step = direction.mul(stepLength).toVar();\n const probe = worldPosition.add(step.mul(0.5)).toVar();\n const depths = vec3(0.0).toVar();\n\n Loop(maxSteps, () => {\n const uvw = probe.sub(gridMin).div(gridSize);\n\n If(\n uvw.x\n .lessThan(0.0)\n .or(uvw.y.lessThan(0.0))\n .or(uvw.z.lessThan(0.0))\n .or(uvw.x.greaterThan(1.0))\n .or(uvw.y.greaterThan(1.0))\n .or(uvw.z.greaterThan(1.0))\n .or(frameShadowMarchDepth(depths, ms, octaves).greaterThan(6.0)),\n () => {\n Break();\n },\n );\n\n const sample = grid.sampleGrid(this.frameShadowDensityMap, cascade, uvw).toVar();\n\n depths.addAssign(frameShadowStep(sample.r, sample.g, ms).mul(stepLength));\n probe.addAssign(step);\n });\n\n return depths;\n };\n\n Loop(this.frameLightCount, ({ i }: { i: VDBTslNode }) => {\n const direction = this.frameLightDirections.element(i).toVar();\n const depths = marchDepths(direction);\n\n // NOTE Environment lights are isotropic: total transmittance, no phase\n const shadow = frameShadowTransmittance(depths, ms, octaves);\n\n // NOTE Diffusion: two-sided total (frameIsotropicDiffusion). It needs the march in the opposite direction too.\n const diffusion = ms.greaterThan(0.0);\n const backDepths = vec3(0.0).toVar();\n\n If(diffusion, () => {\n backDepths.assign(marchDepths(direction.negate()));\n });\n\n const total = select(diffusion, frameIsotropicDiffusion(depths.z, backDepths.z, depths.y), frameShadowTotal(shadow.y, octaves));\n\n irradiance.addAssign(this.frameLightColors.element(i).mul(total));\n });\n\n result.assign(vec4(max(irradiance, vec3(0.0)), 1.0));\n });\n\n return result;\n })();\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passes that read the scene environment (K3.3): the base class (PMREM radiance and three's IBL
|
|
3
|
+
* irradiance at a direction; a new or removed environment rebuilds the shader) and the 64 × 32
|
|
4
|
+
* lat-long map the CPU turns into environment lights (`@pmndrs/vdb/tools` `VDBFrameEnvironmentLights`).
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from "three";
|
|
7
|
+
import { NodeMaterial } from "three/webgpu";
|
|
8
|
+
import type { VDBTslNode } from "../grid-node.js";
|
|
9
|
+
export declare class VDBFrameEnvironmentMaterial extends NodeMaterial {
|
|
10
|
+
environment: THREE.Texture | null;
|
|
11
|
+
environmentNodes: VDBTslNode[];
|
|
12
|
+
constructor();
|
|
13
|
+
rebuildNodes(): void;
|
|
14
|
+
setEnvironment(environment: THREE.Texture | null | undefined): void;
|
|
15
|
+
environmentRadiance(direction: VDBTslNode, roughness: number): VDBTslNode;
|
|
16
|
+
environmentIrradiance(direction: VDBTslNode): VDBTslNode;
|
|
17
|
+
}
|
|
18
|
+
export declare class VDBFrameEnvironmentMapMaterial extends VDBFrameEnvironmentMaterial {
|
|
19
|
+
constructor();
|
|
20
|
+
rebuildNodes(): void;
|
|
21
|
+
createFragmentNode(): VDBTslNode;
|
|
22
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/webgpu/FrameEnvironmentMaterial.js (all, 56 lines),
|
|
3
|
+
// src/three-openvdb/frame/webgpu/FrameEnvironmentMapMaterial.js (all, 44 lines).
|
|
4
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
5
|
+
// Changes: TypeScript. Divergences: none.
|
|
6
|
+
/**
|
|
7
|
+
* Passes that read the scene environment (K3.3): the base class (PMREM radiance and three's IBL
|
|
8
|
+
* irradiance at a direction; a new or removed environment rebuilds the shader) and the 64 × 32
|
|
9
|
+
* lat-long map the CPU turns into environment lights (`@pmndrs/vdb/tools` `VDBFrameEnvironmentLights`).
|
|
10
|
+
*/
|
|
11
|
+
import * as THREE from "three";
|
|
12
|
+
import { NodeMaterial } from "three/webgpu";
|
|
13
|
+
import * as TSL from "three/tsl";
|
|
14
|
+
import { frameEnvironmentMapHeight, frameEnvironmentMapRoughness, frameEnvironmentMapWidth } from "../../tools/frame/environment.js";
|
|
15
|
+
import { frameFragCoord, frameFullscreenVertex } from "./chunks.js";
|
|
16
|
+
const { Fn, cos, float, materialEnvIntensity, pmremTexture, sin, vec2, vec3, vec4 } = TSL;
|
|
17
|
+
// NOTE Base of the passes that read the scene environment.
|
|
18
|
+
// The PMREM node needs a texture, so a new or removed environment builds the shader again.
|
|
19
|
+
export class VDBFrameEnvironmentMaterial extends NodeMaterial {
|
|
20
|
+
environment = null;
|
|
21
|
+
environmentNodes = [];
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
// NOTE No own envMap. Then the PMREM rotation and intensity uniforms read the pass scene values.
|
|
25
|
+
this.envMap = null;
|
|
26
|
+
}
|
|
27
|
+
// NOTE Subclasses build their nodes again here; they call environmentIrradiance() in them.
|
|
28
|
+
rebuildNodes() { }
|
|
29
|
+
setEnvironment(environment) {
|
|
30
|
+
const next = environment ?? null;
|
|
31
|
+
const hasEnvironment = !!next;
|
|
32
|
+
if (hasEnvironment !== !!this.environment) {
|
|
33
|
+
this.environment = next;
|
|
34
|
+
this.environmentNodes = [];
|
|
35
|
+
this.rebuildNodes();
|
|
36
|
+
this.needsUpdate = true;
|
|
37
|
+
}
|
|
38
|
+
else if (hasEnvironment && this.environment !== next) {
|
|
39
|
+
this.environment = next;
|
|
40
|
+
this.environmentNodes.forEach((node) => {
|
|
41
|
+
node.value = next;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// NOTE Radiance of the PMREM environment at the roughness. Rotation is from the pass scene, intensity is not applied.
|
|
46
|
+
environmentRadiance(direction, roughness) {
|
|
47
|
+
const node = pmremTexture(this.environment, direction, float(roughness));
|
|
48
|
+
this.environmentNodes.push(node);
|
|
49
|
+
return node;
|
|
50
|
+
}
|
|
51
|
+
// NOTE Diffuse irradiance of the PMREM environment, the same as three.js IBL irradiance
|
|
52
|
+
environmentIrradiance(direction) {
|
|
53
|
+
return this.environmentRadiance(direction, 1.0).mul(Math.PI).mul(materialEnvIntensity);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// NOTE Small lat-long map of the scene environment, for the environment lights (tools/frame/environment.ts).
|
|
57
|
+
// NOTE RGB is radiance, A is the v coordinate. The direction is the same as vdbFrameEnvironmentMapDirection().
|
|
58
|
+
export class VDBFrameEnvironmentMapMaterial extends VDBFrameEnvironmentMaterial {
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
61
|
+
this.name = "VDBFrameEnvironmentMapMaterial";
|
|
62
|
+
this.vertexNode = frameFullscreenVertex;
|
|
63
|
+
this.fragmentNode = this.createFragmentNode();
|
|
64
|
+
this.side = THREE.DoubleSide;
|
|
65
|
+
this.forceSinglePass = true;
|
|
66
|
+
this.depthTest = false;
|
|
67
|
+
this.depthWrite = false;
|
|
68
|
+
this.blending = THREE.NoBlending;
|
|
69
|
+
}
|
|
70
|
+
rebuildNodes() {
|
|
71
|
+
this.fragmentNode = this.createFragmentNode();
|
|
72
|
+
}
|
|
73
|
+
createFragmentNode() {
|
|
74
|
+
const mapSize = vec2(frameEnvironmentMapWidth, frameEnvironmentMapHeight);
|
|
75
|
+
return Fn(() => {
|
|
76
|
+
const uv = frameFragCoord(mapSize).div(mapSize).toVar();
|
|
77
|
+
const phi = uv.x.mul(2.0 * Math.PI);
|
|
78
|
+
const theta = uv.y.mul(Math.PI);
|
|
79
|
+
const direction = vec3(sin(theta).mul(cos(phi)), cos(theta), sin(theta).mul(sin(phi)));
|
|
80
|
+
if (!this.environment) {
|
|
81
|
+
return vec4(0.0, 0.0, 0.0, uv.y);
|
|
82
|
+
}
|
|
83
|
+
return vec4(this.environmentRadiance(direction, frameEnvironmentMapRoughness), uv.y);
|
|
84
|
+
})();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=environment-material.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-material.js","sourceRoot":"","sources":["../../../src/three/frame/environment-material.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,gFAAgF;AAChF,mFAAmF;AACnF,4GAA4G;AAC5G,0CAA0C;AAE1C;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAA4C,CAAC;AAEnI,2DAA2D;AAC3D,2FAA2F;AAC3F,MAAM,OAAO,2BAA4B,SAAQ,YAAY;IAC3D,WAAW,GAAyB,IAAI,CAAC;IACzC,gBAAgB,GAAiB,EAAE,CAAC;IAEpC;QACE,KAAK,EAAE,CAAC;QAER,iGAAiG;QAChG,IAAoD,CAAC,MAAM,GAAG,IAAI,CAAC;IACtE,CAAC;IAED,2FAA2F;IAC3F,YAAY,KAAU,CAAC;IAEvB,cAAc,CAAC,WAA6C;QAC1D,MAAM,IAAI,GAAG,WAAW,IAAI,IAAI,CAAC;QACjC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;QAE9B,IAAI,cAAc,KAAK,CAAC,CAAC,IAAI,CAA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ACP,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/FrameEnvironmentMaterial.js (all, 56 lines),\n// src/three-openvdb/frame/webgpu/FrameEnvironmentMapMaterial.js (all, 44 lines).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript. Divergences: none.\n\n/**\n * Passes that read the scene environment (K3.3): the base class (PMREM radiance and three's IBL\n * irradiance at a direction; a new or removed environment rebuilds the shader) and the 64 × 32\n * lat-long map the CPU turns into environment lights (`@pmndrs/vdb/tools` `VDBFrameEnvironmentLights`).\n */\n\nimport * as THREE from \"three\";\nimport { NodeMaterial } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport { frameEnvironmentMapHeight, frameEnvironmentMapRoughness, frameEnvironmentMapWidth } from \"../../tools/frame/environment.js\";\nimport { frameFragCoord, frameFullscreenVertex } from \"./chunks.js\";\n\nconst { Fn, cos, float, materialEnvIntensity, pmremTexture, sin, vec2, vec3, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\n// NOTE Base of the passes that read the scene environment.\n// The PMREM node needs a texture, so a new or removed environment builds the shader again.\nexport class VDBFrameEnvironmentMaterial extends NodeMaterial {\n environment: THREE.Texture | null = null;\n environmentNodes: VDBTslNode[] = [];\n\n constructor() {\n super();\n\n // NOTE No own envMap. Then the PMREM rotation and intensity uniforms read the pass scene values.\n (this as unknown as { envMap: THREE.Texture | null }).envMap = null;\n }\n\n // NOTE Subclasses build their nodes again here; they call environmentIrradiance() in them.\n rebuildNodes(): void {}\n\n setEnvironment(environment: THREE.Texture | null | undefined): void {\n const next = environment ?? null;\n const hasEnvironment = !!next;\n\n if (hasEnvironment !== !!this.environment) {\n this.environment = next;\n this.environmentNodes = [];\n this.rebuildNodes();\n this.needsUpdate = true;\n } else if (hasEnvironment && this.environment !== next) {\n this.environment = next;\n this.environmentNodes.forEach((node) => {\n node.value = next;\n });\n }\n }\n\n // NOTE Radiance of the PMREM environment at the roughness. Rotation is from the pass scene, intensity is not applied.\n environmentRadiance(direction: VDBTslNode, roughness: number): VDBTslNode {\n const node = pmremTexture(this.environment, direction, float(roughness));\n\n this.environmentNodes.push(node);\n\n return node;\n }\n\n // NOTE Diffuse irradiance of the PMREM environment, the same as three.js IBL irradiance\n environmentIrradiance(direction: VDBTslNode): VDBTslNode {\n return this.environmentRadiance(direction, 1.0).mul(Math.PI).mul(materialEnvIntensity);\n }\n}\n\n// NOTE Small lat-long map of the scene environment, for the environment lights (tools/frame/environment.ts).\n// NOTE RGB is radiance, A is the v coordinate. The direction is the same as vdbFrameEnvironmentMapDirection().\nexport class VDBFrameEnvironmentMapMaterial extends VDBFrameEnvironmentMaterial {\n constructor() {\n super();\n\n this.name = \"VDBFrameEnvironmentMapMaterial\";\n this.vertexNode = frameFullscreenVertex;\n this.fragmentNode = this.createFragmentNode();\n\n this.side = THREE.DoubleSide;\n this.forceSinglePass = true;\n this.depthTest = false;\n this.depthWrite = false;\n this.blending = THREE.NoBlending;\n }\n\n override rebuildNodes(): void {\n this.fragmentNode = this.createFragmentNode();\n }\n\n createFragmentNode(): VDBTslNode {\n const mapSize = vec2(frameEnvironmentMapWidth, frameEnvironmentMapHeight);\n\n return Fn(() => {\n const uv = frameFragCoord(mapSize).div(mapSize).toVar();\n const phi = uv.x.mul(2.0 * Math.PI);\n const theta = uv.y.mul(Math.PI);\n const direction = vec3(sin(theta).mul(cos(phi)), cos(theta), sin(theta).mul(sin(phi)));\n\n if (!this.environment) {\n return vec4(0.0, 0.0, 0.0, uv.y);\n }\n\n return vec4(this.environmentRadiance(direction, frameEnvironmentMapRoughness), uv.y);\n })();\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NodeMaterial } from "three/webgpu";
|
|
2
|
+
export declare class VDBFrameGridMipMaterial extends NodeMaterial {
|
|
3
|
+
readonly frameMipSource: any;
|
|
4
|
+
readonly frameMipSourceResolution: any;
|
|
5
|
+
readonly frameMipSourceColumns: any;
|
|
6
|
+
readonly frameMipSourceTile: any;
|
|
7
|
+
readonly frameMipSourceSize: any;
|
|
8
|
+
readonly frameMipResolution: any;
|
|
9
|
+
readonly frameMipColumns: any;
|
|
10
|
+
readonly frameMipSize: any;
|
|
11
|
+
constructor();
|
|
12
|
+
}
|