@pmndrs/vdb 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +592 -2
- package/README.md +85 -37
- package/THIRD_PARTY_NOTICES.md +197 -29
- package/dist/core/compute/atlas.d.ts +10 -2
- package/dist/core/compute/atlas.js +6 -1
- package/dist/core/compute/atlas.js.map +1 -1
- package/dist/core/compute/index.d.ts +3 -3
- package/dist/core/compute/index.js +2 -2
- package/dist/core/compute/index.js.map +1 -1
- package/dist/core/compute/majorant-build.d.ts +45 -0
- package/dist/core/compute/majorant-build.js +193 -0
- package/dist/core/compute/majorant-build.js.map +1 -0
- package/dist/core/compute/multi-scale.d.ts +155 -0
- package/dist/core/compute/multi-scale.js +684 -0
- package/dist/core/compute/multi-scale.js.map +1 -0
- package/dist/core/compute/pyramid.d.ts +22 -7
- package/dist/core/compute/pyramid.js +22 -9
- package/dist/core/compute/pyramid.js.map +1 -1
- package/dist/core/compute/shared.d.ts +1 -0
- package/dist/core/compute/shared.js.map +1 -1
- package/dist/core/compute/stats.d.ts +10 -3
- package/dist/core/compute/stats.js +6 -1
- package/dist/core/compute/stats.js.map +1 -1
- package/dist/core/compute/value-transform.d.ts +8 -1
- package/dist/core/compute/value-transform.js +9 -3
- package/dist/core/compute/value-transform.js.map +1 -1
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.js +8 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/frame/emission.d.ts +85 -0
- package/dist/core/frame/emission.js +422 -0
- package/dist/core/frame/emission.js.map +1 -0
- package/dist/core/frame/environment.d.ts +47 -0
- package/dist/core/frame/environment.js +178 -0
- package/dist/core/frame/environment.js.map +1 -0
- package/dist/core/frame/index.d.ts +39 -0
- package/dist/core/frame/index.js +27 -0
- package/dist/core/frame/index.js.map +1 -0
- package/dist/core/frame/kernels.d.ts +115 -0
- package/dist/core/frame/kernels.js +496 -0
- package/dist/core/frame/kernels.js.map +1 -0
- package/dist/core/frame/limits.d.ts +67 -0
- package/dist/core/frame/limits.js +109 -0
- package/dist/core/frame/limits.js.map +1 -0
- package/dist/core/frame/phase.d.ts +17 -0
- package/dist/core/frame/phase.js +53 -0
- package/dist/core/frame/phase.js.map +1 -0
- package/dist/core/frame/pipelines.d.ts +49 -0
- package/dist/core/frame/pipelines.js +147 -0
- package/dist/core/frame/pipelines.js.map +1 -0
- package/dist/core/frame/renderer.d.ts +122 -0
- package/dist/core/frame/renderer.js +1712 -0
- package/dist/core/frame/renderer.js.map +1 -0
- package/dist/core/frame/resources.d.ts +71 -0
- package/dist/core/frame/resources.js +100 -0
- package/dist/core/frame/resources.js.map +1 -0
- package/dist/core/frame/scattering.d.ts +97 -0
- package/dist/core/frame/scattering.js +332 -0
- package/dist/core/frame/scattering.js.map +1 -0
- package/dist/core/frame/settings.d.ts +243 -0
- package/dist/core/frame/settings.js +67 -0
- package/dist/core/frame/settings.js.map +1 -0
- package/dist/core/frame/shadows.d.ts +55 -0
- package/dist/core/frame/shadows.js +460 -0
- package/dist/core/frame/shadows.js.map +1 -0
- package/dist/core/frame/types.d.ts +415 -0
- package/dist/core/frame/types.js +49 -0
- package/dist/core/frame/types.js.map +1 -0
- package/dist/core/frame/uniforms.d.ts +105 -0
- package/dist/core/frame/uniforms.js +276 -0
- package/dist/core/frame/uniforms.js.map +1 -0
- package/dist/core/frame/wgsl/chunks.d.ts +4 -0
- package/dist/core/frame/wgsl/chunks.js +728 -0
- package/dist/core/frame/wgsl/chunks.js.map +1 -0
- package/dist/core/frame/wgsl/emission.d.ts +82 -0
- package/dist/core/frame/wgsl/emission.js +353 -0
- package/dist/core/frame/wgsl/emission.js.map +1 -0
- package/dist/core/frame/wgsl/environment.d.ts +42 -0
- package/dist/core/frame/wgsl/environment.js +711 -0
- package/dist/core/frame/wgsl/environment.js.map +1 -0
- package/dist/core/frame/wgsl/gather.d.ts +55 -0
- package/dist/core/frame/wgsl/gather.js +850 -0
- package/dist/core/frame/wgsl/gather.js.map +1 -0
- package/dist/core/frame/wgsl/integrate.d.ts +78 -0
- package/dist/core/frame/wgsl/integrate.js +213 -0
- package/dist/core/frame/wgsl/integrate.js.map +1 -0
- package/dist/core/frame/wgsl/lighting.d.ts +103 -0
- package/dist/core/frame/wgsl/lighting.js +1636 -0
- package/dist/core/frame/wgsl/lighting.js.map +1 -0
- package/dist/core/frame/wgsl/occluders.d.ts +20 -0
- package/dist/core/frame/wgsl/occluders.js +95 -0
- package/dist/core/frame/wgsl/occluders.js.map +1 -0
- package/dist/core/frame/wgsl/resolve.d.ts +19 -0
- package/dist/core/frame/wgsl/resolve.js +205 -0
- package/dist/core/frame/wgsl/resolve.js.map +1 -0
- package/dist/core/frame/wgsl/shadows.d.ts +35 -0
- package/dist/core/frame/wgsl/shadows.js +328 -0
- package/dist/core/frame/wgsl/shadows.js.map +1 -0
- package/dist/core/half.d.ts +11 -0
- package/dist/core/half.js +22 -0
- package/dist/core/half.js.map +1 -0
- package/dist/core/index.d.ts +25 -3
- package/dist/core/index.js +23 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/internal.d.ts +17 -1
- package/dist/core/internal.js +18 -1
- package/dist/core/internal.js.map +1 -1
- package/dist/core/pool/image-header.d.ts +13 -2
- package/dist/core/pool/image-header.js +24 -5
- package/dist/core/pool/image-header.js.map +1 -1
- package/dist/core/pool/layout.d.ts +35 -1
- package/dist/core/pool/layout.js +51 -2
- package/dist/core/pool/layout.js.map +1 -1
- package/dist/core/pool/limits.d.ts +1 -0
- package/dist/core/pool/limits.js +1 -0
- package/dist/core/pool/limits.js.map +1 -1
- package/dist/core/pool/pool.d.ts +120 -15
- package/dist/core/pool/pool.js +255 -24
- package/dist/core/pool/pool.js.map +1 -1
- package/dist/core/reference/index.d.ts +6 -0
- package/dist/core/reference/index.js +7 -0
- package/dist/core/reference/index.js.map +1 -0
- package/dist/core/reference/renderer.d.ts +105 -0
- package/dist/core/reference/renderer.js +474 -0
- package/dist/core/reference/renderer.js.map +1 -0
- package/dist/core/reference/wgsl.d.ts +65 -0
- package/dist/core/reference/wgsl.js +803 -0
- package/dist/core/reference/wgsl.js.map +1 -0
- package/dist/{three → core}/sequence.d.ts +32 -2
- package/dist/{three → core}/sequence.js +24 -2
- package/dist/core/sequence.js.map +1 -0
- package/dist/core/source/brick-cache.d.ts +165 -0
- package/dist/core/source/brick-cache.js +627 -0
- package/dist/core/source/brick-cache.js.map +1 -0
- package/dist/core/source/dense-fill.d.ts +53 -0
- package/dist/core/source/dense-fill.js +377 -0
- package/dist/core/source/dense-fill.js.map +1 -0
- package/dist/core/source/dense.d.ts +33 -2
- package/dist/core/source/dense.js +121 -24
- package/dist/core/source/dense.js.map +1 -1
- package/dist/core/source/sparse-wgsl.d.ts +92 -0
- package/dist/core/source/sparse-wgsl.js +481 -0
- package/dist/core/source/sparse-wgsl.js.map +1 -0
- package/dist/core/source/sparse.d.ts +192 -0
- package/dist/core/source/sparse.js +762 -0
- package/dist/core/source/sparse.js.map +1 -0
- package/dist/core/source/types.d.ts +59 -2
- package/dist/core/source/types.js.map +1 -1
- package/dist/core/surface/index.d.ts +10 -0
- package/dist/core/surface/index.js +9 -0
- package/dist/core/surface/index.js.map +1 -0
- package/dist/core/surface/level-set-pass.d.ts +140 -0
- package/dist/core/surface/level-set-pass.js +291 -0
- package/dist/core/surface/level-set-pass.js.map +1 -0
- package/dist/core/surface/level-set-wgsl.d.ts +46 -0
- package/dist/core/surface/level-set-wgsl.js +99 -0
- package/dist/core/surface/level-set-wgsl.js.map +1 -0
- package/dist/core/surface/points.d.ts +109 -0
- package/dist/core/surface/points.js +226 -0
- package/dist/core/surface/points.js.map +1 -0
- package/dist/core/types.d.ts +12 -3
- package/dist/core/types.js +6 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/wgsl/api.d.ts +29 -5
- package/dist/core/wgsl/api.js +110 -27
- package/dist/core/wgsl/api.js.map +1 -1
- package/dist/core/wgsl/generate.d.ts +8 -0
- package/dist/core/wgsl/generate.js +195 -22
- package/dist/core/wgsl/generate.js.map +1 -1
- package/dist/core/wgsl/lean.d.ts +50 -0
- package/dist/core/wgsl/lean.js +327 -0
- package/dist/core/wgsl/lean.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +5 -1
- package/dist/core/wgsl/level-set.js +11 -5
- package/dist/core/wgsl/level-set.js.map +1 -1
- package/dist/core/wgsl/majorant.d.ts +62 -0
- package/dist/core/wgsl/majorant.js +381 -0
- package/dist/core/wgsl/majorant.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +2 -2
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
- package/dist/core/wgsl/types.d.ts +97 -3
- package/dist/core/wgsl/types.js.map +1 -1
- package/dist/three/coarse-first.d.ts +53 -8
- package/dist/three/coarse-first.js +24 -6
- package/dist/three/coarse-first.js.map +1 -1
- package/dist/three/compute.d.ts +12 -2
- package/dist/three/compute.js +16 -6
- package/dist/three/compute.js.map +1 -1
- package/dist/three/device.d.ts +7 -0
- package/dist/three/device.js +3 -0
- package/dist/three/device.js.map +1 -1
- package/dist/three/frame/core-environment.d.ts +38 -0
- package/dist/three/frame/core-environment.js +154 -0
- package/dist/three/frame/core-environment.js.map +1 -0
- package/dist/three/frame/core-integrate-material.d.ts +34 -0
- package/dist/three/frame/core-integrate-material.js +162 -0
- package/dist/three/frame/core-integrate-material.js.map +1 -0
- package/dist/three/frame/core-occluders.d.ts +53 -0
- package/dist/three/frame/core-occluders.js +193 -0
- package/dist/three/frame/core-occluders.js.map +1 -0
- package/dist/three/frame/core-structs.d.ts +34 -0
- package/dist/three/frame/core-structs.js +61 -0
- package/dist/three/frame/core-structs.js.map +1 -0
- package/dist/three/frame/core-textures.d.ts +41 -0
- package/dist/three/frame/core-textures.js +114 -0
- package/dist/three/frame/core-textures.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +64 -114
- package/dist/three/frame/emission-light.js +188 -567
- package/dist/three/frame/emission-light.js.map +1 -1
- package/dist/three/frame/index.d.ts +11 -31
- package/dist/three/frame/index.js +9 -29
- package/dist/three/frame/index.js.map +1 -1
- package/dist/three/frame/medium.d.ts +12 -0
- package/dist/three/frame/medium.js.map +1 -1
- package/dist/three/frame/renderer.d.ts +58 -454
- package/dist/three/frame/renderer.js +409 -1427
- package/dist/three/frame/renderer.js.map +1 -1
- package/dist/three/frame/spectrum.d.ts +0 -14
- package/dist/three/frame/spectrum.js +2 -23
- package/dist/three/frame/spectrum.js.map +1 -1
- package/dist/three/frame/three-internals.d.ts +3 -8
- package/dist/three/frame/three-internals.js +13 -11
- package/dist/three/frame/three-internals.js.map +1 -1
- package/dist/three/frame/volume-shadows.d.ts +93 -107
- package/dist/three/frame/volume-shadows.js +278 -631
- package/dist/three/frame/volume-shadows.js.map +1 -1
- package/dist/three/frame/volume.d.ts +91 -33
- package/dist/three/frame/volume.js +63 -51
- package/dist/three/frame/volume.js.map +1 -1
- package/dist/three/grid-node.d.ts +34 -1
- package/dist/three/grid-node.js +36 -1
- package/dist/three/grid-node.js.map +1 -1
- package/dist/three/index.d.ts +20 -11
- package/dist/three/index.js +21 -12
- package/dist/three/index.js.map +1 -1
- package/dist/three/internal.d.ts +14 -8
- package/dist/three/internal.js +11 -7
- package/dist/three/internal.js.map +1 -1
- package/dist/three/level-set-material.d.ts +81 -8
- package/dist/three/level-set-material.js +162 -125
- package/dist/three/level-set-material.js.map +1 -1
- package/dist/three/level-set-physical-material.d.ts +154 -0
- package/dist/three/level-set-physical-material.js +253 -0
- package/dist/three/level-set-physical-material.js.map +1 -0
- package/dist/three/level-set-velocity.d.ts +94 -0
- package/dist/three/level-set-velocity.js +208 -0
- package/dist/three/level-set-velocity.js.map +1 -0
- package/dist/three/material.d.ts +141 -11
- package/dist/three/material.js +161 -18
- package/dist/three/material.js.map +1 -1
- package/dist/three/points.d.ts +60 -4
- package/dist/three/points.js +140 -9
- package/dist/three/points.js.map +1 -1
- package/dist/three/sparse-source.d.ts +49 -117
- package/dist/three/sparse-source.js +109 -580
- package/dist/three/sparse-source.js.map +1 -1
- package/dist/three/volume-source.d.ts +11 -156
- package/dist/three/volume-source.js +29 -272
- package/dist/three/volume-source.js.map +1 -1
- package/dist/tools/cpu/brick-atlas.d.ts +36 -0
- package/dist/tools/cpu/brick-atlas.js +129 -0
- package/dist/tools/cpu/brick-atlas.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +23 -4
- package/dist/tools/cpu/compute.js +35 -14
- package/dist/tools/cpu/compute.js.map +1 -1
- package/dist/tools/cpu/lean-reads.d.ts +81 -0
- package/dist/tools/cpu/lean-reads.js +262 -0
- package/dist/tools/cpu/lean-reads.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +42 -3
- package/dist/tools/cpu/level-set.js +59 -7
- package/dist/tools/cpu/level-set.js.map +1 -1
- package/dist/tools/cpu/majorant.d.ts +265 -0
- package/dist/tools/cpu/majorant.js +541 -0
- package/dist/tools/cpu/majorant.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +93 -2
- package/dist/tools/cpu/march.js +165 -14
- package/dist/tools/cpu/march.js.map +1 -1
- package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
- package/dist/tools/cpu/mesh-decimate.js +1225 -0
- package/dist/tools/cpu/mesh-decimate.js.map +1 -0
- package/dist/tools/cpu/points.d.ts +29 -0
- package/dist/tools/cpu/points.js +38 -0
- package/dist/tools/cpu/points.js.map +1 -0
- package/dist/tools/cpu/read-value.d.ts +19 -6
- package/dist/tools/cpu/read-value.js +32 -17
- package/dist/tools/cpu/read-value.js.map +1 -1
- package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
- package/dist/tools/cpu/sample-trilinear.js +19 -7
- package/dist/tools/cpu/sample-trilinear.js.map +1 -1
- package/dist/tools/cpu/stride-tables.d.ts +2 -2
- package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
- package/dist/tools/cpu/stride-tables.generated.js +7 -6
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
- package/dist/tools/cpu/stride-tables.js +1 -1
- package/dist/tools/cpu/stride-tables.js.map +1 -1
- package/dist/tools/cpu/surface-nets.d.ts +90 -0
- package/dist/tools/cpu/surface-nets.js +597 -0
- package/dist/tools/cpu/surface-nets.js.map +1 -0
- package/dist/tools/errors.d.ts +9 -0
- package/dist/tools/errors.js +9 -0
- package/dist/tools/errors.js.map +1 -1
- package/dist/tools/frame/ambient.d.ts +98 -0
- package/dist/tools/frame/ambient.js +274 -0
- package/dist/tools/frame/ambient.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +15 -0
- package/dist/tools/frame/blackbody.js +35 -0
- package/dist/tools/frame/blackbody.js.map +1 -1
- package/dist/tools/frame/brick-cache.d.ts +165 -0
- package/dist/tools/frame/brick-cache.js +326 -0
- package/dist/tools/frame/brick-cache.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +9 -0
- package/dist/tools/frame/emission.js +9 -1
- package/dist/tools/frame/emission.js.map +1 -1
- package/dist/tools/frame/environment-gpu.d.ts +111 -0
- package/dist/tools/frame/environment-gpu.js +280 -0
- package/dist/tools/frame/environment-gpu.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +3 -2
- package/dist/tools/frame/environment.js +8 -4
- package/dist/tools/frame/environment.js.map +1 -1
- package/dist/tools/frame/froxel.d.ts +58 -0
- package/dist/tools/frame/froxel.js +115 -0
- package/dist/tools/frame/froxel.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +90 -0
- package/dist/tools/frame/grid.js +112 -13
- package/dist/tools/frame/grid.js.map +1 -1
- package/dist/tools/frame/index.d.ts +14 -0
- package/dist/tools/frame/index.js +45 -4
- package/dist/tools/frame/index.js.map +1 -1
- package/dist/tools/frame/medium.d.ts +16 -0
- package/dist/tools/frame/medium.js +3 -1
- package/dist/tools/frame/medium.js.map +1 -1
- package/dist/tools/frame/mie.d.ts +9 -0
- package/dist/tools/frame/mie.js +18 -0
- package/dist/tools/frame/mie.js.map +1 -1
- package/dist/tools/frame/mlp-nn.d.ts +36 -0
- package/dist/tools/frame/mlp-nn.js +159 -0
- package/dist/tools/frame/mlp-nn.js.map +1 -0
- package/dist/tools/frame/mlp-tza.d.ts +29 -0
- package/dist/tools/frame/mlp-tza.js +186 -0
- package/dist/tools/frame/mlp-tza.js.map +1 -0
- package/dist/tools/frame/mlp.d.ts +183 -0
- package/dist/tools/frame/mlp.js +434 -0
- package/dist/tools/frame/mlp.js.map +1 -0
- package/dist/tools/frame/ms-exit.d.ts +42 -0
- package/dist/tools/frame/ms-exit.js +90 -0
- package/dist/tools/frame/ms-exit.js.map +1 -0
- package/dist/tools/frame/multi-scale.d.ts +152 -0
- package/dist/tools/frame/multi-scale.js +302 -0
- package/dist/tools/frame/multi-scale.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +6 -5
- package/dist/tools/frame/neural-weights.js +234 -235
- package/dist/tools/frame/neural-weights.js.map +1 -1
- package/dist/tools/frame/neural.js +1 -1
- package/dist/tools/frame/neural.js.map +1 -1
- package/dist/tools/frame/occluders.d.ts +51 -0
- package/dist/tools/frame/occluders.js +72 -0
- package/dist/tools/frame/occluders.js.map +1 -0
- package/dist/tools/frame/pyramid-layout.d.ts +17 -0
- package/dist/tools/frame/pyramid-layout.js +47 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -1
- package/dist/tools/frame/shadows.d.ts +110 -0
- package/dist/tools/frame/shadows.js +286 -0
- package/dist/tools/frame/shadows.js.map +1 -1
- package/dist/tools/frame/sparse.d.ts +82 -0
- package/dist/tools/frame/sparse.js +242 -1
- package/dist/tools/frame/sparse.js.map +1 -1
- package/dist/tools/frame/spectral-stack.d.ts +159 -0
- package/dist/tools/frame/spectral-stack.js +391 -0
- package/dist/tools/frame/spectral-stack.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +21 -2
- package/dist/tools/frame/spectral.js +30 -8
- package/dist/tools/frame/spectral.js.map +1 -1
- package/dist/tools/frame/stack.d.ts +115 -0
- package/dist/tools/frame/stack.js +290 -0
- package/dist/tools/frame/stack.js.map +1 -0
- package/dist/tools/frame/view.d.ts +131 -0
- package/dist/tools/frame/view.js +337 -0
- package/dist/tools/frame/view.js.map +1 -0
- package/dist/tools/index.d.ts +66 -15
- package/dist/tools/index.js +55 -11
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/internal.d.ts +58 -17
- package/dist/tools/internal.js +65 -11
- package/dist/tools/internal.js.map +1 -1
- package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
- package/dist/tools/nanovdb/build-from-vdb.js +10 -2
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
- package/dist/tools/nanovdb/bytes.d.ts +17 -4
- package/dist/tools/nanovdb/bytes.js +46 -3
- package/dist/tools/nanovdb/bytes.js.map +1 -1
- package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
- package/dist/tools/nanovdb/coarse-first.js +7 -1
- package/dist/tools/nanovdb/coarse-first.js.map +1 -1
- package/dist/tools/nanovdb/half.d.ts +22 -0
- package/dist/tools/nanovdb/half.js +73 -0
- package/dist/tools/nanovdb/half.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +3 -1
- package/dist/tools/nanovdb/index.js +2 -1
- package/dist/tools/nanovdb/index.js.map +1 -1
- package/dist/tools/nanovdb/inspect.d.ts +10 -1
- package/dist/tools/nanovdb/inspect.js +8 -1
- package/dist/tools/nanovdb/inspect.js.map +1 -1
- package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
- package/dist/tools/nanovdb/leaf-codec.js +40 -4
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
- package/dist/tools/nanovdb/quantize.d.ts +39 -10
- package/dist/tools/nanovdb/quantize.js +96 -44
- package/dist/tools/nanovdb/quantize.js.map +1 -1
- package/dist/tools/nanovdb/resample.d.ts +20 -3
- package/dist/tools/nanovdb/resample.js +20 -7
- package/dist/tools/nanovdb/resample.js.map +1 -1
- package/dist/tools/nanovdb/serialize.d.ts +34 -3
- package/dist/tools/nanovdb/serialize.js +51 -7
- package/dist/tools/nanovdb/serialize.js.map +1 -1
- package/dist/tools/nanovdb/stats.d.ts +34 -5
- package/dist/tools/nanovdb/stats.js +87 -11
- package/dist/tools/nanovdb/stats.js.map +1 -1
- package/dist/tools/nanovdb/transform.d.ts +4 -0
- package/dist/tools/nanovdb/transform.js +3 -0
- package/dist/tools/nanovdb/transform.js.map +1 -1
- package/dist/tools/nanovdb/tree.d.ts +14 -3
- package/dist/tools/nanovdb/tree.js +25 -13
- package/dist/tools/nanovdb/tree.js.map +1 -1
- package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
- package/dist/tools/nanovdb/write-nvdb.js +108 -28
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
- package/dist/tools/nvdb-file.d.ts +77 -7
- package/dist/tools/nvdb-file.js +177 -20
- package/dist/tools/nvdb-file.js.map +1 -1
- package/dist/tools/nvdb-stream.d.ts +23 -7
- package/dist/tools/nvdb-stream.js +78 -34
- package/dist/tools/nvdb-stream.js.map +1 -1
- package/dist/tools/reference/analytic.d.ts +41 -0
- package/dist/tools/reference/analytic.js +95 -0
- package/dist/tools/reference/analytic.js.map +1 -0
- package/dist/tools/reference/environment.d.ts +62 -0
- package/dist/tools/reference/environment.js +154 -0
- package/dist/tools/reference/environment.js.map +1 -0
- package/dist/tools/reference/index.d.ts +12 -0
- package/dist/tools/reference/index.js +13 -0
- package/dist/tools/reference/index.js.map +1 -0
- package/dist/tools/reference/media.d.ts +14 -0
- package/dist/tools/reference/media.js +30 -0
- package/dist/tools/reference/media.js.map +1 -0
- package/dist/tools/reference/rng.d.ts +20 -0
- package/dist/tools/reference/rng.js +30 -0
- package/dist/tools/reference/rng.js.map +1 -0
- package/dist/tools/reference/scene.d.ts +312 -0
- package/dist/tools/reference/scene.js +169 -0
- package/dist/tools/reference/scene.js.map +1 -0
- package/dist/tools/reference/tables.d.ts +98 -0
- package/dist/tools/reference/tables.js +264 -0
- package/dist/tools/reference/tables.js.map +1 -0
- package/dist/tools/reference/trace.d.ts +160 -0
- package/dist/tools/reference/trace.js +497 -0
- package/dist/tools/reference/trace.js.map +1 -0
- package/dist/tools/vdb/blosc-write.d.ts +43 -0
- package/dist/tools/vdb/blosc-write.js +197 -0
- package/dist/tools/vdb/blosc-write.js.map +1 -0
- package/dist/tools/vdb/blosc.d.ts +35 -5
- package/dist/tools/vdb/blosc.js +82 -26
- package/dist/tools/vdb/blosc.js.map +1 -1
- package/dist/tools/vdb/blosclz.d.ts +33 -0
- package/dist/tools/vdb/blosclz.js +112 -0
- package/dist/tools/vdb/blosclz.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +13 -3
- package/dist/tools/vdb/byte-reader.js +26 -4
- package/dist/tools/vdb/byte-reader.js.map +1 -1
- package/dist/tools/vdb/compression.d.ts +13 -5
- package/dist/tools/vdb/compression.js +13 -2
- package/dist/tools/vdb/compression.js.map +1 -1
- package/dist/tools/vdb/grid.js +8 -2
- package/dist/tools/vdb/grid.js.map +1 -1
- package/dist/tools/vdb/index.d.ts +2 -1
- package/dist/tools/vdb/index.js.map +1 -1
- package/dist/tools/vdb/lz4.d.ts +30 -0
- package/dist/tools/vdb/lz4.js +228 -0
- package/dist/tools/vdb/lz4.js.map +1 -0
- package/dist/tools/vdb/metadata.js +1 -1
- package/dist/tools/vdb/metadata.js.map +1 -1
- package/dist/tools/vdb/parse.d.ts +24 -2
- package/dist/tools/vdb/parse.js +102 -32
- package/dist/tools/vdb/parse.js.map +1 -1
- package/dist/tools/vdb/point-render-data.d.ts +49 -1
- package/dist/tools/vdb/point-render-data.js +91 -11
- package/dist/tools/vdb/point-render-data.js.map +1 -1
- package/dist/tools/vdb/points.d.ts +26 -0
- package/dist/tools/vdb/points.js +46 -5
- package/dist/tools/vdb/points.js.map +1 -1
- package/dist/tools/vdb/types.d.ts +59 -2
- package/dist/tools/vdb/types.js.map +1 -1
- package/dist/tools/wvdb/bake.d.ts +38 -9
- package/dist/tools/wvdb/bake.js +63 -13
- package/dist/tools/wvdb/bake.js.map +1 -1
- package/dist/tools/wvdb/dense.d.ts +80 -1
- package/dist/tools/wvdb/dense.js +67 -8
- package/dist/tools/wvdb/dense.js.map +1 -1
- package/dist/tools/wvdb/format.d.ts +59 -0
- package/dist/tools/wvdb/format.js +3 -0
- package/dist/tools/wvdb/format.js.map +1 -1
- package/dist/tools/wvdb/index.d.ts +1 -0
- package/dist/tools/wvdb/index.js +1 -0
- package/dist/tools/wvdb/index.js.map +1 -1
- package/dist/tools/wvdb/level-set.d.ts +10 -2
- package/dist/tools/wvdb/level-set.js.map +1 -1
- package/dist/tools/wvdb/nanovdb.d.ts +6 -1
- package/dist/tools/wvdb/nanovdb.js +5 -1
- package/dist/tools/wvdb/nanovdb.js.map +1 -1
- package/dist/tools/wvdb/partial.d.ts +74 -0
- package/dist/tools/wvdb/partial.js +233 -0
- package/dist/tools/wvdb/partial.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +77 -1
- package/dist/tools/wvdb/read.js +30 -7
- package/dist/tools/wvdb/read.js.map +1 -1
- package/dist/tools/wvdb/write.d.ts +23 -1
- package/dist/tools/wvdb/write.js +8 -1
- package/dist/tools/wvdb/write.js.map +1 -1
- package/package.json +2 -1
- package/vendor/VENDOR.md +21 -6
- package/vendor/pnanovdb.wgsl +52 -14
- package/dist/three/frame/blackbody.d.ts +0 -42
- package/dist/three/frame/blackbody.js +0 -74
- package/dist/three/frame/blackbody.js.map +0 -1
- package/dist/three/frame/chunks.d.ts +0 -157
- package/dist/three/frame/chunks.js +0 -559
- package/dist/three/frame/chunks.js.map +0 -1
- package/dist/three/frame/density-material.d.ts +0 -53
- package/dist/three/frame/density-material.js +0 -353
- package/dist/three/frame/density-material.js.map +0 -1
- package/dist/three/frame/environment-grid-material.d.ts +0 -21
- package/dist/three/frame/environment-grid-material.js +0 -184
- package/dist/three/frame/environment-grid-material.js.map +0 -1
- package/dist/three/frame/environment-material.d.ts +0 -22
- package/dist/three/frame/environment-material.js +0 -87
- package/dist/three/frame/environment-material.js.map +0 -1
- package/dist/three/frame/grid-mip-material.d.ts +0 -12
- package/dist/three/frame/grid-mip-material.js +0 -61
- package/dist/three/frame/grid-mip-material.js.map +0 -1
- package/dist/three/frame/inject-material.d.ts +0 -56
- package/dist/three/frame/inject-material.js +0 -424
- package/dist/three/frame/inject-material.js.map +0 -1
- package/dist/three/frame/integrate-material.d.ts +0 -26
- package/dist/three/frame/integrate-material.js +0 -198
- package/dist/three/frame/integrate-material.js.map +0 -1
- package/dist/three/frame/layout.d.ts +0 -34
- package/dist/three/frame/layout.js +0 -48
- package/dist/three/frame/layout.js.map +0 -1
- package/dist/three/frame/lighting-material.d.ts +0 -41
- package/dist/three/frame/lighting-material.js +0 -257
- package/dist/three/frame/lighting-material.js.map +0 -1
- package/dist/three/frame/lights.d.ts +0 -11
- package/dist/three/frame/lights.js +0 -16
- package/dist/three/frame/lights.js.map +0 -1
- package/dist/three/frame/neural.d.ts +0 -14
- package/dist/three/frame/neural.js +0 -105
- package/dist/three/frame/neural.js.map +0 -1
- package/dist/three/frame/phase.d.ts +0 -44
- package/dist/three/frame/phase.js +0 -80
- package/dist/three/frame/phase.js.map +0 -1
- package/dist/three/frame/shadow-density-material.d.ts +0 -30
- package/dist/three/frame/shadow-density-material.js +0 -123
- package/dist/three/frame/shadow-density-material.js.map +0 -1
- package/dist/three/frame/temporal-material.d.ts +0 -29
- package/dist/three/frame/temporal-material.js +0 -152
- package/dist/three/frame/temporal-material.js.map +0 -1
- package/dist/three/frame/transmittance-material.d.ts +0 -31
- package/dist/three/frame/transmittance-material.js +0 -315
- package/dist/three/frame/transmittance-material.js.map +0 -1
- package/dist/three/frame/view.d.ts +0 -103
- package/dist/three/frame/view.js +0 -296
- package/dist/three/frame/view.js.map +0 -1
- package/dist/three/frame/volume-shadow-material.d.ts +0 -36
- package/dist/three/frame/volume-shadow-material.js +0 -128
- package/dist/three/frame/volume-shadow-material.js.map +0 -1
- package/dist/three/sequence.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"density-material.js","sourceRoot":"","sources":["../../../src/three/frame/density-material.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6FAA6F;AAC7F,uGAAuG;AACvG,2DAA2D;AAC3D,4GAA4G;AAC5G,kGAAkG;AAClG,oGAAoG;AACpG,gEAAgE;AAChE,4DAA4D;AAE5D;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,GAOd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAA4C,CAAC;AAEjN,4FAA4F;AAC5F,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE,CAAC,CAAC;IAChD,sBAAsB,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;IACpD,sBAAsB,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;IACpD,iDAAiD;IACjD,sBAAsB,EAAE,OAAO,CAAC,IAAI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AAG,IAAI,CAAC,qBAAqB,CAC5C,qBAAqB,CAAC,uBAAuB,EAC7C,uBAAuB,EACvB,oBAAoB,EACpB,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,sBAAsB,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAC7H,CAAC;gBAEF,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YAEH,wGAAwG;YACxG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YAC3D,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzE,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YAEhD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC,CAAC,EAAE,CAAC;QAEL,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,aAAa,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACpF,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/FrameDensityMaterial.js L45–361 (density shadow uniforms,\n// environment modes, constructor, the grey `buildNodes`); K3.5: L66–67 (the sky transmittance maps),\n// L101–137 (setSpectral), L363–537 (buildSpectralNodes).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; reads density only through `vdbVolumeNodes` (the VDBVolumeSource seam), so\n// one material is built per volume source (DIVERGES V30); K3.4: the octave uniform (L57–58) and its\n// frameShadowedLight / frameShadowTotal terms (L272–294, L344).\n// Divergences: DIVERGES.md (K3.3, K3.4 rows), V23–V25, V30.\n\n/**\n * The density pass of `'frame'` lighting (R1 §2 step 3): per froxel per volume (one instance per\n * slice of the volume's froxel rectangle), up to `subSteps` extinction samples across the slice;\n * albedo and emission at the visibility-weighted position, plus the shadow grid's transmittance\n * there (the scene light slots get the phase here, at each volume's own visible position). The\n * environment is added along the outward direction of the volume (or from the environment grid).\n * Four RGBA16F targets, extinction-weighted and additive, so the lighting pass reads\n * extinction-weighted means of all volumes in a froxel. Spectral (K3.5): three targets, (albedo ×\n * extinction of each channel, weight), (emission × weight, visible t × weight), (extinction of each\n * channel, 0), the weight being the mean extinction of the channels; no light slots (the lighting pass\n * samples the shadow grid).\n */\n\nimport * as THREE from \"three\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport type { VDBThreeVolumeSource, VDBVolumeNodes, VDBVolumeNodesOptions, VDBVolumeUniforms } from \"../volume-source.js\";\nimport { vdbVolumeNodes } from \"../volume-source.js\";\nimport {\n createFrameVolumeUniforms,\n createGridNodes,\n frameDistanceFade,\n frameFragCoord,\n frameGetFroxel,\n frameNoise,\n frameMeanComponent,\n frameShadowTotal,\n frameShadowedLight,\n frameSpectralShadowTotal,\n frameTileVertex,\n getBoxSteps,\n getFroxelLod,\n getSampledLod,\n type EnvironmentGridUniforms,\n type FrameVolumeUniforms,\n type FroxelUniforms,\n type GridUniforms,\n type LightUniforms,\n type TileUniforms,\n} from \"./chunks.js\";\nimport { VDBFrameEnvironmentMaterial } from \"./environment-material.js\";\n\nconst { Discard, Fn, If, Loop, dot, exp, float, int, length, mat3, max, min, mix, normalize, outputStruct, property, select, texture, uniform, vec2, vec3, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\n// NOTE Shadow grid data for the density pass. Each volume samples its own visible position.\nexport const createDensityShadowUniforms = () => ({\n frameTransmittanceMap0: texture(new THREE.Texture()),\n frameTransmittanceMap1: texture(new THREE.Texture()),\n // NOTE Direct transmittance of the 6 light slots\n frameTransmittanceMap2: texture(new THREE.Texture()),\n frameTransmittanceMap3: texture(new THREE.Texture()),\n // NOTE Scene lights with a shadow slot. Their slots get the phase here, at the visible position of each volume.\n frameShadowSceneLightCount: uniform(0, \"int\"),\n // NOTE One phase for all volumes, from the renderer settings\n framePhase: uniform(new THREE.Vector4()),\n framePhaseSpectrum: uniform(new THREE.Vector3()),\n // NOTE Scattering octaves of the renderer settings (phase.ts). Count 0 is off.\n frameScatteringOctaves: uniform(new THREE.Vector4()),\n // NOTE 1 with diffusion multiple scattering. Then sky up and down have two-sided totals (frameIsotropicDiffusion).\n frameDiffusion: uniform(0, \"int\"),\n frameUseShadows: uniform(0, \"int\"),\n frameCameraMatrixWorld: uniform(new THREE.Matrix4()),\n // NOTE Environment light of the last cascade voxels (VDBFrameEnvironmentGridMaterial)\n frameEnvironmentGridMap: texture(new THREE.Texture()),\n // NOTE frameDensityEnvironment values\n frameEnvironmentMode: uniform(0, \"int\"),\n // NOTE Renderer settings.spectral: targets 0 and 1 of slot group 0 (sky up and sky down, spectrum.ts)\n frameSkyTransmittanceMaps: [texture(new THREE.Texture()), texture(new THREE.Texture())],\n});\n\nexport type DensityShadowUniforms = ReturnType<typeof createDensityShadowUniforms>;\n\n// NOTE Environment in the density pass: outward direction, none (only the slot light, in the lighting pass),\n// or the environment grid\nexport const frameDensityEnvironment = { outward: 0, none: 1, grid: 2 } as const;\n\nexport interface VDBFrameDensityMaterialOptions {\n froxelUniforms: FroxelUniforms;\n froxelTileUniforms: TileUniforms;\n gridUniforms: GridUniforms;\n environmentGridUniforms: EnvironmentGridUniforms;\n densityShadowUniforms: DensityShadowUniforms;\n lightUniforms: LightUniforms;\n source: VDBThreeVolumeSource;\n sourceUniforms: VDBVolumeUniforms;\n mipmaps: boolean;\n emissionColor?: VDBVolumeNodesOptions[\"emissionColor\"];\n}\n\n// NOTE Writes the extinction and material of one volume into the froxel grid. Lights are added in the lighting pass.\n// NOTE The environment is added here, along the outward direction of each volume.\n// NOTE One material per volume source. Pool meshes set the volume uniforms before each draw.\nexport class VDBFrameDensityMaterial extends VDBFrameEnvironmentMaterial {\n readonly volumeUniforms: FrameVolumeUniforms = createFrameVolumeUniforms();\n readonly frameRect = uniform(new THREE.Vector4());\n readonly frameSliceStart = uniform(0.0);\n readonly frameUniforms: VDBFrameDensityMaterialOptions;\n readonly sourceUniforms: VDBVolumeUniforms;\n readonly source: VDBThreeVolumeSource;\n mipmaps: boolean;\n // NOTE Renderer settings.spectral: three targets, no light slots (the lighting pass samples the shadow grid)\n spectral = false;\n\n constructor(o: VDBFrameDensityMaterialOptions) {\n super();\n\n this.name = \"VDBFrameDensityMaterial\";\n this.frameUniforms = o;\n this.source = o.source;\n this.sourceUniforms = o.sourceUniforms;\n this.mipmaps = o.mipmaps;\n this.buildNodes();\n\n this.side = THREE.DoubleSide;\n this.forceSinglePass = true;\n this.depthTest = false;\n this.depthWrite = false;\n this.transparent = true;\n this.blending = THREE.CustomBlending;\n this.blendEquation = THREE.AddEquation;\n this.blendSrc = THREE.OneFactor;\n this.blendDst = THREE.OneFactor;\n this.blendSrcAlpha = THREE.OneFactor;\n this.blendDstAlpha = THREE.OneFactor;\n }\n\n // NOTE Mip sampling is in the shader only when the volume uses mipmaps\n setMipmaps(mipmaps: boolean): void {\n if (mipmaps !== this.mipmaps) {\n this.mipmaps = mipmaps;\n this.environmentNodes = [];\n this.buildNodes();\n this.needsUpdate = true;\n }\n }\n\n setSpectral(spectral: boolean): void {\n if (spectral !== this.spectral) {\n this.spectral = spectral;\n this.environmentNodes = [];\n this.buildNodes();\n this.needsUpdate = true;\n }\n }\n\n override rebuildNodes(): void {\n this.buildNodes();\n }\n\n buildNodes(): void {\n if (this.spectral) {\n this.buildSpectralNodes();\n\n return;\n }\n\n const { froxelUniforms, froxelTileUniforms, gridUniforms, environmentGridUniforms, densityShadowUniforms, lightUniforms, emissionColor } = this.frameUniforms;\n const volume: VDBVolumeNodes = vdbVolumeNodes(this.source, this.sourceUniforms, { useMipmaps: this.mipmaps, ...(emissionColor ? { emissionColor } : {}) });\n const grid = createGridNodes(gridUniforms);\n const { frameViewToLocal, frameLocalToView, frameOpacity, frameScatterColor } = this.volumeUniforms;\n const frameWorldScale = this.sourceUniforms.worldScale;\n const { frameCameraMatrixWorld } = densityShadowUniforms;\n const { froxelSubSteps, frameJitter } = froxelUniforms;\n\n const densityAlbedo = property(\"vec4\");\n const densityEmission = property(\"vec4\");\n const densityShadow0 = property(\"vec4\");\n const densityShadow1 = property(\"vec4\");\n\n this.vertexNode = frameTileVertex(froxelTileUniforms, this.frameRect, this.frameSliceStart);\n\n this.colorNode = Fn(() => {\n const fragCoord = frameFragCoord(froxelTileUniforms.frameTargetSize).toVar();\n const froxel = frameGetFroxel(froxelUniforms, fragCoord);\n const viewNear = froxel.viewNear.toVar();\n const viewFar = froxel.viewFar.toVar();\n const localNear = frameViewToLocal.mul(vec4(viewNear, 1.0)).xyz.toVar();\n const localFar = frameViewToLocal.mul(vec4(viewFar, 1.0)).xyz.toVar();\n const boxSegment = volume.boxSegment(localNear, localFar).toVar();\n\n If(boxSegment.x.greaterThanEqual(boxSegment.y), () => {\n Discard();\n });\n\n const segment = boxSegment.y.sub(boxSegment.x).toVar();\n const widthLod = getFroxelLod(froxelUniforms, froxel, volume, float(0.0), frameWorldScale);\n const sampledLod = getSampledLod(this.sourceUniforms, this.source.channels.mask, widthLod, this.mipmaps);\n const steps = getBoxSteps(volume, localNear, localFar, segment, sampledLod, froxelSubSteps);\n const subStepCount = float(steps);\n const subStepLength = length(viewFar.sub(viewNear)).mul(segment).div(subStepCount).toVar();\n const lod = max(widthLod, volume.getLod(subStepLength.div(frameWorldScale))).toVar();\n\n // NOTE Mean extinction of the slice. The visibility-weighted mean position is the light position in the lighting pass.\n const extinctionSum = float(0.0).toVar();\n const transmittance = float(1.0).toVar();\n const visibleWeight = float(0.0).toVar();\n const visibleTSum = float(0.0).toVar();\n const jitter = frameNoise(frameJitter, fragCoord).toVar();\n\n Loop({ start: int(0), end: steps, type: \"int\", condition: \"<\" }, ({ i }: { i: VDBTslNode }) => {\n const t = boxSegment.x.add(segment.mul(float(i).add(jitter).div(subStepCount))).toVar();\n const extinction = volume\n .sampleExtinction(mix(localNear, localFar, t), lod)\n .mul(frameOpacity)\n .mul(frameDistanceFade(froxelUniforms, mix(viewNear, viewFar, t)))\n .toVar();\n const stepTransmittance = exp(extinction.mul(subStepLength).negate()).toVar();\n const weight = transmittance.mul(float(1.0).sub(stepTransmittance)).toVar();\n\n visibleWeight.addAssign(weight);\n visibleTSum.addAssign(weight.mul(t));\n extinctionSum.addAssign(extinction);\n transmittance.mulAssign(stepTransmittance);\n });\n\n // NOTE The mean over the whole slice: the box part's mean, weighted by its share of the slice\n const extinction = extinctionSum.div(subStepCount).mul(segment).toVar();\n\n If(extinction.lessThanEqual(0.0), () => {\n Discard();\n });\n\n const visibleT = select(visibleWeight.greaterThan(0.0), visibleTSum.div(visibleWeight), float(0.5)).toVar();\n const visiblePosition = mix(localNear, localFar, visibleT).toVar();\n const albedo = volume.sampleAlbedo(visiblePosition, lod).toVar();\n const emission = volume.sampleEmission(visiblePosition, lod).add(frameScatterColor).toVar();\n\n // NOTE Shadows at the visible position of this volume, not of other volumes in the froxel\n // NOTE shadow0, shadow1: total transmittance. direct0, direct1: direct transmittance of the 6 light slots.\n const shadow0 = vec4(1.0).toVar();\n const shadow1 = vec4(1.0).toVar();\n const direct0 = vec4(1.0).toVar();\n const direct1 = vec4(1.0).toVar();\n const visibleWorldPosition = frameCameraMatrixWorld.mul(vec4(mix(viewNear, viewFar, visibleT), 1.0)).xyz.toVar();\n\n If(densityShadowUniforms.frameUseShadows.equal(1), () => {\n const shadows = grid.sampleShadows(\n [densityShadowUniforms.frameTransmittanceMap0, densityShadowUniforms.frameTransmittanceMap1, densityShadowUniforms.frameTransmittanceMap2, densityShadowUniforms.frameTransmittanceMap3],\n visibleWorldPosition,\n );\n\n shadow0.assign(shadows[0]);\n shadow1.assign(shadows[1]);\n direct0.assign(shadows[2]);\n direct1.assign(shadows[3]);\n });\n\n // NOTE Scene light slots store phase * direct + scattered (frameShadowedLight), green channel.\n // Phases of each channel: the lighting pass adds the red and blue phase.\n // NOTE Other slots (sky up and down, the environment light) store the isotropic total transmittance.\n const rayDirection = normalize(mat3(frameCameraMatrixWorld).mul(viewFar.sub(viewNear))).toVar();\n const lightSlots: [VDBTslNode, \"x\" | \"y\" | \"z\" | \"w\", VDBTslNode][] = [\n [shadow0, \"z\", direct0.x],\n [shadow0, \"w\", direct0.y],\n [shadow1, \"x\", direct0.z],\n [shadow1, \"y\", direct0.w],\n [shadow1, \"z\", direct1.x],\n [shadow1, \"w\", direct1.y],\n ];\n\n const { frameScatteringOctaves } = densityShadowUniforms;\n\n lightSlots.forEach(([shadow, channel, direct], index) => {\n If(int(index).lessThan(densityShadowUniforms.frameShadowSceneLightCount), () => {\n const light = lightUniforms.frameLightPositions.element(index).toVar();\n\n shadow[channel].assign(\n frameShadowedLight(\n densityShadowUniforms.framePhase,\n densityShadowUniforms.framePhaseSpectrum,\n frameScatteringOctaves,\n rayDirection,\n select(light.w.lessThan(1.5), light.xyz, normalize(light.xyz.sub(visibleWorldPosition))),\n vec2(direct, shadow[channel]),\n ).g,\n );\n }).Else(() => {\n shadow[channel].assign(frameShadowTotal(shadow[channel], frameScatteringOctaves));\n });\n });\n\n shadow0.x.assign(frameShadowTotal(shadow0.x, frameScatteringOctaves));\n shadow0.y.assign(frameShadowTotal(shadow0.y, frameScatteringOctaves));\n\n const { frameEnvironmentMode } = densityShadowUniforms;\n\n // NOTE Environment along the outward direction from the volume center, the same as per-volume lighting.\n // NOTE Its shadow is between the sky down and sky up transmittance of the shadow grid.\n if (this.environment) {\n If(frameEnvironmentMode.equal(frameDensityEnvironment.outward), () => {\n const skyDirection = normalize(lightUniforms.frameSkyDirection).toVar();\n const outwardDirection = select(\n length(visiblePosition).greaterThan(1e-4),\n normalize(mat3(frameCameraMatrixWorld).mul(mat3(frameLocalToView).mul(visiblePosition))),\n skyDirection,\n ).toVar();\n const skyBlend = dot(outwardDirection, skyDirection).mul(0.5).add(0.5).toVar();\n const environmentShadow = mix(shadow0.y, shadow0.x, skyBlend);\n\n // NOTE Diffusion: the outward and the inward irradiance, each with its two-sided total. Uniform light then gives E.\n If(densityShadowUniforms.frameDiffusion.equal(1), () => {\n const inwardShadow = mix(shadow0.x, shadow0.y, skyBlend);\n\n emission.addAssign(\n albedo\n .mul(this.environmentIrradiance(outwardDirection).mul(environmentShadow).add(this.environmentIrradiance(outwardDirection.negate()).mul(inwardShadow)).mul(0.5))\n .mul(1.0 / Math.PI),\n );\n }).Else(() => {\n emission.addAssign(albedo.mul(this.environmentIrradiance(outwardDirection)).mul(environmentShadow).mul(1.0 / Math.PI));\n });\n });\n }\n\n // NOTE Environment light of the environment grid at the visible position\n If(frameEnvironmentMode.equal(frameDensityEnvironment.grid), () => {\n const viewPosition = mix(viewNear, viewFar, visibleT);\n const worldPosition = frameCameraMatrixWorld.mul(vec4(viewPosition, 1.0)).xyz.toVar();\n const environment = grid.sampleEnvironmentGrid(\n densityShadowUniforms.frameEnvironmentGridMap,\n environmentGridUniforms,\n worldPosition,\n vec4(lightUniforms.frameEnvironmentUnshadowed.mul(frameShadowTotal(float(1.0), frameScatteringOctaves)), 1.0),\n );\n\n emission.addAssign(albedo.mul(environment.rgb).mul(1.0 / Math.PI));\n });\n\n // NOTE Values are weighted by extinction. Additive blending then gives extinction-weighted means.\n densityAlbedo.assign(vec4(albedo.mul(extinction), extinction));\n densityEmission.assign(vec4(emission.mul(extinction), visibleT.mul(extinction)));\n // NOTE Light slots can be more than 1 (phase). The limit keeps them below the half float maximum.\n densityShadow0.assign(min(shadow0.mul(extinction), 6.0e4));\n densityShadow1.assign(min(shadow1.mul(extinction), 6.0e4));\n\n return vec4(0.0);\n })();\n\n this.outputNode = outputStruct(densityAlbedo, densityEmission, densityShadow0, densityShadow1);\n }\n\n // NOTE Spectral density pass. Targets: (albedo * extinction of each channel, weight), (emission * weight,\n // visibleT * weight), (extinction of each channel, 0). Weight is the mean extinction of the channels.\n // NOTE Light slots are not here: they need 3 values each. The lighting pass samples the shadow grid at the froxel.\n buildSpectralNodes(): void {\n const { froxelUniforms, froxelTileUniforms, gridUniforms, environmentGridUniforms, densityShadowUniforms, lightUniforms, emissionColor } = this.frameUniforms;\n const volume: VDBVolumeNodes = vdbVolumeNodes(this.source, this.sourceUniforms, { useMipmaps: this.mipmaps, ...(emissionColor ? { emissionColor } : {}) });\n const grid = createGridNodes(gridUniforms);\n const { frameViewToLocal, frameLocalToView, frameOpacity, frameScatterColor, frameExtinctionSpectrum } = this.volumeUniforms;\n const frameWorldScale = this.sourceUniforms.worldScale;\n const { frameCameraMatrixWorld, frameScatteringOctaves, frameEnvironmentMode } = densityShadowUniforms;\n const { froxelSubSteps, frameJitter } = froxelUniforms;\n\n const densityAlbedo = property(\"vec4\");\n const densityEmission = property(\"vec4\");\n const densityExtinction = property(\"vec4\");\n\n this.vertexNode = frameTileVertex(froxelTileUniforms, this.frameRect, this.frameSliceStart);\n\n this.colorNode = Fn(() => {\n const fragCoord = frameFragCoord(froxelTileUniforms.frameTargetSize).toVar();\n const froxel = frameGetFroxel(froxelUniforms, fragCoord);\n const viewNear = froxel.viewNear.toVar();\n const viewFar = froxel.viewFar.toVar();\n const localNear = frameViewToLocal.mul(vec4(viewNear, 1.0)).xyz.toVar();\n const localFar = frameViewToLocal.mul(vec4(viewFar, 1.0)).xyz.toVar();\n const boxSegment = volume.boxSegment(localNear, localFar).toVar();\n\n If(boxSegment.x.greaterThanEqual(boxSegment.y), () => {\n Discard();\n });\n\n const segment = boxSegment.y.sub(boxSegment.x).toVar();\n const widthLod = getFroxelLod(froxelUniforms, froxel, volume, float(0.0), frameWorldScale);\n const sampledLod = getSampledLod(this.sourceUniforms, this.source.channels.mask, widthLod, this.mipmaps);\n const steps = getBoxSteps(volume, localNear, localFar, segment, sampledLod, froxelSubSteps);\n const subStepCount = float(steps);\n const subStepLength = length(viewFar.sub(viewNear)).mul(segment).div(subStepCount).toVar();\n const lod = max(widthLod, volume.getLod(subStepLength.div(frameWorldScale))).toVar();\n\n // NOTE The visible position uses the mean transmittance of the channels\n const extinctionSum = float(0.0).toVar();\n const transmittance = vec3(1.0).toVar();\n const visibleWeight = float(0.0).toVar();\n const visibleTSum = float(0.0).toVar();\n const jitter = frameNoise(frameJitter, fragCoord).toVar();\n\n Loop({ start: int(0), end: steps, type: \"int\", condition: \"<\" }, ({ i }: { i: VDBTslNode }) => {\n const t = boxSegment.x.add(segment.mul(float(i).add(jitter).div(subStepCount))).toVar();\n const extinction = volume\n .sampleExtinction(mix(localNear, localFar, t), lod)\n .mul(frameOpacity)\n .mul(frameDistanceFade(froxelUniforms, mix(viewNear, viewFar, t)))\n .toVar();\n const stepTransmittance = exp(frameExtinctionSpectrum.mul(extinction).mul(subStepLength).negate()).toVar();\n const weight = frameMeanComponent(transmittance.mul(float(1.0).sub(stepTransmittance))).toVar();\n\n visibleWeight.addAssign(weight);\n visibleTSum.addAssign(weight.mul(t));\n extinctionSum.addAssign(extinction);\n transmittance.mulAssign(stepTransmittance);\n });\n\n // NOTE The mean over the whole slice: the box part's mean, weighted by its share of the slice\n const extinction = frameExtinctionSpectrum.mul(extinctionSum.div(subStepCount).mul(segment)).toVar();\n const weight = frameMeanComponent(extinction).toVar();\n\n If(weight.lessThanEqual(0.0), () => {\n Discard();\n });\n\n const visibleT = select(visibleWeight.greaterThan(0.0), visibleTSum.div(visibleWeight), float(0.5)).toVar();\n const visiblePosition = mix(localNear, localFar, visibleT).toVar();\n const albedo = volume.sampleAlbedo(visiblePosition, lod).toVar();\n const emission = volume.sampleEmission(visiblePosition, lod).add(frameScatterColor).toVar();\n const visibleWorldPosition = frameCameraMatrixWorld.mul(vec4(mix(viewNear, viewFar, visibleT), 1.0)).xyz.toVar();\n\n // NOTE Environment along the outward direction from the volume center, the same as per-volume lighting.\n // NOTE Its shadow is between the sky down and sky up transmittance of each channel.\n if (this.environment) {\n If(frameEnvironmentMode.equal(frameDensityEnvironment.outward), () => {\n const skyUp = vec3(1.0).toVar();\n const skyDown = vec3(1.0).toVar();\n\n If(densityShadowUniforms.frameUseShadows.equal(1), () => {\n const sky = grid.sampleShadows(densityShadowUniforms.frameSkyTransmittanceMaps, visibleWorldPosition);\n\n skyUp.assign(sky[0]!.rgb);\n skyDown.assign(vec3(sky[0]!.a, sky[1]!.r, sky[1]!.g));\n });\n\n const skyDirection = normalize(lightUniforms.frameSkyDirection).toVar();\n const outwardDirection = select(\n length(visiblePosition).greaterThan(1e-4),\n normalize(mat3(frameCameraMatrixWorld).mul(mat3(frameLocalToView).mul(visiblePosition))),\n skyDirection,\n ).toVar();\n const skyBlend = dot(outwardDirection, skyDirection).mul(0.5).add(0.5).toVar();\n const upTotal = frameSpectralShadowTotal(skyUp, frameScatteringOctaves, albedo).toVar();\n const downTotal = frameSpectralShadowTotal(skyDown, frameScatteringOctaves, albedo).toVar();\n const environmentShadow = mix(downTotal, upTotal, skyBlend);\n\n // NOTE Diffusion: the outward and the inward irradiance, each with its two-sided total. Uniform light then gives E.\n If(densityShadowUniforms.frameDiffusion.equal(1), () => {\n const inwardShadow = mix(upTotal, downTotal, skyBlend);\n\n emission.addAssign(\n albedo\n .mul(this.environmentIrradiance(outwardDirection).mul(environmentShadow).add(this.environmentIrradiance(outwardDirection.negate()).mul(inwardShadow)).mul(0.5))\n .mul(1.0 / Math.PI),\n );\n }).Else(() => {\n emission.addAssign(albedo.mul(this.environmentIrradiance(outwardDirection)).mul(environmentShadow).mul(1.0 / Math.PI));\n });\n });\n }\n\n // NOTE Environment light of the environment grid at the visible position\n If(frameEnvironmentMode.equal(frameDensityEnvironment.grid), () => {\n const environment = grid.sampleEnvironmentGrid(\n densityShadowUniforms.frameEnvironmentGridMap,\n environmentGridUniforms,\n visibleWorldPosition,\n vec4(lightUniforms.frameEnvironmentUnshadowed.mul(frameSpectralShadowTotal(vec3(1.0), frameScatteringOctaves, albedo)), 1.0),\n );\n\n emission.addAssign(albedo.mul(environment.rgb).mul(1.0 / Math.PI));\n });\n\n // NOTE Values are weighted. Additive blending then gives weighted means, and the sum of the extinction.\n densityAlbedo.assign(vec4(albedo.mul(extinction), weight));\n densityEmission.assign(vec4(emission.mul(weight), visibleT.mul(weight)));\n densityExtinction.assign(vec4(extinction, 0.0));\n\n return vec4(0.0);\n })();\n\n this.outputNode = outputStruct(densityAlbedo, densityEmission, densityExtinction);\n }\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,E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E,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"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,WAAW,EAAE,CAAC;YAC1C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;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terial.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"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
-
// src/three-openvdb/frame/webgpu/FrameGridMipMaterial.js L1–69 (all).
|
|
3
|
-
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
4
|
-
// Changes: TypeScript. CPU twin: `@pmndrs/vdb/tools` `vdbFrameGridMipLevel`. Divergences: none.
|
|
5
|
-
/**
|
|
6
|
-
* Box filter mips of the last world shadow grid cascade, for multipleScattering `'neural'` (K3.4).
|
|
7
|
-
* Level k (1 to levels − 1) has resolution / 2^k voxels on each side; its z slices are tiles in an
|
|
8
|
-
* atlas (getAtlasLayout), the same as the grid atlas. Each texel is the mean of 2 × 2 × 2 texels of
|
|
9
|
-
* the level before it (edge voxels clamped). The source is the grid atlas (level 1) or the level before.
|
|
10
|
-
*/
|
|
11
|
-
import * as THREE from "three";
|
|
12
|
-
import { NodeMaterial } from "three/webgpu";
|
|
13
|
-
import * as TSL from "three/tsl";
|
|
14
|
-
import { frameFragCoord, frameFullscreenVertex, frameLoad } from "./chunks.js";
|
|
15
|
-
const { Fn, float, floor, ivec2, min, mod, texture, uniform, vec2, vec4 } = TSL;
|
|
16
|
-
export class VDBFrameGridMipMaterial extends NodeMaterial {
|
|
17
|
-
frameMipSource = texture(new THREE.Texture());
|
|
18
|
-
// NOTE Source: voxels on each side, tile columns, first tile, texture size
|
|
19
|
-
frameMipSourceResolution = uniform(1.0);
|
|
20
|
-
frameMipSourceColumns = uniform(1.0);
|
|
21
|
-
frameMipSourceTile = uniform(0.0);
|
|
22
|
-
frameMipSourceSize = uniform(new THREE.Vector2(1.0, 1.0));
|
|
23
|
-
// NOTE Target: voxels on each side, tile columns, texture size
|
|
24
|
-
frameMipResolution = uniform(1.0);
|
|
25
|
-
frameMipColumns = uniform(1.0);
|
|
26
|
-
frameMipSize = uniform(new THREE.Vector2(1.0, 1.0));
|
|
27
|
-
constructor() {
|
|
28
|
-
super();
|
|
29
|
-
this.name = "VDBFrameGridMipMaterial";
|
|
30
|
-
const sourceResolution = this.frameMipSourceResolution;
|
|
31
|
-
const columns = this.frameMipSourceColumns;
|
|
32
|
-
// NOTE Source texel of voxel (x, y, z), edge voxels clamped
|
|
33
|
-
const loadSource = (x, y, z) => {
|
|
34
|
-
const last = sourceResolution.sub(1.0);
|
|
35
|
-
const tile = this.frameMipSourceTile.add(min(z, last));
|
|
36
|
-
const tileXY = vec2(mod(tile, columns), floor(tile.div(columns)));
|
|
37
|
-
const texel = tileXY.mul(sourceResolution).add(vec2(min(x, last), min(y, last)));
|
|
38
|
-
return frameLoad(this.frameMipSource, ivec2(texel), this.frameMipSourceSize).rg;
|
|
39
|
-
};
|
|
40
|
-
this.vertexNode = frameFullscreenVertex;
|
|
41
|
-
this.colorNode = Fn(() => {
|
|
42
|
-
const resolution = this.frameMipResolution;
|
|
43
|
-
const fragCoord = floor(frameFragCoord(this.frameMipSize)).toVar();
|
|
44
|
-
const tile = floor(fragCoord.div(resolution)).toVar();
|
|
45
|
-
const z = tile.y.mul(this.frameMipColumns).add(tile.x).toVar();
|
|
46
|
-
const x = fragCoord.x.sub(tile.x.mul(resolution)).toVar();
|
|
47
|
-
const y = fragCoord.y.sub(tile.y.mul(resolution)).toVar();
|
|
48
|
-
let sum = vec2(0.0);
|
|
49
|
-
for (let i = 0; i < 8; i++) {
|
|
50
|
-
sum = sum.add(loadSource(x.mul(2.0).add(float(i & 1)), y.mul(2.0).add(float((i >> 1) & 1)), z.mul(2.0).add(float((i >> 2) & 1))));
|
|
51
|
-
}
|
|
52
|
-
return vec4(sum.div(8.0), 0.0, 1.0);
|
|
53
|
-
})();
|
|
54
|
-
this.side = THREE.DoubleSide;
|
|
55
|
-
this.forceSinglePass = true;
|
|
56
|
-
this.depthTest = false;
|
|
57
|
-
this.depthWrite = false;
|
|
58
|
-
this.blending = THREE.NoBlending;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=grid-mip-material.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grid-mip-material.js","sourceRoot":"","sources":["../../../src/three/frame/grid-mip-material.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,4GAA4G;AAC5G,gGAAgG;AAEhG;;;;;GAKG;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,cAAc,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAA4C,CAAC;AAEzH,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IAC9C,cAAc,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACvD,2EAA2E;IAClE,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,kBAAkB,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACnE,+DAA+D;IACtD,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,eAAe,GAAG,O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AAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC,CAAC,EAAE,CAAC;QAEL,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/FrameGridMipMaterial.js L1–69 (all).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript. CPU twin: `@pmndrs/vdb/tools` `vdbFrameGridMipLevel`. Divergences: none.\n\n/**\n * Box filter mips of the last world shadow grid cascade, for multipleScattering `'neural'` (K3.4).\n * Level k (1 to levels − 1) has resolution / 2^k voxels on each side; its z slices are tiles in an\n * atlas (getAtlasLayout), the same as the grid atlas. Each texel is the mean of 2 × 2 × 2 texels of\n * the level before it (edge voxels clamped). The source is the grid atlas (level 1) or the level before.\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 { frameFragCoord, frameFullscreenVertex, frameLoad } from \"./chunks.js\";\n\nconst { Fn, float, floor, ivec2, min, mod, texture, uniform, vec2, vec4 } = TSL as unknown as Record<string, VDBTslNode>;\n\nexport class VDBFrameGridMipMaterial extends NodeMaterial {\n readonly frameMipSource = texture(new THREE.Texture());\n // NOTE Source: voxels on each side, tile columns, first tile, texture size\n readonly frameMipSourceResolution = uniform(1.0);\n readonly frameMipSourceColumns = uniform(1.0);\n readonly frameMipSourceTile = uniform(0.0);\n readonly frameMipSourceSize = uniform(new THREE.Vector2(1.0, 1.0));\n // NOTE Target: voxels on each side, tile columns, texture size\n readonly frameMipResolution = uniform(1.0);\n readonly frameMipColumns = uniform(1.0);\n readonly frameMipSize = uniform(new THREE.Vector2(1.0, 1.0));\n\n constructor() {\n super();\n\n this.name = \"VDBFrameGridMipMaterial\";\n\n const sourceResolution = this.frameMipSourceResolution;\n const columns = this.frameMipSourceColumns;\n\n // NOTE Source texel of voxel (x, y, z), edge voxels clamped\n const loadSource = (x: VDBTslNode, y: VDBTslNode, z: VDBTslNode): VDBTslNode => {\n const last = sourceResolution.sub(1.0);\n const tile = this.frameMipSourceTile.add(min(z, last));\n const tileXY = vec2(mod(tile, columns), floor(tile.div(columns)));\n const texel = tileXY.mul(sourceResolution).add(vec2(min(x, last), min(y, last)));\n\n return frameLoad(this.frameMipSource, ivec2(texel), this.frameMipSourceSize).rg;\n };\n\n this.vertexNode = frameFullscreenVertex;\n\n this.colorNode = Fn(() => {\n const resolution = this.frameMipResolution;\n const fragCoord = floor(frameFragCoord(this.frameMipSize)).toVar();\n const tile = floor(fragCoord.div(resolution)).toVar();\n const z = tile.y.mul(this.frameMipColumns).add(tile.x).toVar();\n const x = fragCoord.x.sub(tile.x.mul(resolution)).toVar();\n const y = fragCoord.y.sub(tile.y.mul(resolution)).toVar();\n let sum: VDBTslNode = vec2(0.0);\n\n for (let i = 0; i < 8; i++) {\n sum = sum.add(loadSource(x.mul(2.0).add(float(i & 1)), y.mul(2.0).add(float((i >> 1) & 1)), z.mul(2.0).add(float((i >> 2) & 1))));\n }\n\n return vec4(sum.div(8.0), 0.0, 1.0);\n })();\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"]}
|