@pmndrs/vdb 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/CHANGELOG.md +727 -0
  2. package/LICENSE +21 -0
  3. package/README.md +496 -2
  4. package/THIRD_PARTY_NOTICES.md +315 -0
  5. package/dist/core/compute/atlas.d.ts +102 -0
  6. package/dist/core/compute/atlas.js +103 -0
  7. package/dist/core/compute/atlas.js.map +1 -0
  8. package/dist/core/compute/index.d.ts +13 -0
  9. package/dist/core/compute/index.js +9 -0
  10. package/dist/core/compute/index.js.map +1 -0
  11. package/dist/core/compute/majorant-build.d.ts +45 -0
  12. package/dist/core/compute/majorant-build.js +193 -0
  13. package/dist/core/compute/majorant-build.js.map +1 -0
  14. package/dist/core/compute/multi-scale.d.ts +155 -0
  15. package/dist/core/compute/multi-scale.js +684 -0
  16. package/dist/core/compute/multi-scale.js.map +1 -0
  17. package/dist/core/compute/pyramid.d.ts +120 -0
  18. package/dist/core/compute/pyramid.js +468 -0
  19. package/dist/core/compute/pyramid.js.map +1 -0
  20. package/dist/core/compute/shared.d.ts +116 -0
  21. package/dist/core/compute/shared.js +211 -0
  22. package/dist/core/compute/shared.js.map +1 -0
  23. package/dist/core/compute/stats.d.ts +78 -0
  24. package/dist/core/compute/stats.js +193 -0
  25. package/dist/core/compute/stats.js.map +1 -0
  26. package/dist/core/compute/value-transform.d.ts +30 -0
  27. package/dist/core/compute/value-transform.js +64 -0
  28. package/dist/core/compute/value-transform.js.map +1 -0
  29. package/dist/core/errors.d.ts +21 -0
  30. package/dist/core/errors.js +17 -0
  31. package/dist/core/errors.js.map +1 -0
  32. package/dist/core/frame/emission.d.ts +85 -0
  33. package/dist/core/frame/emission.js +422 -0
  34. package/dist/core/frame/emission.js.map +1 -0
  35. package/dist/core/frame/environment.d.ts +47 -0
  36. package/dist/core/frame/environment.js +178 -0
  37. package/dist/core/frame/environment.js.map +1 -0
  38. package/dist/core/frame/index.d.ts +39 -0
  39. package/dist/core/frame/index.js +27 -0
  40. package/dist/core/frame/index.js.map +1 -0
  41. package/dist/core/frame/kernels.d.ts +115 -0
  42. package/dist/core/frame/kernels.js +496 -0
  43. package/dist/core/frame/kernels.js.map +1 -0
  44. package/dist/core/frame/limits.d.ts +67 -0
  45. package/dist/core/frame/limits.js +109 -0
  46. package/dist/core/frame/limits.js.map +1 -0
  47. package/dist/core/frame/phase.d.ts +17 -0
  48. package/dist/core/frame/phase.js +53 -0
  49. package/dist/core/frame/phase.js.map +1 -0
  50. package/dist/core/frame/pipelines.d.ts +49 -0
  51. package/dist/core/frame/pipelines.js +147 -0
  52. package/dist/core/frame/pipelines.js.map +1 -0
  53. package/dist/core/frame/renderer.d.ts +122 -0
  54. package/dist/core/frame/renderer.js +1712 -0
  55. package/dist/core/frame/renderer.js.map +1 -0
  56. package/dist/core/frame/resources.d.ts +71 -0
  57. package/dist/core/frame/resources.js +100 -0
  58. package/dist/core/frame/resources.js.map +1 -0
  59. package/dist/core/frame/scattering.d.ts +97 -0
  60. package/dist/core/frame/scattering.js +332 -0
  61. package/dist/core/frame/scattering.js.map +1 -0
  62. package/dist/core/frame/settings.d.ts +243 -0
  63. package/dist/core/frame/settings.js +67 -0
  64. package/dist/core/frame/settings.js.map +1 -0
  65. package/dist/core/frame/shadows.d.ts +55 -0
  66. package/dist/core/frame/shadows.js +460 -0
  67. package/dist/core/frame/shadows.js.map +1 -0
  68. package/dist/core/frame/types.d.ts +415 -0
  69. package/dist/core/frame/types.js +49 -0
  70. package/dist/core/frame/types.js.map +1 -0
  71. package/dist/core/frame/uniforms.d.ts +105 -0
  72. package/dist/core/frame/uniforms.js +276 -0
  73. package/dist/core/frame/uniforms.js.map +1 -0
  74. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  75. package/dist/core/frame/wgsl/chunks.js +728 -0
  76. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  77. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  78. package/dist/core/frame/wgsl/emission.js +353 -0
  79. package/dist/core/frame/wgsl/emission.js.map +1 -0
  80. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  81. package/dist/core/frame/wgsl/environment.js +711 -0
  82. package/dist/core/frame/wgsl/environment.js.map +1 -0
  83. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  84. package/dist/core/frame/wgsl/gather.js +850 -0
  85. package/dist/core/frame/wgsl/gather.js.map +1 -0
  86. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  87. package/dist/core/frame/wgsl/integrate.js +213 -0
  88. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  89. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  90. package/dist/core/frame/wgsl/lighting.js +1636 -0
  91. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  92. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  93. package/dist/core/frame/wgsl/occluders.js +95 -0
  94. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  95. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  96. package/dist/core/frame/wgsl/resolve.js +205 -0
  97. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  98. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  99. package/dist/core/frame/wgsl/shadows.js +328 -0
  100. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  101. package/dist/core/half.d.ts +11 -0
  102. package/dist/core/half.js +22 -0
  103. package/dist/core/half.js.map +1 -0
  104. package/dist/core/index.d.ts +52 -0
  105. package/dist/core/index.js +46 -0
  106. package/dist/core/index.js.map +1 -0
  107. package/dist/core/internal.d.ts +31 -0
  108. package/dist/core/internal.js +32 -0
  109. package/dist/core/internal.js.map +1 -0
  110. package/dist/core/pool/affine.d.ts +34 -0
  111. package/dist/core/pool/affine.js +100 -0
  112. package/dist/core/pool/affine.js.map +1 -0
  113. package/dist/core/pool/allocator.d.ts +32 -0
  114. package/dist/core/pool/allocator.js +81 -0
  115. package/dist/core/pool/allocator.js.map +1 -0
  116. package/dist/core/pool/image-header.d.ts +93 -0
  117. package/dist/core/pool/image-header.js +194 -0
  118. package/dist/core/pool/image-header.js.map +1 -0
  119. package/dist/core/pool/layout.d.ts +198 -0
  120. package/dist/core/pool/layout.js +316 -0
  121. package/dist/core/pool/layout.js.map +1 -0
  122. package/dist/core/pool/limits.d.ts +41 -0
  123. package/dist/core/pool/limits.js +80 -0
  124. package/dist/core/pool/limits.js.map +1 -0
  125. package/dist/core/pool/pool.d.ts +384 -0
  126. package/dist/core/pool/pool.js +1184 -0
  127. package/dist/core/pool/pool.js.map +1 -0
  128. package/dist/core/reference/index.d.ts +6 -0
  129. package/dist/core/reference/index.js +7 -0
  130. package/dist/core/reference/index.js.map +1 -0
  131. package/dist/core/reference/renderer.d.ts +105 -0
  132. package/dist/core/reference/renderer.js +474 -0
  133. package/dist/core/reference/renderer.js.map +1 -0
  134. package/dist/core/reference/wgsl.d.ts +65 -0
  135. package/dist/core/reference/wgsl.js +803 -0
  136. package/dist/core/reference/wgsl.js.map +1 -0
  137. package/dist/core/sequence.d.ts +347 -0
  138. package/dist/core/sequence.js +548 -0
  139. package/dist/core/sequence.js.map +1 -0
  140. package/dist/core/source/brick-cache.d.ts +165 -0
  141. package/dist/core/source/brick-cache.js +627 -0
  142. package/dist/core/source/brick-cache.js.map +1 -0
  143. package/dist/core/source/dense-fill.d.ts +53 -0
  144. package/dist/core/source/dense-fill.js +377 -0
  145. package/dist/core/source/dense-fill.js.map +1 -0
  146. package/dist/core/source/dense.d.ts +50 -0
  147. package/dist/core/source/dense.js +384 -0
  148. package/dist/core/source/dense.js.map +1 -0
  149. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  150. package/dist/core/source/sparse-wgsl.js +481 -0
  151. package/dist/core/source/sparse-wgsl.js.map +1 -0
  152. package/dist/core/source/sparse.d.ts +192 -0
  153. package/dist/core/source/sparse.js +762 -0
  154. package/dist/core/source/sparse.js.map +1 -0
  155. package/dist/core/source/types.d.ts +120 -0
  156. package/dist/core/source/types.js +9 -0
  157. package/dist/core/source/types.js.map +1 -0
  158. package/dist/core/surface/index.d.ts +10 -0
  159. package/dist/core/surface/index.js +9 -0
  160. package/dist/core/surface/index.js.map +1 -0
  161. package/dist/core/surface/level-set-pass.d.ts +140 -0
  162. package/dist/core/surface/level-set-pass.js +291 -0
  163. package/dist/core/surface/level-set-pass.js.map +1 -0
  164. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  165. package/dist/core/surface/level-set-wgsl.js +99 -0
  166. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  167. package/dist/core/surface/points.d.ts +109 -0
  168. package/dist/core/surface/points.js +226 -0
  169. package/dist/core/surface/points.js.map +1 -0
  170. package/dist/core/types.d.ts +37 -0
  171. package/dist/core/types.js +32 -0
  172. package/dist/core/types.js.map +1 -0
  173. package/dist/core/wgsl/api.d.ts +65 -0
  174. package/dist/core/wgsl/api.js +546 -0
  175. package/dist/core/wgsl/api.js.map +1 -0
  176. package/dist/core/wgsl/generate.d.ts +90 -0
  177. package/dist/core/wgsl/generate.js +678 -0
  178. package/dist/core/wgsl/generate.js.map +1 -0
  179. package/dist/core/wgsl/lean.d.ts +50 -0
  180. package/dist/core/wgsl/lean.js +327 -0
  181. package/dist/core/wgsl/lean.js.map +1 -0
  182. package/dist/core/wgsl/level-set.d.ts +58 -0
  183. package/dist/core/wgsl/level-set.js +200 -0
  184. package/dist/core/wgsl/level-set.js.map +1 -0
  185. package/dist/core/wgsl/majorant.d.ts +62 -0
  186. package/dist/core/wgsl/majorant.js +381 -0
  187. package/dist/core/wgsl/majorant.js.map +1 -0
  188. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
  189. package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
  190. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
  191. package/dist/core/wgsl/reserved.d.ts +9 -0
  192. package/dist/core/wgsl/reserved.js +26 -0
  193. package/dist/core/wgsl/reserved.js.map +1 -0
  194. package/dist/core/wgsl/types.d.ts +198 -0
  195. package/dist/core/wgsl/types.js +2 -0
  196. package/dist/core/wgsl/types.js.map +1 -0
  197. package/dist/three/coarse-first.d.ts +207 -0
  198. package/dist/three/coarse-first.js +205 -0
  199. package/dist/three/coarse-first.js.map +1 -0
  200. package/dist/three/compute.d.ts +73 -0
  201. package/dist/three/compute.js +66 -0
  202. package/dist/three/compute.js.map +1 -0
  203. package/dist/three/device.d.ts +66 -0
  204. package/dist/three/device.js +62 -0
  205. package/dist/three/device.js.map +1 -0
  206. package/dist/three/frame/core-environment.d.ts +38 -0
  207. package/dist/three/frame/core-environment.js +154 -0
  208. package/dist/three/frame/core-environment.js.map +1 -0
  209. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  210. package/dist/three/frame/core-integrate-material.js +162 -0
  211. package/dist/three/frame/core-integrate-material.js.map +1 -0
  212. package/dist/three/frame/core-occluders.d.ts +53 -0
  213. package/dist/three/frame/core-occluders.js +193 -0
  214. package/dist/three/frame/core-occluders.js.map +1 -0
  215. package/dist/three/frame/core-structs.d.ts +34 -0
  216. package/dist/three/frame/core-structs.js +61 -0
  217. package/dist/three/frame/core-structs.js.map +1 -0
  218. package/dist/three/frame/core-textures.d.ts +41 -0
  219. package/dist/three/frame/core-textures.js +114 -0
  220. package/dist/three/frame/core-textures.js.map +1 -0
  221. package/dist/three/frame/emission-light.d.ts +117 -0
  222. package/dist/three/frame/emission-light.js +276 -0
  223. package/dist/three/frame/emission-light.js.map +1 -0
  224. package/dist/three/frame/index.d.ts +19 -0
  225. package/dist/three/frame/index.js +15 -0
  226. package/dist/three/frame/index.js.map +1 -0
  227. package/dist/three/frame/medium.d.ts +33 -0
  228. package/dist/three/frame/medium.js +29 -0
  229. package/dist/three/frame/medium.js.map +1 -0
  230. package/dist/three/frame/renderer.d.ts +97 -0
  231. package/dist/three/frame/renderer.js +480 -0
  232. package/dist/three/frame/renderer.js.map +1 -0
  233. package/dist/three/frame/spectrum.d.ts +4 -0
  234. package/dist/three/frame/spectrum.js +15 -0
  235. package/dist/three/frame/spectrum.js.map +1 -0
  236. package/dist/three/frame/three-internals.d.ts +60 -0
  237. package/dist/three/frame/three-internals.js +152 -0
  238. package/dist/three/frame/three-internals.js.map +1 -0
  239. package/dist/three/frame/volume-shadows.d.ts +139 -0
  240. package/dist/three/frame/volume-shadows.js +403 -0
  241. package/dist/three/frame/volume-shadows.js.map +1 -0
  242. package/dist/three/frame/volume.d.ts +230 -0
  243. package/dist/three/frame/volume.js +268 -0
  244. package/dist/three/frame/volume.js.map +1 -0
  245. package/dist/three/grid-node.d.ts +229 -0
  246. package/dist/three/grid-node.js +545 -0
  247. package/dist/three/grid-node.js.map +1 -0
  248. package/dist/three/index.d.ts +52 -0
  249. package/dist/three/index.js +58 -0
  250. package/dist/three/index.js.map +1 -0
  251. package/dist/three/internal.d.ts +20 -0
  252. package/dist/three/internal.js +18 -0
  253. package/dist/three/internal.js.map +1 -0
  254. package/dist/three/level-set-material.d.ts +185 -0
  255. package/dist/three/level-set-material.js +241 -0
  256. package/dist/three/level-set-material.js.map +1 -0
  257. package/dist/three/level-set-physical-material.d.ts +154 -0
  258. package/dist/three/level-set-physical-material.js +253 -0
  259. package/dist/three/level-set-physical-material.js.map +1 -0
  260. package/dist/three/level-set-velocity.d.ts +94 -0
  261. package/dist/three/level-set-velocity.js +208 -0
  262. package/dist/three/level-set-velocity.js.map +1 -0
  263. package/dist/three/material.d.ts +324 -0
  264. package/dist/three/material.js +502 -0
  265. package/dist/three/material.js.map +1 -0
  266. package/dist/three/points.d.ts +140 -0
  267. package/dist/three/points.js +261 -0
  268. package/dist/three/points.js.map +1 -0
  269. package/dist/three/sparse-source.d.ts +165 -0
  270. package/dist/three/sparse-source.js +405 -0
  271. package/dist/three/sparse-source.js.map +1 -0
  272. package/dist/three/volume-source.d.ts +22 -0
  273. package/dist/three/volume-source.js +110 -0
  274. package/dist/three/volume-source.js.map +1 -0
  275. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  276. package/dist/tools/cpu/brick-atlas.js +129 -0
  277. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  278. package/dist/tools/cpu/compute.d.ts +116 -0
  279. package/dist/tools/cpu/compute.js +239 -0
  280. package/dist/tools/cpu/compute.js.map +1 -0
  281. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  282. package/dist/tools/cpu/lean-reads.js +262 -0
  283. package/dist/tools/cpu/lean-reads.js.map +1 -0
  284. package/dist/tools/cpu/level-set.d.ts +111 -0
  285. package/dist/tools/cpu/level-set.js +313 -0
  286. package/dist/tools/cpu/level-set.js.map +1 -0
  287. package/dist/tools/cpu/majorant.d.ts +265 -0
  288. package/dist/tools/cpu/majorant.js +541 -0
  289. package/dist/tools/cpu/majorant.js.map +1 -0
  290. package/dist/tools/cpu/march.d.ts +297 -0
  291. package/dist/tools/cpu/march.js +726 -0
  292. package/dist/tools/cpu/march.js.map +1 -0
  293. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  294. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  295. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  296. package/dist/tools/cpu/points.d.ts +29 -0
  297. package/dist/tools/cpu/points.js +38 -0
  298. package/dist/tools/cpu/points.js.map +1 -0
  299. package/dist/tools/cpu/probe-coords.d.ts +70 -0
  300. package/dist/tools/cpu/probe-coords.js +116 -0
  301. package/dist/tools/cpu/probe-coords.js.map +1 -0
  302. package/dist/tools/cpu/read-value.d.ts +44 -0
  303. package/dist/tools/cpu/read-value.js +351 -0
  304. package/dist/tools/cpu/read-value.js.map +1 -0
  305. package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
  306. package/dist/tools/cpu/sample-trilinear.js +168 -0
  307. package/dist/tools/cpu/sample-trilinear.js.map +1 -0
  308. package/dist/tools/cpu/stride-tables.d.ts +56 -0
  309. package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
  310. package/dist/tools/cpu/stride-tables.generated.js +1267 -0
  311. package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
  312. package/dist/tools/cpu/stride-tables.js +78 -0
  313. package/dist/tools/cpu/stride-tables.js.map +1 -0
  314. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  315. package/dist/tools/cpu/surface-nets.js +597 -0
  316. package/dist/tools/cpu/surface-nets.js.map +1 -0
  317. package/dist/tools/errors.d.ts +66 -0
  318. package/dist/tools/errors.js +67 -0
  319. package/dist/tools/errors.js.map +1 -0
  320. package/dist/tools/frame/ambient.d.ts +98 -0
  321. package/dist/tools/frame/ambient.js +274 -0
  322. package/dist/tools/frame/ambient.js.map +1 -0
  323. package/dist/tools/frame/blackbody.d.ts +57 -0
  324. package/dist/tools/frame/blackbody.js +151 -0
  325. package/dist/tools/frame/blackbody.js.map +1 -0
  326. package/dist/tools/frame/brick-cache.d.ts +165 -0
  327. package/dist/tools/frame/brick-cache.js +326 -0
  328. package/dist/tools/frame/brick-cache.js.map +1 -0
  329. package/dist/tools/frame/emission.d.ts +137 -0
  330. package/dist/tools/frame/emission.js +290 -0
  331. package/dist/tools/frame/emission.js.map +1 -0
  332. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  333. package/dist/tools/frame/environment-gpu.js +280 -0
  334. package/dist/tools/frame/environment-gpu.js.map +1 -0
  335. package/dist/tools/frame/environment.d.ts +106 -0
  336. package/dist/tools/frame/environment.js +272 -0
  337. package/dist/tools/frame/environment.js.map +1 -0
  338. package/dist/tools/frame/froxel.d.ts +58 -0
  339. package/dist/tools/frame/froxel.js +115 -0
  340. package/dist/tools/frame/froxel.js.map +1 -0
  341. package/dist/tools/frame/grid.d.ts +392 -0
  342. package/dist/tools/frame/grid.js +802 -0
  343. package/dist/tools/frame/grid.js.map +1 -0
  344. package/dist/tools/frame/index.d.ts +150 -0
  345. package/dist/tools/frame/index.js +389 -0
  346. package/dist/tools/frame/index.js.map +1 -0
  347. package/dist/tools/frame/medium.d.ts +77 -0
  348. package/dist/tools/frame/medium.js +101 -0
  349. package/dist/tools/frame/medium.js.map +1 -0
  350. package/dist/tools/frame/mie-table.d.ts +6 -0
  351. package/dist/tools/frame/mie-table.js +16 -0
  352. package/dist/tools/frame/mie-table.js.map +1 -0
  353. package/dist/tools/frame/mie.d.ts +63 -0
  354. package/dist/tools/frame/mie.js +194 -0
  355. package/dist/tools/frame/mie.js.map +1 -0
  356. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  357. package/dist/tools/frame/mlp-nn.js +159 -0
  358. package/dist/tools/frame/mlp-nn.js.map +1 -0
  359. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  360. package/dist/tools/frame/mlp-tza.js +186 -0
  361. package/dist/tools/frame/mlp-tza.js.map +1 -0
  362. package/dist/tools/frame/mlp.d.ts +183 -0
  363. package/dist/tools/frame/mlp.js +434 -0
  364. package/dist/tools/frame/mlp.js.map +1 -0
  365. package/dist/tools/frame/ms-exit.d.ts +42 -0
  366. package/dist/tools/frame/ms-exit.js +90 -0
  367. package/dist/tools/frame/ms-exit.js.map +1 -0
  368. package/dist/tools/frame/multi-scale.d.ts +152 -0
  369. package/dist/tools/frame/multi-scale.js +302 -0
  370. package/dist/tools/frame/multi-scale.js.map +1 -0
  371. package/dist/tools/frame/neural-weights.d.ts +10 -0
  372. package/dist/tools/frame/neural-weights.js +244 -0
  373. package/dist/tools/frame/neural-weights.js.map +1 -0
  374. package/dist/tools/frame/neural.d.ts +80 -0
  375. package/dist/tools/frame/neural.js +150 -0
  376. package/dist/tools/frame/neural.js.map +1 -0
  377. package/dist/tools/frame/occluders.d.ts +51 -0
  378. package/dist/tools/frame/occluders.js +72 -0
  379. package/dist/tools/frame/occluders.js.map +1 -0
  380. package/dist/tools/frame/pyramid-layout.d.ts +55 -0
  381. package/dist/tools/frame/pyramid-layout.js +100 -0
  382. package/dist/tools/frame/pyramid-layout.js.map +1 -0
  383. package/dist/tools/frame/shadows.d.ts +190 -0
  384. package/dist/tools/frame/shadows.js +468 -0
  385. package/dist/tools/frame/shadows.js.map +1 -0
  386. package/dist/tools/frame/sparse.d.ts +147 -0
  387. package/dist/tools/frame/sparse.js +432 -0
  388. package/dist/tools/frame/sparse.js.map +1 -0
  389. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  390. package/dist/tools/frame/spectral-stack.js +391 -0
  391. package/dist/tools/frame/spectral-stack.js.map +1 -0
  392. package/dist/tools/frame/spectral.d.ts +222 -0
  393. package/dist/tools/frame/spectral.js +572 -0
  394. package/dist/tools/frame/spectral.js.map +1 -0
  395. package/dist/tools/frame/stack.d.ts +115 -0
  396. package/dist/tools/frame/stack.js +290 -0
  397. package/dist/tools/frame/stack.js.map +1 -0
  398. package/dist/tools/frame/view.d.ts +131 -0
  399. package/dist/tools/frame/view.js +337 -0
  400. package/dist/tools/frame/view.js.map +1 -0
  401. package/dist/tools/index.d.ts +157 -0
  402. package/dist/tools/index.js +132 -0
  403. package/dist/tools/index.js.map +1 -0
  404. package/dist/tools/internal.d.ts +87 -0
  405. package/dist/tools/internal.js +85 -0
  406. package/dist/tools/internal.js.map +1 -0
  407. package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
  408. package/dist/tools/nanovdb/build-from-vdb.js +100 -0
  409. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
  410. package/dist/tools/nanovdb/bytes.d.ts +233 -0
  411. package/dist/tools/nanovdb/bytes.js +388 -0
  412. package/dist/tools/nanovdb/bytes.js.map +1 -0
  413. package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
  414. package/dist/tools/nanovdb/coarse-first.js +92 -0
  415. package/dist/tools/nanovdb/coarse-first.js.map +1 -0
  416. package/dist/tools/nanovdb/half.d.ts +22 -0
  417. package/dist/tools/nanovdb/half.js +73 -0
  418. package/dist/tools/nanovdb/half.js.map +1 -0
  419. package/dist/tools/nanovdb/index.d.ts +34 -0
  420. package/dist/tools/nanovdb/index.js +25 -0
  421. package/dist/tools/nanovdb/index.js.map +1 -0
  422. package/dist/tools/nanovdb/inspect.d.ts +33 -0
  423. package/dist/tools/nanovdb/inspect.js +70 -0
  424. package/dist/tools/nanovdb/inspect.js.map +1 -0
  425. package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
  426. package/dist/tools/nanovdb/leaf-codec.js +356 -0
  427. package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
  428. package/dist/tools/nanovdb/quantize.d.ts +72 -0
  429. package/dist/tools/nanovdb/quantize.js +329 -0
  430. package/dist/tools/nanovdb/quantize.js.map +1 -0
  431. package/dist/tools/nanovdb/resample.d.ts +177 -0
  432. package/dist/tools/nanovdb/resample.js +692 -0
  433. package/dist/tools/nanovdb/resample.js.map +1 -0
  434. package/dist/tools/nanovdb/serialize.d.ts +176 -0
  435. package/dist/tools/nanovdb/serialize.js +439 -0
  436. package/dist/tools/nanovdb/serialize.js.map +1 -0
  437. package/dist/tools/nanovdb/stats.d.ts +87 -0
  438. package/dist/tools/nanovdb/stats.js +225 -0
  439. package/dist/tools/nanovdb/stats.js.map +1 -0
  440. package/dist/tools/nanovdb/transform.d.ts +30 -0
  441. package/dist/tools/nanovdb/transform.js +94 -0
  442. package/dist/tools/nanovdb/transform.js.map +1 -0
  443. package/dist/tools/nanovdb/tree.d.ts +186 -0
  444. package/dist/tools/nanovdb/tree.js +530 -0
  445. package/dist/tools/nanovdb/tree.js.map +1 -0
  446. package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
  447. package/dist/tools/nanovdb/write-nvdb.js +290 -0
  448. package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
  449. package/dist/tools/nvdb-file.d.ts +265 -0
  450. package/dist/tools/nvdb-file.js +763 -0
  451. package/dist/tools/nvdb-file.js.map +1 -0
  452. package/dist/tools/nvdb-stream.d.ts +154 -0
  453. package/dist/tools/nvdb-stream.js +409 -0
  454. package/dist/tools/nvdb-stream.js.map +1 -0
  455. package/dist/tools/reference/analytic.d.ts +41 -0
  456. package/dist/tools/reference/analytic.js +95 -0
  457. package/dist/tools/reference/analytic.js.map +1 -0
  458. package/dist/tools/reference/environment.d.ts +62 -0
  459. package/dist/tools/reference/environment.js +154 -0
  460. package/dist/tools/reference/environment.js.map +1 -0
  461. package/dist/tools/reference/index.d.ts +12 -0
  462. package/dist/tools/reference/index.js +13 -0
  463. package/dist/tools/reference/index.js.map +1 -0
  464. package/dist/tools/reference/media.d.ts +14 -0
  465. package/dist/tools/reference/media.js +30 -0
  466. package/dist/tools/reference/media.js.map +1 -0
  467. package/dist/tools/reference/rng.d.ts +20 -0
  468. package/dist/tools/reference/rng.js +30 -0
  469. package/dist/tools/reference/rng.js.map +1 -0
  470. package/dist/tools/reference/scene.d.ts +312 -0
  471. package/dist/tools/reference/scene.js +169 -0
  472. package/dist/tools/reference/scene.js.map +1 -0
  473. package/dist/tools/reference/tables.d.ts +98 -0
  474. package/dist/tools/reference/tables.js +264 -0
  475. package/dist/tools/reference/tables.js.map +1 -0
  476. package/dist/tools/reference/trace.d.ts +160 -0
  477. package/dist/tools/reference/trace.js +497 -0
  478. package/dist/tools/reference/trace.js.map +1 -0
  479. package/dist/tools/vdb/bit-utils.d.ts +20 -0
  480. package/dist/tools/vdb/bit-utils.js +42 -0
  481. package/dist/tools/vdb/bit-utils.js.map +1 -0
  482. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  483. package/dist/tools/vdb/blosc-write.js +197 -0
  484. package/dist/tools/vdb/blosc-write.js.map +1 -0
  485. package/dist/tools/vdb/blosc.d.ts +86 -0
  486. package/dist/tools/vdb/blosc.js +287 -0
  487. package/dist/tools/vdb/blosc.js.map +1 -0
  488. package/dist/tools/vdb/blosclz.d.ts +33 -0
  489. package/dist/tools/vdb/blosclz.js +112 -0
  490. package/dist/tools/vdb/blosclz.js.map +1 -0
  491. package/dist/tools/vdb/byte-reader.d.ts +50 -0
  492. package/dist/tools/vdb/byte-reader.js +161 -0
  493. package/dist/tools/vdb/byte-reader.js.map +1 -0
  494. package/dist/tools/vdb/compression.d.ts +81 -0
  495. package/dist/tools/vdb/compression.js +260 -0
  496. package/dist/tools/vdb/compression.js.map +1 -0
  497. package/dist/tools/vdb/errors.d.ts +10 -0
  498. package/dist/tools/vdb/errors.js +11 -0
  499. package/dist/tools/vdb/errors.js.map +1 -0
  500. package/dist/tools/vdb/grid.d.ts +37 -0
  501. package/dist/tools/vdb/grid.js +153 -0
  502. package/dist/tools/vdb/grid.js.map +1 -0
  503. package/dist/tools/vdb/half-float.d.ts +9 -0
  504. package/dist/tools/vdb/half-float.js +24 -0
  505. package/dist/tools/vdb/half-float.js.map +1 -0
  506. package/dist/tools/vdb/index.d.ts +4 -0
  507. package/dist/tools/vdb/index.js +3 -0
  508. package/dist/tools/vdb/index.js.map +1 -0
  509. package/dist/tools/vdb/inflate.d.ts +24 -0
  510. package/dist/tools/vdb/inflate.js +334 -0
  511. package/dist/tools/vdb/inflate.js.map +1 -0
  512. package/dist/tools/vdb/lz4.d.ts +30 -0
  513. package/dist/tools/vdb/lz4.js +228 -0
  514. package/dist/tools/vdb/lz4.js.map +1 -0
  515. package/dist/tools/vdb/metadata.d.ts +17 -0
  516. package/dist/tools/vdb/metadata.js +72 -0
  517. package/dist/tools/vdb/metadata.js.map +1 -0
  518. package/dist/tools/vdb/parse.d.ts +47 -0
  519. package/dist/tools/vdb/parse.js +241 -0
  520. package/dist/tools/vdb/parse.js.map +1 -0
  521. package/dist/tools/vdb/point-render-data.d.ts +79 -0
  522. package/dist/tools/vdb/point-render-data.js +137 -0
  523. package/dist/tools/vdb/point-render-data.js.map +1 -0
  524. package/dist/tools/vdb/points.d.ts +186 -0
  525. package/dist/tools/vdb/points.js +835 -0
  526. package/dist/tools/vdb/points.js.map +1 -0
  527. package/dist/tools/vdb/transform.d.ts +23 -0
  528. package/dist/tools/vdb/transform.js +54 -0
  529. package/dist/tools/vdb/transform.js.map +1 -0
  530. package/dist/tools/vdb/tree.d.ts +111 -0
  531. package/dist/tools/vdb/tree.js +228 -0
  532. package/dist/tools/vdb/tree.js.map +1 -0
  533. package/dist/tools/vdb/types.d.ts +195 -0
  534. package/dist/tools/vdb/types.js +3 -0
  535. package/dist/tools/vdb/types.js.map +1 -0
  536. package/dist/tools/wvdb/bake.d.ts +145 -0
  537. package/dist/tools/wvdb/bake.js +361 -0
  538. package/dist/tools/wvdb/bake.js.map +1 -0
  539. package/dist/tools/wvdb/dense.d.ts +191 -0
  540. package/dist/tools/wvdb/dense.js +368 -0
  541. package/dist/tools/wvdb/dense.js.map +1 -0
  542. package/dist/tools/wvdb/format.d.ts +220 -0
  543. package/dist/tools/wvdb/format.js +306 -0
  544. package/dist/tools/wvdb/format.js.map +1 -0
  545. package/dist/tools/wvdb/index.d.ts +14 -0
  546. package/dist/tools/wvdb/index.js +15 -0
  547. package/dist/tools/wvdb/index.js.map +1 -0
  548. package/dist/tools/wvdb/level-set.d.ts +56 -0
  549. package/dist/tools/wvdb/level-set.js +153 -0
  550. package/dist/tools/wvdb/level-set.js.map +1 -0
  551. package/dist/tools/wvdb/nanovdb.d.ts +59 -0
  552. package/dist/tools/wvdb/nanovdb.js +64 -0
  553. package/dist/tools/wvdb/nanovdb.js.map +1 -0
  554. package/dist/tools/wvdb/partial.d.ts +74 -0
  555. package/dist/tools/wvdb/partial.js +233 -0
  556. package/dist/tools/wvdb/partial.js.map +1 -0
  557. package/dist/tools/wvdb/read.d.ts +336 -0
  558. package/dist/tools/wvdb/read.js +766 -0
  559. package/dist/tools/wvdb/read.js.map +1 -0
  560. package/dist/tools/wvdb/sha256.d.ts +7 -0
  561. package/dist/tools/wvdb/sha256.js +76 -0
  562. package/dist/tools/wvdb/sha256.js.map +1 -0
  563. package/dist/tools/wvdb/write.d.ts +149 -0
  564. package/dist/tools/wvdb/write.js +403 -0
  565. package/dist/tools/wvdb/write.js.map +1 -0
  566. package/package.json +83 -4
  567. package/vendor/LICENSE +201 -0
  568. package/vendor/NOTICE +19 -0
  569. package/vendor/VENDOR.md +100 -0
  570. package/vendor/pnanovdb.wgsl +1577 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spectral.js","sourceRoot":"","sources":["../../../src/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S,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,aAAa,GAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,KAAK;YAAE,MAAM;QAC9C,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,SAAS;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAE,GAAG,aAAa,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,EAAE,IAAI,CAAC,CAAC,CAAC;YAC/F,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AACrC,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/core/frameSpectrum.js (all, 42 lines: wavelengths, extinction spectrum, slot groups);\n// src/three-openvdb/frame/webgpu/frameShaderChunks.js L483–622 (frameMeanComponent, frameSpectralShadowUnit,\n// frameSpectralShadowDepths, frameSpectralShadowStep, frameSpectralGridAlbedo, frameSpectralShadowTransmittance,\n// frameSpectralOctaveLight, frameSpectralShadowTotal, frameSpectralShadowedLight, frameUnpackSpectralGroup);\n// src/three-openvdb/frame/webgpu/FrameTransmittanceMaterial.js L278–459 (buildSpectralNodes),\n// FrameEnvironmentGridMaterial.js L104–197 (the spectral branch), FrameDensityMaterial.js L363–537\n// (buildSpectralNodes), FrameLightingMaterial.js L114–275 (createSpectralFragmentNode),\n// FrameInjectMaterial.js L200–532 (the spectral pre-integration and march; the light-probe, environment and\n// hemisphere terms in both modes), as CPU twins;\n// three r187 `getShIrradianceAt` (MIT, three.js authors), the light-probe irradiance the passes call.\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: f64 CPU twins of the TSL (test oracles of the `./three` spectral passes and of the 'volume'-lighting\n// environment terms), engine-free (plain arrays). Divergences: DIVERGES.md (K3.5 rows).\n\nimport {\n vdbFrameDistanceFade,\n vdbFrameNoise,\n vdbFrameOctavesOff,\n vdbFramePhaseColor,\n vdbFramePhaseWeightScaled,\n vdbFrameShadowDepth,\n vdbFrameShadowOpticalDepth,\n vdbFrameShadowTotal,\n vdbFrameTwoSidedDiffusion,\n vdbFrameMaxScatteringOctaves,\n type Vec2,\n type Vec3,\n type Vec4,\n} from \"./index.js\";\nimport {\n vdbFrameDensityFroxelSteps,\n vdbFrameFindCascade,\n vdbFrameGridCell,\n vdbFrameGridUvw,\n vdbFrameInsideGrid,\n vdbFrameIsotropicDiffusion,\n vdbFrameSampleGrid,\n vdbFrameSampleShadows,\n vdbFrameSampleTiles,\n type VDBFrameAtlas,\n type VDBFrameDensityInputs,\n type VDBFrameGridLayout,\n type VDBFrameShadowLight,\n} from \"./grid.js\";\nimport { vdbFrameMsExitFactor } from \"./ms-exit.js\";\n\n\n/** Wavelengths in nm of the red, green and blue channels. Green (550 nm) is the reference. */\nexport const vdbFrameSpectrumWavelengths = [650.0, 550.0, 450.0] as const;\n\n/** Spectral slot groups (his `frameSpectralGroupCount`): group 0 is sky up, sky down and slot 0; group g is slots 2g − 1, 2g. */\nexport const vdbFrameSpectralGroupCount = 4;\n\n/** Groups in use for the number of light slots in use (0 to 6): 1 + ⌈(slots − 1) / 2⌉. */\nexport const vdbFrameSpectralGroups = (slotCount: number) => 1 + Math.ceil(Math.max(0, slotCount - 1) / 2);\n\n/** The extinction scale of each channel: scale × (λ / 550)^−α (his getFrameExtinctionSpectrum, engine-free; α a number). */\nexport function vdbFrameExtinctionSpectrum(scale: Vec3, angstromExponent: number): Vec3 {\n const ref = vdbFrameSpectrumWavelengths[1];\n return [0, 1, 2].map((c) => Math.max(0, scale[c]!) * Math.pow(vdbFrameSpectrumWavelengths[c]! / ref, -angstromExponent)) as Vec3;\n}\n\n/** Spectral shadow depths { x: extinction, y: effective extinction, z: reduced scattering } of each channel. */\nexport interface VDBFrameSpectralDepths {\n x: Vec3;\n y: Vec3;\n z: Vec3;\n}\n\n/** Spectral shadow values { x: direct, y: total } of each channel. */\nexport interface VDBFrameSpectralShadow {\n x: Vec3;\n y: Vec3;\n}\n\nconst clamp01 = (x: number) => Math.min(1, Math.max(0, x));\nconst map3 = (f: (c: number) => number): Vec3 => [f(0), f(1), f(2)];\n\n/** frameMeanComponent: the mean of the channels. */\nexport const vdbFrameMeanComponent = (v: Vec3) => (v[0] + v[1] + v[2]) / 3;\n\n/** frameSpectralShadowUnit: the depths of one unit of extinction for a volume's spectrum and albedo (frameShadowStep per channel). */\nexport function vdbFrameSpectralShadowUnit(spectrum: Vec3, albedo: Vec3, multipleScattering: number): VDBFrameSpectralDepths {\n const absorbed = map3((c) => spectrum[c]! * (1 - clamp01(albedo[c]!)));\n const reduced = map3((c) => (spectrum[c]! - absorbed[c]!) * multipleScattering);\n return { x: [...spectrum], y: map3((c) => Math.sqrt(absorbed[c]! * 3 * (absorbed[c]! + reduced[c]!))), z: reduced };\n}\n\n/** frameSpectralShadowDepths: one volume has one spectrum, so the depths are linear in the optical depth. */\nexport function vdbFrameSpectralShadowDepths(unit: VDBFrameSpectralDepths, opticalDepth: number): VDBFrameSpectralDepths {\n return { x: map3((c) => unit.x[c]! * opticalDepth), y: map3((c) => unit.y[c]! * opticalDepth), z: map3((c) => unit.z[c]! * opticalDepth) };\n}\n\n/** frameSpectralShadowStep: the step depths of each channel from the grid's (extinction, absorption) of each channel. */\nexport function vdbFrameSpectralShadowStep(extinction: Vec3, absorption: Vec3, multipleScattering: number): VDBFrameSpectralDepths {\n const absorbed = map3((c) => Math.min(absorption[c]!, extinction[c]!));\n const reduced = map3((c) => (extinction[c]! - absorbed[c]!) * multipleScattering);\n return { x: [...extinction], y: map3((c) => Math.sqrt(absorbed[c]! * 3 * (absorbed[c]! + reduced[c]!))), z: reduced };\n}\n\n/** frameSpectralGridAlbedo: 1 − absorption / extinction of each channel (clamped), 1 with no extinction. */\nexport function vdbFrameSpectralGridAlbedo(extinction: Vec3, absorption: Vec3): Vec3 {\n if (!(Math.max(...extinction) > 0)) return [1, 1, 1];\n return map3((c) => clamp01(1 - absorption[c]! / Math.max(extinction[c]!, 1e-8)));\n}\n\n/** frameShadowDepth of each channel. */\nexport function vdbFrameSpectralShadowDepth(depths: VDBFrameSpectralDepths, multipleScattering: number): Vec3 {\n return map3((c) => vdbFrameShadowDepth([depths.x[c]!, depths.y[c]!, depths.z[c]!], multipleScattering));\n}\n\n/** frameShadowMarchDepth of each channel (the marches stop when the smallest is past the limit). */\nexport function vdbFrameSpectralShadowMarchDepth(depths: VDBFrameSpectralDepths, multipleScattering: number, octaves: Vec4 = vdbFrameOctavesOff): Vec3 {\n if (octaves[0] > 0) return map3((c) => depths.x[c]! * Math.pow(octaves[1], octaves[0]));\n return vdbFrameSpectralShadowDepth(depths, multipleScattering);\n}\n\n/** frameSpectralShadowTransmittance: (direct, total) of each channel; octaves: total is 1 / (1 + τ). */\nexport function vdbFrameSpectralShadowTransmittance(depths: VDBFrameSpectralDepths, multipleScattering: number, octaves: Vec4 = vdbFrameOctavesOff): VDBFrameSpectralShadow {\n const d = vdbFrameSpectralShadowDepth(depths, multipleScattering);\n return { x: map3((c) => Math.exp(-depths.x[c]!)), y: map3((c) => (octaves[0] > 0 ? 1 / (depths.x[c]! + 1) : Math.exp(-d[c]!))) };\n}\n\n/** frameSpectralOctaveLight: Σₙ albedoⁿ bⁿ phase(g cⁿ) exp(−aⁿ τ) of each channel (each octave is one more scattering). */\nexport function vdbFrameSpectralOctaveLight(octaves: Vec4, opticalDepth: Vec3, albedo: Vec3, phase: Vec4 | null, cosTheta: number): Vec3 {\n const light: Vec3 = [0, 0, 0];\n const a = map3((c) => clamp01(albedo[c]!));\n const albedoScale: Vec3 = [1, 1, 1];\n let extinctionScale = 1;\n let contribution = 1;\n let gScale = 1;\n for (let i = 0; i < vdbFrameMaxScatteringOctaves; i++) {\n if (i + 1 > octaves[0]) break;\n extinctionScale *= octaves[1];\n contribution *= octaves[2];\n gScale *= octaves[3];\n for (let c = 0; c < 3; c++) albedoScale[c] = albedoScale[c]! * a[c]!;\n const p = phase ? vdbFramePhaseWeightScaled(phase, cosTheta, gScale) : 1;\n for (let c = 0; c < 3; c++) light[c] = light[c]! + albedoScale[c]! * (contribution * p) * Math.exp(-opticalDepth[c]! * extinctionScale);\n }\n return light;\n}\n\n/** frameSpectralShadowTotal: total transmittance of isotropic light of each channel from the y shadow values. */\nexport function vdbFrameSpectralShadowTotal(shadowY: Vec3, octaves: Vec4, albedo: Vec3): Vec3 {\n if (!(octaves[0] > 0)) return [...shadowY];\n const tau = map3((c) => vdbFrameShadowOpticalDepth(shadowY[c]!));\n const octave = vdbFrameSpectralOctaveLight(octaves, tau, albedo, null, 0);\n return map3((c) => Math.exp(-tau[c]!) + octave[c]!);\n}\n\n/** frameSpectralShadowedLight: phase × direct + scattered of each channel (octaves: the spectral octave light). */\nexport function vdbFrameSpectralShadowedLight(phase: Vec4, phaseSpectrum: Vec3, octaves: Vec4, rayDirection: Vec3, lightDirection: Vec3, shadow: VDBFrameSpectralShadow, albedo: Vec3): Vec3 {\n const p = vdbFramePhaseColor(phase, phaseSpectrum, rayDirection, lightDirection);\n const cos = rayDirection[0] * lightDirection[0] + rayDirection[1] * lightDirection[1] + rayDirection[2] * lightDirection[2];\n const scattered =\n octaves[0] > 0\n ? vdbFrameSpectralOctaveLight(\n octaves,\n map3((c) => vdbFrameShadowOpticalDepth(shadow.y[c]!)),\n albedo,\n phase,\n cos,\n )\n : map3((c) => shadow.y[c]! - shadow.x[c]!);\n return map3((c) => shadow.x[c]! * p[c]! + scattered[c]!);\n}\n\n/** frameUnpackSpectralGroup: the two entries of a slot group from its 3 RGBA targets. */\nexport function vdbFrameUnpackSpectralGroup(map0: ArrayLike<number>, map1: ArrayLike<number>, map2: ArrayLike<number>): { a: VDBFrameSpectralShadow; b: VDBFrameSpectralShadow } {\n return {\n a: { x: [map0[0]!, map0[1]!, map0[2]!], y: [map0[3]!, map1[0]!, map1[1]!] },\n b: { x: [map1[2]!, map1[3]!, map2[0]!], y: [map2[1]!, map2[2]!, map2[3]!] },\n };\n}\n\n/** The inverse of {@link vdbFrameUnpackSpectralGroup}: the 3 targets of a group. */\nexport function vdbFramePackSpectralGroup(a: VDBFrameSpectralShadow, b: VDBFrameSpectralShadow): [Vec4, Vec4, Vec4] {\n return [\n [a.x[0], a.x[1], a.x[2], a.y[0]],\n [a.y[1], a.y[2], b.x[0], b.x[1]],\n [b.x[2], b.y[0], b.y[1], b.y[2]],\n ];\n}\n\n/** frameIsotropicDiffusion of each channel. */\nconst isotropic3 = (front: Vec3, back: Vec3, effective: Vec3): Vec3 => map3((c) => vdbFrameIsotropicDiffusion(front[c]!, back[c]!, effective[c]!));\n\n/** frameTwoSidedDiffusion of each channel. */\nconst twoSided3 = (direct: Vec3, front: Vec3, effective: Vec3, back: Vec3): Vec3 => map3((c) => vdbFrameTwoSidedDiffusion(direct[c]!, front[c]!, effective[c]!, back[c]!));\n\n/** A spectral march result: direct, total, reduced depth and effective depth of each channel. */\nexport interface VDBFrameSpectralMarch {\n x: Vec3;\n y: Vec3;\n z: Vec3;\n w: Vec3;\n}\n\nconst unmarched = (): VDBFrameSpectralMarch => ({ x: [1, 1, 1], y: [1, 1, 1], z: [0, 0, 0], w: [0, 0, 0] });\n\n/** The spectral grid sample of the transmittance pass: (extinction, absorption) of each channel, 0 outside the grid. */\nexport function vdbFrameSpectralGridSample(extinction: VDBFrameAtlas, absorption: VDBFrameAtlas, grid: VDBFrameGridLayout, world: Vec3): { extinction: Vec3; absorption: Vec3 } {\n const found = vdbFrameFindCascade(grid, world, 0);\n if (found < 0) return { extinction: [0, 0, 0], absorption: [0, 0, 0] };\n const uvw = vdbFrameGridUvw(grid, found, world);\n const e = vdbFrameSampleGrid(extinction, grid, found, uvw);\n const a = vdbFrameSampleGrid(absorption, grid, found, uvw);\n return { extinction: [e[0]!, e[1]!, e[2]!], absorption: [a[0]!, a[1]!, a[2]!] };\n}\n\n/**\n * The spectral `march` of the transmittance pass: the grey march with the depths of each channel; stops when all channels\n * are past depth 6. K7.4a: `out.opticalDepth` gets the direct optical depth of each channel (the spectral MLP's input).\n */\nexport function vdbFrameSpectralGridMarch(\n sampleAt: (world: Vec3) => { extinction: Vec3; absorption: Vec3 },\n grid: VDBFrameGridLayout,\n origin: Vec3,\n direction: Vec3,\n maxDistance: number,\n jitter: number,\n multipleScattering: number,\n octaves: Vec4 = vdbFrameOctavesOff,\n out?: { opticalDepth: Vec3 },\n): VDBFrameSpectralMarch {\n const depths: VDBFrameSpectralDepths = { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] };\n let traveled = 0;\n const probe: Vec3 = [...origin];\n for (let i = 0; i < 1024; i++) {\n const cascade = vdbFrameFindCascade(grid, probe, 0);\n if (cascade < 0 || traveled >= maxDistance || Math.min(...vdbFrameSpectralShadowMarchDepth(depths, multipleScattering, octaves)) > 6) break;\n const voxel = grid.gridVoxel[cascade]!;\n const perUnit = Math.max(Math.abs(direction[0]) / voxel[0], Math.abs(direction[1]) / voxel[1], Math.abs(direction[2]) / voxel[2]);\n const step = Math.min(1 / perUnit, maxDistance - traveled);\n const s = sampleAt([probe[0] + direction[0] * step * jitter, probe[1] + direction[1] * step * jitter, probe[2] + direction[2] * step * jitter]);\n const d = vdbFrameSpectralShadowStep(s.extinction, s.absorption, multipleScattering);\n for (let c = 0; c < 3; c++) {\n depths.x[c] = depths.x[c]! + d.x[c]! * step;\n depths.y[c] = depths.y[c]! + d.y[c]! * step;\n depths.z[c] = depths.z[c]! + d.z[c]! * step;\n probe[c] = probe[c]! + direction[c]! * step;\n }\n traveled += step;\n }\n const t = vdbFrameSpectralShadowTransmittance(depths, multipleScattering, octaves);\n if (out) out.opticalDepth = [depths.x[0], depths.x[1], depths.x[2]];\n return { x: t.x, y: t.y, z: depths.z, w: depths.y };\n}\n\nconst normalize3 = (v: Vec3): Vec3 => {\n const l = Math.hypot(v[0], v[1], v[2]);\n return l > 0 ? [v[0] / l, v[1] / l, v[2] / l] : [0, 0, 0];\n};\n\n/**\n * The spectral transmittance pass at one grid voxel for one slot group (buildSpectralNodes): the 3 MRT outputs.\n * Group 0: (sky up, sky down) and slot 0; group g: slots 2g − 1 and 2g; a slot entry is (total, direct). Voxels\n * with no extinction within half a voxel keep 1.0. `twoSided`: the slot marches get the slab diffusion.\n */\nexport function vdbFrameSpectralTransmittanceVoxel(\n extinction: VDBFrameAtlas,\n absorption: VDBFrameAtlas,\n grid: VDBFrameGridLayout,\n fragCoord: Vec2,\n lights: readonly VDBFrameShadowLight[],\n skyDirection: Vec3,\n multipleScattering: number,\n jitterValue: number,\n group: number,\n modes: { octaves?: Vec4; twoSided?: boolean } = {},\n): [Vec4, Vec4, Vec4] {\n const octaves = modes.octaves ?? vdbFrameOctavesOff;\n const ones: [Vec4, Vec4, Vec4] = [\n [1, 1, 1, 1],\n [1, 1, 1, 1],\n [1, 1, 1, 1],\n ];\n const cell = vdbFrameGridCell(grid.resolution, grid.columns, fragCoord);\n if (cell.cascade >= grid.count) return ones;\n const voxel = grid.gridVoxel[cell.cascade]!;\n const m = grid.gridMin[cell.cascade]!;\n const s = grid.gridSize[cell.cascade]!;\n const world: Vec3 = [m[0] + cell.gridUvw[0] * s[0], m[1] + cell.gridUvw[1] * s[1], m[2] + cell.gridUvw[2] * s[2]];\n const sampleAt = (p: Vec3) => vdbFrameSpectralGridSample(extinction, absorption, grid, p);\n let near = 0;\n for (let i = 0; i < 8; i++) {\n const c: Vec3 = [(i & 1) - 0.5, ((i >> 1) & 1) - 0.5, ((i >> 2) & 1) - 0.5];\n const e = sampleAt([world[0] + c[0] * voxel[0], world[1] + c[1] * voxel[1], world[2] + c[2] * voxel[2]]).extinction;\n near += e[0] + e[1] + e[2];\n }\n if (!(near > 0)) return ones;\n const jitter = vdbFrameNoise(jitterValue, fragCoord);\n const sky = normalize3(skyDirection);\n const march = (enabled: boolean, dir: Vec3, maxDistance: number) => (enabled ? vdbFrameSpectralGridMarch(sampleAt, grid, world, dir, maxDistance, jitter, multipleScattering, octaves) : unmarched());\n const marchSlot = (enabled: boolean, slot: number): VDBFrameSpectralMarch => {\n const active = enabled && slot < lights.length;\n const l = lights[Math.min(slot, 5)] ?? ([0, 1, 0, 1] as Vec4);\n const isDirection = l[3] < 1.5;\n const toLight: Vec3 = [l[0] - world[0], l[1] - world[1], l[2] - world[2]];\n const dir = isDirection ? normalize3([l[0], l[1], l[2]]) : normalize3(toLight);\n const front = march(active, dir, isDirection ? 1e20 : Math.hypot(...toLight));\n if (modes.twoSided) {\n const back = march(active, [-dir[0], -dir[1], -dir[2]], 1e20);\n front.y = twoSided3(front.x, front.z, front.w, back.z);\n }\n return front;\n };\n const isSky = group === 0;\n const slotA = group * 2 - 1;\n const first = march(isSky, sky, 1e20);\n const second = march(isSky, [-sky[0], -sky[1], -sky[2]], 1e20);\n const slotFirst = marchSlot(!isSky, Math.max(slotA, 0));\n const slotSecond = marchSlot(true, isSky ? 0 : slotA + 1);\n const skyTotal = (f: VDBFrameSpectralMarch, b: VDBFrameSpectralMarch) => (multipleScattering > 0 ? isotropic3(f.z, b.z, f.w) : f.y);\n const a: VDBFrameSpectralShadow = isSky ? { x: skyTotal(first, second), y: skyTotal(second, first) } : { x: slotFirst.y, y: slotFirst.x };\n const b: VDBFrameSpectralShadow = { x: slotSecond.y, y: slotSecond.x };\n return vdbFramePackSpectralGroup(a, b);\n}\n\n/**\n * The spectral environment grid pass at one voxel of the last cascade (FrameEnvironmentGridMaterial, spectral\n * branch): the march of each channel through the grid's extinction and absorption atlases, the voxel's albedo\n * for the octaves; diffusion: the two-sided total of each channel.\n */\nexport function vdbFrameSpectralEnvironmentGridVoxel(\n extinction: VDBFrameAtlas,\n absorption: VDBFrameAtlas,\n grid: VDBFrameGridLayout,\n envColumns: number,\n fragCoord: Vec2,\n lights: readonly { direction: Vec3; color: Vec3 }[],\n unshadowed: Vec3,\n multipleScattering: number,\n octaves: Vec4 = vdbFrameOctavesOff,\n): Vec4 {\n const cascade = grid.count - 1;\n const res = grid.resolution;\n const tile: Vec2 = [Math.floor(fragCoord[0] / res), Math.floor(fragCoord[1] / res)];\n const z = tile[1] * envColumns + tile[0];\n const uvw0: Vec3 = [(fragCoord[0] - tile[0] * res) / res, (fragCoord[1] - tile[1] * res) / res, (z + 0.5) / res];\n const voxel = grid.gridVoxel[cascade]!;\n const m = grid.gridMin[cascade]!;\n const s = grid.gridSize[cascade]!;\n const world: Vec3 = [m[0] + uvw0[0] * s[0], m[1] + uvw0[1] * s[1], m[2] + uvw0[2] * s[2]];\n const uvwOf = (p: Vec3): Vec3 => [(p[0] - m[0]) / s[0], (p[1] - m[1]) / s[1], (p[2] - m[2]) / s[2]];\n const sampleE = (uvw: Vec3) => vdbFrameSampleGrid(extinction, grid, cascade, uvw);\n const sampleA = (uvw: Vec3) => vdbFrameSampleGrid(absorption, grid, cascade, uvw);\n let near = 0;\n for (let i = 0; i < 8; i++) {\n const c: Vec3 = [(i & 1) - 0.5, ((i >> 1) & 1) - 0.5, ((i >> 2) & 1) - 0.5];\n const e = sampleE(uvwOf([world[0] + c[0] * voxel[0], world[1] + c[1] * voxel[1], world[2] + c[2] * voxel[2]]));\n near += e[0]! + e[1]! + e[2]!;\n }\n const outside = vdbFrameSpectralShadowTotal([1, 1, 1], octaves, [1, 1, 1]);\n if (!(z < res && near > 0)) return [unshadowed[0] * outside[0], unshadowed[1] * outside[1], unshadowed[2] * outside[2], 1];\n const e0 = sampleE(uvw0);\n const a0 = sampleA(uvw0);\n const albedo = vdbFrameSpectralGridAlbedo([e0[0]!, e0[1]!, e0[2]!], [a0[0]!, a0[1]!, a0[2]!]);\n const marchDepths = (dir: Vec3): VDBFrameSpectralDepths => {\n const perUnit = Math.max(Math.abs(dir[0]) / voxel[0], Math.abs(dir[1]) / voxel[1], Math.abs(dir[2]) / voxel[2]);\n const step = 1 / perUnit;\n const probe: Vec3 = [world[0] + dir[0] * step * 0.5, world[1] + dir[1] * step * 0.5, world[2] + dir[2] * step * 0.5];\n const depths: VDBFrameSpectralDepths = { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] };\n for (let i = 0; i < 1024; i++) {\n const uvw = uvwOf(probe);\n if (uvw.some((v) => v < 0 || v > 1) || Math.min(...vdbFrameSpectralShadowMarchDepth(depths, multipleScattering, octaves)) > 6) break;\n const e = sampleE(uvw);\n const a = sampleA(uvw);\n const d = vdbFrameSpectralShadowStep([e[0]!, e[1]!, e[2]!], [a[0]!, a[1]!, a[2]!], multipleScattering);\n for (let c = 0; c < 3; c++) {\n depths.x[c] = depths.x[c]! + d.x[c]! * step;\n depths.y[c] = depths.y[c]! + d.y[c]! * step;\n depths.z[c] = depths.z[c]! + d.z[c]! * step;\n probe[c] = probe[c]! + dir[c]! * step;\n }\n }\n return depths;\n };\n const irradiance: Vec3 = [0, 0, 0];\n for (const light of lights) {\n const depths = marchDepths(light.direction);\n const total =\n multipleScattering > 0\n ? isotropic3(depths.z, marchDepths([-light.direction[0], -light.direction[1], -light.direction[2]]).z, depths.y)\n : vdbFrameSpectralShadowTotal(vdbFrameSpectralShadowTransmittance(depths, multipleScattering, octaves).y, octaves, albedo);\n for (let c = 0; c < 3; c++) irradiance[c] = irradiance[c]! + light.color[c]! * total[c]!;\n }\n return [Math.max(irradiance[0], 0), Math.max(irradiance[1], 0), Math.max(irradiance[2], 0), 1];\n}\n\n/** The inputs of {@link vdbFrameSpectralDensityFroxel}: the grey density inputs, the volume's extinction spectrum, the sky maps. */\nexport interface VDBFrameSpectralDensityInputs extends Omit<VDBFrameDensityInputs, \"shadows\" | \"sceneLightCount\" | \"lightPositions\" | \"phase\" | \"phaseSpectrum\"> {\n /** The volume's extinction scale of each channel (`frameExtinctionSpectrum`). */\n extinctionSpectrum: Vec3;\n /** The grid layout (environment grid and sky maps), or null without shadows. */\n grid?: VDBFrameGridLayout | null;\n}\n\n/**\n * The spectral density pass at one froxel of one volume (buildSpectralNodes, environment 'grid' or none): the\n * pre-integration with the transmittance of each channel (the visible position weighs the channel mean), and\n * the 3 MRT outputs (albedo × extinction, weight), (emission × weight, t × weight), (extinction, 0), or null.\n */\nexport function vdbFrameSpectralDensityFroxel(fragCoord: Vec2, p: VDBFrameSpectralDensityInputs): [Vec4, Vec4, Vec4] | null {\n const f = vdbFrameDensityFroxelSteps(fragCoord, p);\n if (!f) return null;\n const { viewNear, viewFar, localNear, localFar, t0, segment, steps, subStepLength, lod, jitter, mul } = f;\n const lerp3 = (x: Vec3, y: Vec3, t: number): Vec3 => [x[0] + (y[0] - x[0]) * t, x[1] + (y[1] - x[1]) * t, x[2] + (y[2] - x[2]) * t];\n const spectrum = p.extinctionSpectrum;\n let extinctionSum = 0;\n const transmittance: Vec3 = [1, 1, 1];\n let visibleWeight = 0;\n let visibleTSum = 0;\n for (let i = 0; i < steps; i++) {\n const t = t0 + segment * ((i + jitter) / steps);\n const e = p.extinctionAt(lerp3(localNear, localFar, t), lod) * p.opacity * vdbFrameDistanceFade(p.fadeRadius, lerp3(viewNear, viewFar, t));\n const stepT = map3((c) => Math.exp(-spectrum[c]! * e * subStepLength));\n const w = vdbFrameMeanComponent(map3((c) => transmittance[c]! * (1 - stepT[c]!)));\n visibleWeight += w;\n visibleTSum += w * t;\n extinctionSum += e;\n for (let c = 0; c < 3; c++) transmittance[c] = transmittance[c]! * stepT[c]!;\n }\n const extinction = map3((c) => spectrum[c]! * ((extinctionSum / steps) * segment));\n const weight = vdbFrameMeanComponent(extinction);\n if (!(weight > 0)) return null;\n const visibleT = visibleWeight > 0 ? visibleTSum / visibleWeight : 0.5;\n const visibleWorld = mul(p.cameraWorld, lerp3(viewNear, viewFar, visibleT));\n const emission: Vec3 = [...p.scatterColor];\n const albedo = p.baseColor;\n if (p.environmentGrid && p.grid) {\n const g = p.grid;\n const uvw = vdbFrameGridUvw(g, g.count - 1, visibleWorld);\n const outside = vdbFrameSpectralShadowTotal([1, 1, 1], p.octaves ?? vdbFrameOctavesOff, albedo);\n const env = vdbFrameInsideGrid(g.resolution, uvw) ? vdbFrameSampleTiles(p.environmentGrid.atlas, g.resolution, 0, p.environmentGrid.columns, uvw) : map3((c) => p.environmentGrid!.unshadowed[c]! * outside[c]!);\n for (let c = 0; c < 3; c++) emission[c] = emission[c]! + (albedo[c]! * env[c]!) / Math.PI;\n }\n return [\n [albedo[0] * extinction[0], albedo[1] * extinction[1], albedo[2] * extinction[2], weight],\n [emission[0] * weight, emission[1] * weight, emission[2] * weight, visibleT * weight],\n [extinction[0], extinction[1], extinction[2], 0],\n ];\n}\n\n/** The lights the spectral lighting pass reads (light probe as 9 SH coefficients, optional). */\nexport interface VDBFrameSpectralLightingInputs {\n ambient: Vec3;\n hemiSky: Vec3;\n hemiGround: Vec3;\n skyDirection?: Vec3;\n lightProbe?: readonly Vec3[];\n lights: { position: Vec4; color: Vec3; spot?: Vec4; penumbra?: number; falloff?: Vec2 }[];\n shadowLightCount: number;\n phase: Vec4;\n phaseSpectrum?: Vec3;\n octaves?: Vec4;\n environmentColors: Vec3[];\n environmentShadowSlot: number;\n /** The 3 targets of each slot group in use, sampled at a world position (sampleShadows), or null without shadows. */\n groupsAt: ((world: Vec3) => number[][][]) | null;\n /**\n * K6.4 (the core's K6.5b host occluder maps): the visibility of light `index` at the lit position; a slot's direct part\n * (its scattered part is occluded in the transmittance; octaves: the whole light), a light without a slot whole.\n */\n occluderAt?: ((index: number, world: Vec3) => number) | null;\n /** K6.Q1a shadowed ambient: group 0's sky entry holds the hemispherical visibilities (no totals); ambient × their mean. */\n ambientOcclusion?: boolean;\n /**\n * K6.Q1d ('frame' lighting's `ambientPhase: 'dipole'`, no diffusion totals): the phase weight of each channel's visibilities at the\n * lit world position along the unit view ray, given them (up, down): both × it. Default none (1).\n */\n ambientWeight?: ((world: Vec3, ray: Vec3, up: Vec3, down: Vec3) => Vec3) | null;\n /** K7.4c (internal `msExit`): the exit code of the slots' scattered part (0 isotropic, his; 1 dipole, 2 hg). Default 0. */\n msExit?: number;\n}\n\n/** three's `getShIrradianceAt` (L2 SH irradiance of a light probe at a unit normal). */\nexport function vdbShIrradianceAt(normal: Vec3, sh: readonly Vec3[]): Vec3 {\n const [x, y, z] = normal;\n const k = [0.886227, 2 * 0.511664 * y, 2 * 0.511664 * z, 2 * 0.511664 * x, 2 * 0.429043 * x * y, 2 * 0.429043 * y * z, z * z * 0.743125 - 0.247708, 2 * 0.429043 * x * z, 0.429043 * (x * x - y * y)];\n return map3((c) => k.reduce((sum, w, i) => sum + (sh[i]?.[c] ?? 0) * w, 0));\n}\n\nconst smoothstep = (e0: number, e1: number, x: number) => {\n const t = Math.min(Math.max((x - e0) / (e1 - e0), 0), 1);\n return t * t * (3 - 2 * t);\n};\n\nconst distanceAttenuation = (d: number, cutoff: number, decay: number) => {\n const falloff = 1 / Math.max(Math.pow(d, decay), 0.01);\n return cutoff > 0 ? falloff * Math.pow(Math.min(Math.max(1 - Math.pow(d / cutoff, 4), 0), 1), 2) : falloff;\n};\n\n/**\n * The spectral lighting pass at one froxel (createSpectralFragmentNode): from the 3 density targets, the slot\n * groups sampled at the visible position. Returns the two atlas outputs (radiance × α of each channel, green α)\n * and (red α, blue α, 0, green α), or zeros when the weight is ≤ 0 (the pass discards; the target is cleared).\n */\nexport function vdbFrameSpectralLightingFroxel(\n density: readonly [Vec4, Vec4, Vec4],\n viewNear: Vec3,\n viewFar: Vec3,\n cameraWorld: ArrayLike<number>,\n inputs: VDBFrameSpectralLightingInputs,\n): [Vec4, Vec4] {\n const [albedoT, emissionT, extinctionT] = density;\n const weight = albedoT[3];\n if (!(weight > 0)) return [\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n ];\n const m = cameraWorld;\n const extinction: Vec3 = [extinctionT[0], extinctionT[1], extinctionT[2]];\n const visibleT = Math.min(Math.max(emissionT[3] / weight, 0), 1);\n const view: Vec3 = map3((c) => viewNear[c]! + (viewFar[c]! - viewNear[c]!) * visibleT);\n const world: Vec3 = map3((r) => m[r]! * view[0] + m[4 + r]! * view[1] + m[8 + r]! * view[2] + m[12 + r]!);\n const seg: Vec3 = map3((c) => viewFar[c]! - viewNear[c]!);\n const ray = normalize3(map3((r) => m[r]! * seg[0] + m[4 + r]! * seg[1] + m[8 + r]! * seg[2]));\n const albedo = map3((c) => albedoT[c]! / Math.max(extinction[c]!, 1e-8));\n const emission = map3((c) => emissionT[c]! / weight);\n const octaves = inputs.octaves ?? vdbFrameOctavesOff;\n const ones = [1, 1, 1, 1];\n const groupMaps = inputs.groupsAt ? inputs.groupsAt(world) : [];\n const groups = [0, 1, 2, 3].map((g) => {\n const maps = groupMaps[g] ?? [ones, ones, ones];\n return vdbFrameUnpackSpectralGroup(maps[0]!, maps[1]!, maps[2]!);\n });\n const slotEntry = (slot: number) => (slot === 0 ? groups[0]!.b : slot % 2 === 1 ? groups[(slot + 1) / 2]!.a : groups[slot / 2]!.b);\n // K6.Q1a: with the shadowed ambient the sky entry holds the visibilities (totals already)\n const ao = !!inputs.ambientOcclusion;\n // K6.Q1d: × the phase weight of the pairs' dipole\n const aoWeight: Vec3 = ao && inputs.ambientWeight ? inputs.ambientWeight(world, ray, groups[0]!.a.x, groups[0]!.a.y) : [1, 1, 1];\n const skyUp = (ao ? groups[0]!.a.x.map((v, c) => v * aoWeight[c]!) : vdbFrameSpectralShadowTotal(groups[0]!.a.x, octaves, albedo)).map((v) => v * 0.5) as Vec3;\n const skyDown = (ao ? groups[0]!.a.y.map((v, c) => v * aoWeight[c]!) : vdbFrameSpectralShadowTotal(groups[0]!.a.y, octaves, albedo)).map((v) => v * 0.5) as Vec3;\n const sky = normalize3(inputs.skyDirection ?? [0, 1, 0]);\n const probe = (n: Vec3): Vec3 => (!inputs.lightProbe ? [0, 0, 0] : vdbShIrradianceAt(n, inputs.lightProbe));\n const probeUp = probe(sky);\n const probeDown = probe([-sky[0], -sky[1], -sky[2]]);\n const irradiance: Vec3 = map3((c) => inputs.ambient[c]! * (ao ? skyUp[c]! + skyDown[c]! : 1) + probeUp[c]! * skyUp[c]! + probeDown[c]! * skyDown[c]! + inputs.hemiSky[c]! * skyUp[c]! + inputs.hemiGround[c]! * skyDown[c]!);\n const spectrum = inputs.phaseSpectrum ?? [1, 1, 0];\n inputs.lights.forEach((light, i) => {\n const p = light.position;\n const toLight: Vec3 = [p[0] - world[0], p[1] - world[1], p[2] - world[2]];\n const dir = p[3] < 1.5 ? ([p[0], p[1], p[2]] as Vec3) : normalize3(toLight);\n const nl = normalize3(toLight);\n const spot = p[3] > 2.5 && light.spot ? smoothstep(light.spot[3], light.penumbra ?? 1, nl[0] * light.spot[0] + nl[1] * light.spot[1] + nl[2] * light.spot[2]) : 1;\n const dist = p[3] > 1.5 ? distanceAttenuation(Math.hypot(...toLight), light.falloff?.[0] ?? 0, light.falloff?.[1] ?? 0) : 1;\n const useSlot = i < 6 && i < inputs.shadowLightCount;\n const entry = useSlot ? slotEntry(i) : null;\n const v = inputs.occluderAt ? inputs.occluderAt(i, world) : 1;\n const shadow: VDBFrameSpectralShadow = entry ? { x: entry.y, y: entry.x } : { x: [1, 1, 1], y: [1, 1, 1] };\n // K6.5b in the core: direct × v (passed as (direct·v, total − direct·(1 − v))), else the whole light × v\n const occludedSlot = !!entry && !(octaves[0] > 0);\n // K7.4c: the scattered part (total − direct) × its exit factor (code 0: his)\n const exit = occludedSlot && (inputs.msExit ?? 0) > 0.5\n ? vdbFrameMsExitFactor(inputs.msExit!, inputs.phase, spectrum, ray[0] * dir[0] + ray[1] * dir[1] + ray[2] * dir[2], shadow.x, map3((c) => shadow.y[c]! - shadow.x[c]!), albedo)\n : null;\n const s2: VDBFrameSpectralShadow = occludedSlot\n ? { x: map3((c) => shadow.x[c]! * v), y: map3((c) => (exit ? shadow.x[c]! * v + (shadow.y[c]! - shadow.x[c]!) * exit[c]! : shadow.y[c]! - shadow.x[c]! * (1 - v))) }\n : shadow;\n const l0 = vdbFrameSpectralShadowedLight(inputs.phase, spectrum, octaves, ray, dir, s2, albedo);\n const l = occludedSlot ? l0 : map3((c) => l0[c]! * v);\n for (let c = 0; c < 3; c++) irradiance[c] = irradiance[c]! + light.color[c]! * l[c]! * spot * dist;\n });\n inputs.environmentColors.forEach((color, i) => {\n const slot = inputs.environmentShadowSlot + i;\n const total = slot < 6 ? slotEntry(slot).x : ([1, 1, 1] as Vec3);\n const t = vdbFrameSpectralShadowTotal(total, octaves, albedo);\n for (let c = 0; c < 3; c++) irradiance[c] = irradiance[c]! + color[c]! * t[c]!;\n });\n const length = Math.hypot(...seg);\n const alpha = map3((c) => 1 - Math.exp(-extinction[c]! * length));\n const radiance = map3((c) => albedo[c]! * irradiance[c]! * (1 / Math.PI) + emission[c]!);\n return [\n [radiance[0] * alpha[0], radiance[1] * alpha[1], radiance[2] * alpha[2], alpha[1]],\n [alpha[0], alpha[2], 0, alpha[1]],\n ];\n}\n\n/** The spectral transmittance group maps at a world position (sampleShadows of each group's 3 targets), for {@link vdbFrameSpectralLightingFroxel}. */\nexport function vdbFrameSpectralGroupsAt(groupAtlases: readonly (readonly VDBFrameAtlas[])[], grid: VDBFrameGridLayout): (world: Vec3) => number[][][] {\n return (world) => groupAtlases.map((atlases) => vdbFrameSampleShadows(atlases, grid, world));\n}\n\n// ── 'volume' lighting: the inject pass's isotropic terms (ambient + probe, environment, hemisphere) ──────\n\n/** A march of the inject pass (`volumeTransmittance` or its spectral twin) from the lit position: (direct, total, reduced, effective). */\nexport type VDBFrameInjectMarch = (localDirection: Vec3, maxLocalDistance: number) => { x: Vec3; y: Vec3; z: Vec3; w: Vec3 };\n\n/** What the inject pass's light terms read: the light uniforms, the volume's light bitmask and the march. */\nexport interface VDBFrameInjectLightInputs {\n /** The volume's `lights` bitmask (vdbFrameLights). */\n lights: number;\n ambient: Vec3;\n /** The light probe SH (9 coefficients). */\n lightProbe?: readonly Vec3[];\n /** Environment lights (world directions to the light, isotropic colours). */\n environment?: readonly { direction: Vec3; color: Vec3 }[];\n /** The 'outward' environment: three's IBL irradiance at a world direction (used when there are no environment lights). */\n environmentIrradiance?: ((direction: Vec3) => Vec3) | null;\n /** Hemisphere lights (world up direction, sky and ground colours). */\n hemisphere?: readonly { direction: Vec3; sky: Vec3; ground: Vec3 }[];\n /** World → local direction (the volume's worldToLocal 3 × 3, column-major 4 × 4 elements). */\n worldToLocal: ArrayLike<number>;\n /** The outward normal (world, unit), from the volume centre to the lit position. */\n outwardNormal: Vec3;\n /** multipleScattering value (> 0: diffusion pairs), octaves, the lit albedo (octaves of each channel). */\n multipleScattering: number;\n octaves?: Vec4;\n albedo: Vec3;\n /** Spectral totals (frameSpectralShadowTotal) or grey (frameShadowTotal of the green total, all channels). */\n spectral: boolean;\n march: VDBFrameInjectMarch;\n}\n\nconst lightFlags = { ambient: 0b100000, hemisphere: 0b000010, environment: 0b000001 };\n\n/**\n * The isotropic light terms of the inject pass ('volume' lighting) at the lit position: ambient + light probe\n * along the outward normal; the environment lights (one march each; with diffusion the two-sided total of the\n * march pair), or the 'outward' IBL irradiance with its march pair; the hemisphere lights (sky up and ground\n * down, a pair). Returns the irradiance before the scene lights. Grey: the march's channels are equal.\n */\nexport function vdbFrameInjectIsotropicIrradiance(p: VDBFrameInjectLightInputs): Vec3 {\n const octaves = p.octaves ?? vdbFrameOctavesOff;\n const diffusion = p.multipleScattering > 0;\n const m = p.worldToLocal;\n const toLocal = (d: Vec3): Vec3 => map3((r) => m[r]! * d[0] + m[4 + r]! * d[1] + m[8 + r]! * d[2]);\n const total = (y: Vec3): Vec3 => (p.spectral ? vdbFrameSpectralShadowTotal(y, octaves, p.albedo) : map3((c) => vdbFrameShadowTotal(y[c]!, octaves)));\n const pair = (localDirection: Vec3) => {\n const front = p.march(localDirection, 1e6);\n const back = p.march([-localDirection[0], -localDirection[1], -localDirection[2]], 1e6);\n return { x: isotropic3(front.z, back.z, front.w), y: isotropic3(back.z, front.z, back.w) };\n };\n const isotropic = (localDirection: Vec3): Vec3 => (diffusion ? pair(localDirection).x : total(p.march(localDirection, 1e6).y));\n const irradiance: Vec3 = [0, 0, 0];\n const add = (v: Vec3, s: Vec3 | number = 1) => {\n for (let c = 0; c < 3; c++) irradiance[c] = irradiance[c]! + v[c]! * (typeof s === \"number\" ? s : s[c]!);\n };\n if (p.lights & lightFlags.ambient) {\n add(p.ambient);\n if (p.lightProbe) add(vdbShIrradianceAt(p.outwardNormal, p.lightProbe));\n }\n if (p.lights & lightFlags.environment) {\n if (p.environment && p.environment.length > 0) {\n const env: Vec3 = [0, 0, 0];\n for (const light of p.environment) {\n const t = isotropic(toLocal(light.direction));\n for (let c = 0; c < 3; c++) env[c] = env[c]! + light.color[c]! * t[c]!;\n }\n add(map3((c) => Math.max(env[c]!, 0)));\n } else if (p.environmentIrradiance) {\n const outward = toLocal(p.outwardNormal);\n const n = p.outwardNormal;\n if (diffusion) {\n const pr = pair(outward);\n add(p.environmentIrradiance(n), map3((c) => pr.x[c]! * 0.5));\n add(p.environmentIrradiance([-n[0], -n[1], -n[2]]), map3((c) => pr.y[c]! * 0.5));\n } else {\n add(p.environmentIrradiance(n), total(p.march(outward, 1e6).y));\n }\n }\n }\n if (p.lights & lightFlags.hemisphere) {\n for (const h of p.hemisphere ?? []) {\n const up = toLocal(h.direction);\n let sky: Vec3;\n let ground: Vec3;\n if (diffusion) {\n const pr = pair(up);\n sky = pr.x;\n ground = pr.y;\n } else {\n sky = total(p.march(up, 1e6).y);\n ground = total(p.march([-up[0], -up[1], -up[2]], 1e6).y);\n }\n add(h.sky, map3((c) => 0.5 * sky[c]!));\n add(h.ground, map3((c) => 0.5 * ground[c]!));\n }\n }\n return irradiance;\n}\n\n/**\n * The spectral inject shadow march over given extinction samples (already × world step × absorbance): one optical\n * depth for the volume's spectrum; stops when every channel's march depth is past 8. Returns (direct, total,\n * reduced, effective) of each channel. The grey twin is `vdbFrameShadowMarch`.\n */\nexport function vdbFrameSpectralShadowMarch(scaledExtinctions: readonly number[], spectrum: Vec3, albedo: Vec3, multipleScattering: number, octaves: Vec4 = vdbFrameOctavesOff): VDBFrameSpectralMarch {\n const unit = vdbFrameSpectralShadowUnit(spectrum, albedo, multipleScattering);\n let opticalDepth = 0;\n for (const e of scaledExtinctions) {\n opticalDepth += e;\n if (Math.min(...vdbFrameSpectralShadowMarchDepth(vdbFrameSpectralShadowDepths(unit, opticalDepth), multipleScattering, octaves)) > 8) break;\n }\n const depths = vdbFrameSpectralShadowDepths(unit, opticalDepth);\n const t = vdbFrameSpectralShadowTransmittance(depths, multipleScattering, octaves);\n return { x: t.x, y: t.y, z: depths.z, w: depths.y };\n}\n\n/**\n * The spectral view-ray pre-integration of one froxel in the inject pass: the alpha of each channel and the\n * lit position t (the channel-mean visibility weight), or null when discarded (the grey twin is\n * `vdbFrameInjectSlice`).\n */\nexport function vdbFrameSpectralInjectSlice(opticalDepths: readonly number[], spectrum: Vec3, segment: Vec2, jitter = 0.5): { alpha: Vec3; t: number } | null {\n const n = opticalDepths.length;\n const transmittance: Vec3 = [1, 1, 1];\n let visibleWeight = 0;\n let visibleTSum = 0;\n for (let i = 0; i < n; i++) {\n const t = segment[0] + (segment[1] - segment[0]) * ((i + jitter) / n);\n const stepT = map3((c) => Math.exp(-spectrum[c]! * opticalDepths[i]!));\n const w = vdbFrameMeanComponent(map3((c) => transmittance[c]! * (1 - stepT[c]!)));\n visibleWeight += w;\n visibleTSum += w * t;\n for (let c = 0; c < 3; c++) transmittance[c] = transmittance[c]! * stepT[c]!;\n }\n const alpha = map3((c) => 1 - transmittance[c]!);\n if (visibleWeight <= 0 || Math.max(...alpha) <= 1e-5) return null;\n return { alpha, t: visibleTSum / visibleWeight };\n}\n\n/**\n * The spectral integrate composite of one pixel (createSpectralFragmentNode, linear blending, full slices): the\n * froxels' premultiplied colour and per-channel alpha front to back. Returns (radiance, transmittance of each channel).\n */\nexport function vdbFrameSpectralIntegrate(froxels: readonly { color: Vec3; alpha: Vec3 }[]): { radiance: Vec3; transmittance: Vec3 } {\n const radiance: Vec3 = [0, 0, 0];\n const transmittance: Vec3 = [1, 1, 1];\n for (const f of froxels) {\n if (Math.max(...transmittance) < 0.001) break;\n const a = map3((c) => clamp01(f.alpha[c]!));\n if (!(Math.max(...a) > 0)) continue;\n for (let c = 0; c < 3; c++) {\n radiance[c] = radiance[c]! + transmittance[c]! * f.color[c]! * (a[c]! / Math.max(a[c]!, 1e-6));\n transmittance[c] = transmittance[c]! * (1 - a[c]!);\n }\n }\n return { radiance, transmittance };\n}\n"]}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Stacked 3D textures of the core frame renderer (K6.2, design §3.2): several logical R³ grids (cascades × targets)
3
+ * are sub-volumes of one 3D texture, tiled along z, then x, then y within the device's `maxTextureDimension3D`. A
4
+ * read clamps the coordinate to the sub-volume's half-texel box, which equals clamp-to-edge per sub-volume and is his
5
+ * `sampleTiles` (bilinear in a slice, linear between slices, both clamped). The core imports the layout; the
6
+ * `k6-core` harness compares the kernels against these twins.
7
+ */
8
+ import { type VDBFrameGridLayout, type VDBFrameShadowLight } from "./grid.js";
9
+ import { type Vec2, type Vec3, type Vec4 } from "./index.js";
10
+ /** Where the sub-volumes of a stack sit. */
11
+ export interface VDBFrameStackLayout {
12
+ /** The 3D texture's size in texels. */
13
+ readonly size: [number, number, number];
14
+ /** Texel origin of each sub-volume, in order. */
15
+ readonly origins: [number, number, number][];
16
+ }
17
+ /**
18
+ * The layout of `count` cubes of `side` texels in one 3D texture: along z first (as many as fit in
19
+ * `maxDimension`), then further columns along x, then rows along y. Throws when they do not fit.
20
+ */
21
+ export declare function vdbFrameStackLayout(side: number, count: number, maxDimension?: number): VDBFrameStackLayout;
22
+ /** A read-back 3D texture: `data` is `channels` values per texel, x fastest, then y, then z. */
23
+ export interface VDBFrameTexture3d {
24
+ readonly data: ArrayLike<number>;
25
+ readonly size: readonly [number, number, number];
26
+ readonly channels: number;
27
+ }
28
+ /** Hardware trilinear filtering (texel centres at i + ½, clamp to edge) of a 3D texture at texel coordinates `p`. */
29
+ export declare function vdbFrameTrilinear(t: VDBFrameTexture3d, p: readonly number[]): number[];
30
+ /** `vdbFrameStackSample`: the sub-volume at `origin` (side `side`) at `uvw`, clamped to its half-texel box. */
31
+ export declare function vdbFrameStackSample(t: VDBFrameTexture3d, origin: readonly number[], side: number, uvw: readonly number[]): number[];
32
+ /** His grid atlas pixel of a voxel (the jitter noise coordinate): tile `cascade · R + z` of `columns` columns. */
33
+ export declare function vdbFrameGridFragCoord(resolution: number, columns: number, cascade: number, cell: Vec3): Vec2;
34
+ /** The world position of grid voxel `cell` of `cascade` (his getGridCell + gridMin + uvw · gridSize). */
35
+ export declare function vdbFrameGridVoxelWorld(grid: VDBFrameGridLayout, cascade: number, cell: Vec3): Vec3;
36
+ /** One shadow caster as the shadow density pass reads it. */
37
+ export interface VDBFrameGridCaster {
38
+ /** World → the local unit box (column-major). */
39
+ readonly worldToLocal: ArrayLike<number>;
40
+ /** The source's largest texel count (getLod) and the volume's max world scale. */
41
+ readonly maxTexels: number;
42
+ readonly worldScale: number;
43
+ /** The volume reads mip levels (else level 0). */
44
+ readonly mipmaps: boolean;
45
+ readonly absorbance: number;
46
+ /** sampleExtinction (extinction per world unit) and sampleAlbedo at a local position and lod. */
47
+ extinctionAt(local: Vec3, lod: number): number;
48
+ albedoAt(local: Vec3, lod: number): Vec3;
49
+ }
50
+ /**
51
+ * The shadow density pass at one voxel (`vdbFrameGridDensityCs`): the summed (extinction, absorption) of the casters
52
+ * whose unit box holds the voxel centre, each read at the voxel's lod (`voxelSize` = the cascade's largest voxel side).
53
+ */
54
+ export declare function vdbFrameGridDensityVoxel(world: Vec3, voxelSize: number, casters: readonly VDBFrameGridCaster[]): Vec2;
55
+ /** K6.3: the multiple scattering terms of {@link vdbFrameTransmittanceVoxel3d} beyond the diffusion value. */
56
+ export interface VDBFrameTransmittanceModes3d {
57
+ /** `getFrameScatteringOctaves` (count 0: off). */
58
+ octaves?: Vec4;
59
+ /** 'two-sided': each slot also marches away from the light (frameTwoSidedDiffusion). */
60
+ twoSided?: boolean;
61
+ /**
62
+ * 'mlp' / 'multi-scale': a slot's total from its direct transmittance, the voxel's world position, the unit direction
63
+ * to the light, the direct optical depth and the march length (e.g. direct + `vdbFrameMlpForward(...)`).
64
+ */
65
+ slotTotal?: ((direct: number, world: Vec3, direction: Vec3, opticalDepth: number, maxDistance: number) => number) | null;
66
+ /**
67
+ * K6.Q1 shadowed ambient: the pairs' upper directions (`vdbFrameAmbientDirections`; [0] the sky direction): the
68
+ * fourth target's z, w become the hemispherical visibilities (V up, V down). Default none (1, 1).
69
+ */
70
+ ambientDirections?: readonly Vec3[] | null;
71
+ /**
72
+ * K6.Q1d ('frame' lighting's `ambientPhase: 'dipole'`, while read): M⁺ / 2 of the directions (`vdbFrameAmbientDipoleMatrix`, row-major): the
73
+ * result's `dipole` is the fifth target, the pairs' dipole b (xyz, w 0; 0 where no extinction is near). Needs
74
+ * `ambientDirections`. Default none.
75
+ */
76
+ ambientDipole?: readonly number[] | null;
77
+ /**
78
+ * K7.15 (his VDB-167): false when nothing reads the sky up / down totals (no probe, hemisphere light or 'outward'
79
+ * environment, no AO pairs): the first target's x, y stay 1, unmarched. Default true. Ignored with
80
+ * `ambientDirections` (pair 0 is the sky marches), as the kernel.
81
+ */
82
+ skyMarch?: boolean;
83
+ }
84
+ /** The grey transmittance targets of one voxel; K6.Q1d: `dipole`, the fifth target, with `modes.ambientDipole`. */
85
+ export type VDBFrameTransmittanceTargets3d = [Vec4, Vec4, Vec4, Vec4] & {
86
+ dipole?: Vec4;
87
+ };
88
+ /**
89
+ * The transmittance pass (grey) at voxel `cell` of `cascade`, through a grid sampled by `gridAt(cascade, uvw)`
90
+ * ((extinction, absorption) of that cascade): the 4 targets of `vdbFrameTransmittanceCs`. `lights` are the slots
91
+ * (≤ 6), `jitter` the frame's (< 0: off); the noise reads his grid atlas pixel. K6.3 `modes`: octaves, two-sided and
92
+ * the slot total of 'mlp' / 'multi-scale'.
93
+ */
94
+ export declare function vdbFrameTransmittanceVoxel3d(gridAt: (cascade: number, uvw: Vec3) => Vec2, grid: VDBFrameGridLayout, cascade: number, cell: Vec3, lights: readonly VDBFrameShadowLight[], skyDirection: Vec3, multipleScattering: number, jitter: number, visibility?: ((slot: number, world: Vec3) => number) | null, modes?: VDBFrameTransmittanceModes3d): VDBFrameTransmittanceTargets3d;
95
+ /**
96
+ * K6.Q1d: one stacked target at a world position (`targetAt(cascade, uvw)`; the dipole: `vdbFrameStackDipole`), blended
97
+ * toward the next cascade as {@link vdbFrameStackShadows}; `outside` outside the grid.
98
+ */
99
+ export declare function vdbFrameStackTarget(targetAt: (cascade: number, uvw: Vec3) => number[], grid: VDBFrameGridLayout, world: Vec3, outside: readonly number[]): number[];
100
+ /**
101
+ * sampleShadows on a stacked transmittance texture: the 4 targets at a world position (`targetAt(cascade, k, uvw)`),
102
+ * 1 outside the grid, blended toward the next cascade within 10% of a cascade's sides.
103
+ */
104
+ export declare function vdbFrameStackShadows(targetAt: (cascade: number, k: number, uvw: Vec3) => number[], grid: VDBFrameGridLayout, world: Vec3): number[][];
105
+ /**
106
+ * The environment grid pass (grey; K6.2b) at voxel `cell` of the last cascade, through a grid sampled by
107
+ * `gridAt(cascade, uvw)`: `unshadowed` (the colour sum of `lights`, ≥ 0) where no extinction is within half a voxel,
108
+ * else Σ colour × total of one-voxel-step marches that stay in the last cascade (with diffusion the two-sided total of
109
+ * the march and the opposite one), ≥ 0. His FrameEnvironmentGridMaterial on a 3D grid. K6.3 `octaves`: the march
110
+ * stops at the last octave's depth, totals are octave sums, and the unshadowed light gets the octave total of 1.
111
+ */
112
+ export declare function vdbFrameEnvironmentGridVoxel3d(gridAt: (cascade: number, uvw: Vec3) => Vec2, grid: VDBFrameGridLayout, cell: Vec3, lights: readonly {
113
+ direction: Vec3;
114
+ color: Vec3;
115
+ }[], multipleScattering: number, octaves?: Vec4): Vec4;
@@ -0,0 +1,290 @@
1
+ // Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
2
+ // src/three-openvdb/frame/webgpu/frameShaderChunks.js L1061–1194 (createGridNodes: sampleTiles, sampleShadows),
3
+ // FrameShadowDensityMaterial.js L111–155 (the shadow density pass at one voxel).
4
+ // Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
5
+ // Changes: stacked 3D textures instead of his 2D slice atlases (K6.2, design §3.2): the layout of the sub-volumes
6
+ // and the hardware trilinear sample of one, as f64 CPU twins of the core kernels. Divergences: DIVERGES.md.
7
+ /**
8
+ * Stacked 3D textures of the core frame renderer (K6.2, design §3.2): several logical R³ grids (cascades × targets)
9
+ * are sub-volumes of one 3D texture, tiled along z, then x, then y within the device's `maxTextureDimension3D`. A
10
+ * read clamps the coordinate to the sub-volume's half-texel box, which equals clamp-to-edge per sub-volume and is his
11
+ * `sampleTiles` (bilinear in a slice, linear between slices, both clamped). The core imports the layout; the
12
+ * `k6-core` harness compares the kernels against these twins.
13
+ */
14
+ import { vdbFrameFindCascade, vdbFrameGridMarch, vdbFrameGridUvw, vdbFrameIsotropicDiffusion } from "./grid.js";
15
+ import { vdbFrameNoise, vdbFrameOctavesOff, vdbFrameShadowAbsorption, vdbFrameShadowDepth, vdbFrameShadowMarchDepth, vdbFrameShadowStep, vdbFrameShadowTotal, vdbFrameShadowTransmittance, vdbFrameTwoSidedDiffusion, } from "./index.js";
16
+ import { vdbFrameOccludedTotal } from "./occluders.js";
17
+ import { vdbFrameAmbientDipole, vdbFrameAmbientPairTotals, vdbFrameAmbientVisibility } from "./ambient.js";
18
+ /**
19
+ * The layout of `count` cubes of `side` texels in one 3D texture: along z first (as many as fit in
20
+ * `maxDimension`), then further columns along x, then rows along y. Throws when they do not fit.
21
+ */
22
+ export function vdbFrameStackLayout(side, count, maxDimension = 2048) {
23
+ const perAxis = Math.floor(maxDimension / side);
24
+ if (perAxis < 1 || count > perAxis * perAxis * perAxis)
25
+ throw new RangeError(`vdbFrameStackLayout: ${count} sub-volumes of ${side}³ do not fit ${maxDimension}³`);
26
+ const alongZ = Math.min(count, perAxis);
27
+ const columns = Math.min(Math.ceil(count / alongZ), perAxis);
28
+ const rows = Math.ceil(count / (alongZ * columns));
29
+ const origins = [];
30
+ for (let i = 0; i < count; i++) {
31
+ const z = i % alongZ;
32
+ const x = Math.floor(i / alongZ) % columns;
33
+ const y = Math.floor(i / (alongZ * columns));
34
+ origins.push([x * side, y * side, z * side]);
35
+ }
36
+ return { size: [columns * side, rows * side, alongZ * side], origins };
37
+ }
38
+ /** Hardware trilinear filtering (texel centres at i + ½, clamp to edge) of a 3D texture at texel coordinates `p`. */
39
+ export function vdbFrameTrilinear(t, p) {
40
+ const [W, H, D] = t.size;
41
+ const f = [p[0] - 0.5, p[1] - 0.5, p[2] - 0.5];
42
+ const i0 = f.map(Math.floor);
43
+ const w = f.map((v, a) => v - i0[a]);
44
+ const cl = (i, n) => Math.min(Math.max(i, 0), n - 1);
45
+ const out = new Array(t.channels).fill(0);
46
+ for (let k = 0; k < 8; k++) {
47
+ const dx = k & 1;
48
+ const dy = (k >> 1) & 1;
49
+ const dz = (k >> 2) & 1;
50
+ const weight = (dx ? w[0] : 1 - w[0]) * (dy ? w[1] : 1 - w[1]) * (dz ? w[2] : 1 - w[2]);
51
+ if (weight === 0)
52
+ continue;
53
+ const at = (cl(i0[0] + dx, W) + (cl(i0[1] + dy, H) + cl(i0[2] + dz, D) * H) * W) * t.channels;
54
+ for (let c = 0; c < t.channels; c++)
55
+ out[c] += t.data[at + c] * weight;
56
+ }
57
+ return out;
58
+ }
59
+ /** `vdbFrameStackSample`: the sub-volume at `origin` (side `side`) at `uvw`, clamped to its half-texel box. */
60
+ export function vdbFrameStackSample(t, origin, side, uvw) {
61
+ return vdbFrameTrilinear(t, [0, 1, 2].map((a) => origin[a] + Math.min(Math.max(uvw[a] * side, 0.5), side - 0.5)));
62
+ }
63
+ /** His grid atlas pixel of a voxel (the jitter noise coordinate): tile `cascade · R + z` of `columns` columns. */
64
+ export function vdbFrameGridFragCoord(resolution, columns, cascade, cell) {
65
+ const tile = cascade * resolution + cell[2];
66
+ return [(tile % columns) * resolution + cell[0] + 0.5, Math.floor(tile / columns) * resolution + cell[1] + 0.5];
67
+ }
68
+ /** The world position of grid voxel `cell` of `cascade` (his getGridCell + gridMin + uvw · gridSize). */
69
+ export function vdbFrameGridVoxelWorld(grid, cascade, cell) {
70
+ const m = grid.gridMin[cascade];
71
+ const s = grid.gridSize[cascade];
72
+ const r = grid.resolution;
73
+ return [m[0] + ((cell[0] + 0.5) / r) * s[0], m[1] + ((cell[1] + 0.5) / r) * s[1], m[2] + ((cell[2] + 0.5) / r) * s[2]];
74
+ }
75
+ /**
76
+ * The shadow density pass at one voxel (`vdbFrameGridDensityCs`): the summed (extinction, absorption) of the casters
77
+ * whose unit box holds the voxel centre, each read at the voxel's lod (`voxelSize` = the cascade's largest voxel side).
78
+ */
79
+ export function vdbFrameGridDensityVoxel(world, voxelSize, casters) {
80
+ let extinction = 0;
81
+ let absorption = 0;
82
+ for (const c of casters) {
83
+ const m = c.worldToLocal;
84
+ const local = [0, 1, 2].map((r) => m[r] * world[0] + m[4 + r] * world[1] + m[8 + r] * world[2] + m[12 + r]);
85
+ if (Math.max(Math.abs(local[0]), Math.abs(local[1]), Math.abs(local[2])) > 0.5)
86
+ continue;
87
+ const lod = Math.max(0, Math.log2((voxelSize / c.worldScale) * c.maxTexels));
88
+ const readLod = c.mipmaps ? lod : 0;
89
+ const e = c.extinctionAt(local, readLod) * c.absorbance;
90
+ if (!(e > 0))
91
+ continue;
92
+ extinction += e;
93
+ absorption += vdbFrameShadowAbsorption(e, c.albedoAt(local, readLod));
94
+ }
95
+ return [extinction, absorption];
96
+ }
97
+ /**
98
+ * The transmittance pass (grey) at voxel `cell` of `cascade`, through a grid sampled by `gridAt(cascade, uvw)`
99
+ * ((extinction, absorption) of that cascade): the 4 targets of `vdbFrameTransmittanceCs`. `lights` are the slots
100
+ * (≤ 6), `jitter` the frame's (< 0: off); the noise reads his grid atlas pixel. K6.3 `modes`: octaves, two-sided and
101
+ * the slot total of 'mlp' / 'multi-scale'.
102
+ */
103
+ export function vdbFrameTransmittanceVoxel3d(gridAt, grid, cascade, cell, lights, skyDirection, multipleScattering, jitter, visibility = null, modes = {}) {
104
+ const out = [
105
+ [1, 1, 1, 1],
106
+ [1, 1, 1, 1],
107
+ [1, 1, 1, 1],
108
+ [1, 1, 1, 1],
109
+ ];
110
+ const dipoleOn = !!modes.ambientDipole && !!modes.ambientDirections && modes.ambientDirections.length > 0;
111
+ if (dipoleOn)
112
+ out.dipole = [0, 0, 0, 0];
113
+ const world = vdbFrameGridVoxelWorld(grid, cascade, cell);
114
+ const voxel = grid.gridVoxel[cascade];
115
+ const extinctionAt = (p) => {
116
+ const c = vdbFrameFindCascade(grid, p, 0);
117
+ return c < 0 ? [0, 0] : gridAt(c, vdbFrameGridUvw(grid, c, p));
118
+ };
119
+ let near = 0;
120
+ for (let i = 0; i < 8; i++) {
121
+ const c = [(i & 1) - 0.5, ((i >> 1) & 1) - 0.5, ((i >> 2) & 1) - 0.5];
122
+ near += extinctionAt([world[0] + c[0] * voxel[0], world[1] + c[1] * voxel[1], world[2] + c[2] * voxel[2]])[0];
123
+ }
124
+ if (!(near > 0))
125
+ return out;
126
+ const noise = vdbFrameNoise(jitter, vdbFrameGridFragCoord(grid.resolution, grid.columns, cascade, cell));
127
+ const n = (v) => {
128
+ const l = Math.hypot(v[0], v[1], v[2]);
129
+ return l > 0 ? [v[0] / l, v[1] / l, v[2] / l] : [0, 0, 0];
130
+ };
131
+ const sky = n(skyDirection);
132
+ const octaves = modes.octaves ?? vdbFrameOctavesOff;
133
+ const slot = (i) => {
134
+ if (i >= lights.length)
135
+ return [1, 1, 0, 0];
136
+ const l = lights[i];
137
+ const isDirection = l[3] < 1.5;
138
+ const toLight = [l[0] - world[0], l[1] - world[1], l[2] - world[2]];
139
+ const dir = isDirection ? n([l[0], l[1], l[2]]) : n(toLight);
140
+ const maxDistance = isDirection ? 1e20 : Math.hypot(...toLight);
141
+ const optical = { opticalDepth: 0 };
142
+ const r = vdbFrameGridMarch(extinctionAt, grid, world, dir, maxDistance, noise, multipleScattering, octaves, optical);
143
+ // K6.3 'two-sided': the slab between the light side and the far side
144
+ if (modes.twoSided)
145
+ r[1] = vdbFrameTwoSidedDiffusion(r[0], r[2], r[3], vdbFrameGridMarch(extinctionAt, grid, world, [-dir[0], -dir[1], -dir[2]], 1e20, noise, multipleScattering, octaves)[2]);
146
+ // K6.3 'mlp' / 'multi-scale': the total from the direct transmittance
147
+ if (modes.slotTotal)
148
+ r[1] = modes.slotTotal(r[0], world, dir, optical.opticalDepth, maxDistance);
149
+ return r;
150
+ };
151
+ const ls = [0, 1, 2, 3, 4, 5].map(slot);
152
+ // K6.5b: a host occluder map scales the slot's scattered part by the voxel's visibility (the direct stays unoccluded),
153
+ // after the K6.3 mode's own total; octaves keep 1 / (1 + depth) (the gather occludes their light)
154
+ if (visibility && !(octaves[0] > 0)) {
155
+ for (let i = 0; i < Math.min(lights.length, 6); i++) {
156
+ const s = ls[i];
157
+ s[1] = vdbFrameOccludedTotal(s[0], s[1], visibility(i, world));
158
+ }
159
+ }
160
+ // K7.15: the sky marches only when something reads them (the AO pairs read pair 0 from them)
161
+ const dirs = modes.ambientDirections;
162
+ const skyMarch = modes.skyMarch !== false || (!!dirs && dirs.length > 0);
163
+ const unmarched = [1, 1, 0, 0];
164
+ const up = skyMarch ? vdbFrameGridMarch(extinctionAt, grid, world, sky, 1e20, noise, multipleScattering, octaves) : unmarched;
165
+ const down = skyMarch ? vdbFrameGridMarch(extinctionAt, grid, world, [-sky[0], -sky[1], -sky[2]], 1e20, noise, multipleScattering, octaves) : unmarched;
166
+ const skyTotal = (f, b) => (multipleScattering > 0 && skyMarch ? vdbFrameIsotropicDiffusion(f[2], b[2], f[3]) : f[1]);
167
+ out[0] = [skyTotal(up, down), skyTotal(down, up), ls[0][1], ls[1][1]];
168
+ out[1] = [ls[2][1], ls[3][1], ls[4][1], ls[5][1]];
169
+ out[2] = [ls[0][0], ls[1][0], ls[2][0], ls[3][0]];
170
+ out[3] = [ls[4][0], ls[5][0], 1, 1];
171
+ // K6.Q1: each pair's isotropic-light totals (pair 0: the sky up / down marches), averaged per side
172
+ if (dirs && dirs.length > 0) {
173
+ const totals = dirs.map((d, k) => {
174
+ const front = k === 0 ? up : vdbFrameGridMarch(extinctionAt, grid, world, d, 1e20, noise, multipleScattering, octaves);
175
+ const back = k === 0 ? down : vdbFrameGridMarch(extinctionAt, grid, world, [-d[0], -d[1], -d[2]], 1e20, noise, multipleScattering, octaves);
176
+ return vdbFrameAmbientPairTotals(front, back, multipleScattering > 0, octaves);
177
+ });
178
+ const v = vdbFrameAmbientVisibility(totals);
179
+ out[3][2] = v[0];
180
+ out[3][3] = v[1];
181
+ // K6.Q1d: the pairs' dipole b
182
+ if (dipoleOn)
183
+ out.dipole = [...vdbFrameAmbientDipole(totals, dirs, modes.ambientDipole), 0];
184
+ }
185
+ return out;
186
+ }
187
+ const smoothstep = (e0, e1, x) => {
188
+ const t = Math.min(Math.max((x - e0) / (e1 - e0), 0), 1);
189
+ return t * t * (3 - 2 * t);
190
+ };
191
+ /**
192
+ * K6.Q1d: one stacked target at a world position (`targetAt(cascade, uvw)`; the dipole: `vdbFrameStackDipole`), blended
193
+ * toward the next cascade as {@link vdbFrameStackShadows}; `outside` outside the grid.
194
+ */
195
+ export function vdbFrameStackTarget(targetAt, grid, world, outside) {
196
+ const cascade = vdbFrameFindCascade(grid, world, 0);
197
+ if (cascade < 0)
198
+ return [...outside];
199
+ const uvw = vdbFrameGridUvw(grid, cascade, world);
200
+ let out = targetAt(cascade, uvw);
201
+ const side = Math.min(uvw[0], uvw[1], uvw[2], 1 - uvw[0], 1 - uvw[1], 1 - uvw[2]);
202
+ const blend = 1 - smoothstep(0, 0.1, side);
203
+ if (blend > 0) {
204
+ const next = vdbFrameFindCascade(grid, world, cascade + 1);
205
+ if (next >= 0) {
206
+ const v = targetAt(next, vdbFrameGridUvw(grid, next, world));
207
+ out = out.map((x, c) => x + (v[c] - x) * blend);
208
+ }
209
+ }
210
+ return out;
211
+ }
212
+ /**
213
+ * sampleShadows on a stacked transmittance texture: the 4 targets at a world position (`targetAt(cascade, k, uvw)`),
214
+ * 1 outside the grid, blended toward the next cascade within 10% of a cascade's sides.
215
+ */
216
+ export function vdbFrameStackShadows(targetAt, grid, world) {
217
+ const out = [0, 1, 2, 3].map(() => [1, 1, 1, 1]);
218
+ const cascade = vdbFrameFindCascade(grid, world, 0);
219
+ if (cascade < 0)
220
+ return out;
221
+ const uvw = vdbFrameGridUvw(grid, cascade, world);
222
+ for (let k = 0; k < 4; k++)
223
+ out[k] = targetAt(cascade, k, uvw);
224
+ const side = Math.min(uvw[0], uvw[1], uvw[2], 1 - uvw[0], 1 - uvw[1], 1 - uvw[2]);
225
+ const blend = 1 - smoothstep(0, 0.1, side);
226
+ if (blend > 0) {
227
+ const next = vdbFrameFindCascade(grid, world, cascade + 1);
228
+ if (next >= 0) {
229
+ const nextUvw = vdbFrameGridUvw(grid, next, world);
230
+ for (let k = 0; k < 4; k++) {
231
+ const v = targetAt(next, k, nextUvw);
232
+ out[k] = out[k].map((x, c) => x + (v[c] - x) * blend);
233
+ }
234
+ }
235
+ }
236
+ return out;
237
+ }
238
+ /**
239
+ * The environment grid pass (grey; K6.2b) at voxel `cell` of the last cascade, through a grid sampled by
240
+ * `gridAt(cascade, uvw)`: `unshadowed` (the colour sum of `lights`, ≥ 0) where no extinction is within half a voxel,
241
+ * else Σ colour × total of one-voxel-step marches that stay in the last cascade (with diffusion the two-sided total of
242
+ * the march and the opposite one), ≥ 0. His FrameEnvironmentGridMaterial on a 3D grid. K6.3 `octaves`: the march
243
+ * stops at the last octave's depth, totals are octave sums, and the unshadowed light gets the octave total of 1.
244
+ */
245
+ export function vdbFrameEnvironmentGridVoxel3d(gridAt, grid, cell, lights, multipleScattering, octaves = vdbFrameOctavesOff) {
246
+ const cascade = grid.count - 1;
247
+ const world = vdbFrameGridVoxelWorld(grid, cascade, cell);
248
+ const voxel = grid.gridVoxel[cascade];
249
+ const uvwOf = (p) => vdbFrameGridUvw(grid, cascade, p);
250
+ const unshadowed = [0, 0, 0];
251
+ for (const l of lights)
252
+ for (let c = 0; c < 3; c++)
253
+ unshadowed[c] = unshadowed[c] + l.color[c];
254
+ let near = 0;
255
+ for (let i = 0; i < 8; i++) {
256
+ const c = [(i & 1) - 0.5, ((i >> 1) & 1) - 0.5, ((i >> 2) & 1) - 0.5];
257
+ near += gridAt(cascade, uvwOf([world[0] + c[0] * voxel[0], world[1] + c[1] * voxel[1], world[2] + c[2] * voxel[2]]))[0];
258
+ }
259
+ const outside = vdbFrameShadowTotal(1, octaves);
260
+ if (!(near > 0))
261
+ return [Math.max(unshadowed[0], 0) * outside, Math.max(unshadowed[1], 0) * outside, Math.max(unshadowed[2], 0) * outside, 1];
262
+ const marchDepths = (dir) => {
263
+ const step = 1 / Math.max(Math.abs(dir[0]) / voxel[0], Math.abs(dir[1]) / voxel[1], Math.abs(dir[2]) / voxel[2]);
264
+ const probe = [world[0] + dir[0] * step * 0.5, world[1] + dir[1] * step * 0.5, world[2] + dir[2] * step * 0.5];
265
+ const depths = [0, 0, 0];
266
+ for (let i = 0; i < 1024; i++) {
267
+ const uvw = uvwOf(probe);
268
+ if (uvw.some((v) => v < 0 || v > 1) || vdbFrameShadowMarchDepth(depths, multipleScattering, octaves) > 6)
269
+ break;
270
+ const s = gridAt(cascade, uvw);
271
+ const d = vdbFrameShadowStep(s[0], s[1], multipleScattering);
272
+ for (let c = 0; c < 3; c++) {
273
+ depths[c] = depths[c] + d[c] * step;
274
+ probe[c] = probe[c] + dir[c] * step;
275
+ }
276
+ }
277
+ return depths;
278
+ };
279
+ const irradiance = [0, 0, 0];
280
+ for (const l of lights) {
281
+ const depths = marchDepths(l.direction);
282
+ const total = multipleScattering > 0
283
+ ? vdbFrameIsotropicDiffusion(depths[2], marchDepths([-l.direction[0], -l.direction[1], -l.direction[2]])[2], depths[1])
284
+ : vdbFrameShadowTotal(vdbFrameShadowTransmittance(depths, multipleScattering, octaves)[1], octaves);
285
+ for (let c = 0; c < 3; c++)
286
+ irradiance[c] = irradiance[c] + l.color[c] * total;
287
+ }
288
+ return [Math.max(irradiance[0], 0), Math.max(irradiance[1], 0), Math.max(irradiance[2], 0), 1];
289
+ }
290
+ //# sourceMappingURL=stack.js.map