@pmndrs/vdb 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (576) hide show
  1. package/CHANGELOG.md +592 -2
  2. package/README.md +85 -37
  3. package/THIRD_PARTY_NOTICES.md +197 -29
  4. package/dist/core/compute/atlas.d.ts +10 -2
  5. package/dist/core/compute/atlas.js +6 -1
  6. package/dist/core/compute/atlas.js.map +1 -1
  7. package/dist/core/compute/index.d.ts +3 -3
  8. package/dist/core/compute/index.js +2 -2
  9. package/dist/core/compute/index.js.map +1 -1
  10. package/dist/core/compute/majorant-build.d.ts +45 -0
  11. package/dist/core/compute/majorant-build.js +193 -0
  12. package/dist/core/compute/majorant-build.js.map +1 -0
  13. package/dist/core/compute/multi-scale.d.ts +155 -0
  14. package/dist/core/compute/multi-scale.js +684 -0
  15. package/dist/core/compute/multi-scale.js.map +1 -0
  16. package/dist/core/compute/pyramid.d.ts +22 -7
  17. package/dist/core/compute/pyramid.js +22 -9
  18. package/dist/core/compute/pyramid.js.map +1 -1
  19. package/dist/core/compute/shared.d.ts +1 -0
  20. package/dist/core/compute/shared.js.map +1 -1
  21. package/dist/core/compute/stats.d.ts +10 -3
  22. package/dist/core/compute/stats.js +6 -1
  23. package/dist/core/compute/stats.js.map +1 -1
  24. package/dist/core/compute/value-transform.d.ts +8 -1
  25. package/dist/core/compute/value-transform.js +9 -3
  26. package/dist/core/compute/value-transform.js.map +1 -1
  27. package/dist/core/errors.d.ts +10 -0
  28. package/dist/core/errors.js +8 -0
  29. package/dist/core/errors.js.map +1 -1
  30. package/dist/core/frame/emission.d.ts +85 -0
  31. package/dist/core/frame/emission.js +422 -0
  32. package/dist/core/frame/emission.js.map +1 -0
  33. package/dist/core/frame/environment.d.ts +47 -0
  34. package/dist/core/frame/environment.js +178 -0
  35. package/dist/core/frame/environment.js.map +1 -0
  36. package/dist/core/frame/index.d.ts +39 -0
  37. package/dist/core/frame/index.js +27 -0
  38. package/dist/core/frame/index.js.map +1 -0
  39. package/dist/core/frame/kernels.d.ts +115 -0
  40. package/dist/core/frame/kernels.js +496 -0
  41. package/dist/core/frame/kernels.js.map +1 -0
  42. package/dist/core/frame/limits.d.ts +67 -0
  43. package/dist/core/frame/limits.js +109 -0
  44. package/dist/core/frame/limits.js.map +1 -0
  45. package/dist/core/frame/phase.d.ts +17 -0
  46. package/dist/core/frame/phase.js +53 -0
  47. package/dist/core/frame/phase.js.map +1 -0
  48. package/dist/core/frame/pipelines.d.ts +49 -0
  49. package/dist/core/frame/pipelines.js +147 -0
  50. package/dist/core/frame/pipelines.js.map +1 -0
  51. package/dist/core/frame/renderer.d.ts +122 -0
  52. package/dist/core/frame/renderer.js +1712 -0
  53. package/dist/core/frame/renderer.js.map +1 -0
  54. package/dist/core/frame/resources.d.ts +71 -0
  55. package/dist/core/frame/resources.js +100 -0
  56. package/dist/core/frame/resources.js.map +1 -0
  57. package/dist/core/frame/scattering.d.ts +97 -0
  58. package/dist/core/frame/scattering.js +332 -0
  59. package/dist/core/frame/scattering.js.map +1 -0
  60. package/dist/core/frame/settings.d.ts +243 -0
  61. package/dist/core/frame/settings.js +67 -0
  62. package/dist/core/frame/settings.js.map +1 -0
  63. package/dist/core/frame/shadows.d.ts +55 -0
  64. package/dist/core/frame/shadows.js +460 -0
  65. package/dist/core/frame/shadows.js.map +1 -0
  66. package/dist/core/frame/types.d.ts +415 -0
  67. package/dist/core/frame/types.js +49 -0
  68. package/dist/core/frame/types.js.map +1 -0
  69. package/dist/core/frame/uniforms.d.ts +105 -0
  70. package/dist/core/frame/uniforms.js +276 -0
  71. package/dist/core/frame/uniforms.js.map +1 -0
  72. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  73. package/dist/core/frame/wgsl/chunks.js +728 -0
  74. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  75. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  76. package/dist/core/frame/wgsl/emission.js +353 -0
  77. package/dist/core/frame/wgsl/emission.js.map +1 -0
  78. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  79. package/dist/core/frame/wgsl/environment.js +711 -0
  80. package/dist/core/frame/wgsl/environment.js.map +1 -0
  81. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  82. package/dist/core/frame/wgsl/gather.js +850 -0
  83. package/dist/core/frame/wgsl/gather.js.map +1 -0
  84. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  85. package/dist/core/frame/wgsl/integrate.js +213 -0
  86. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  87. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  88. package/dist/core/frame/wgsl/lighting.js +1636 -0
  89. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  90. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  91. package/dist/core/frame/wgsl/occluders.js +95 -0
  92. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  93. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  94. package/dist/core/frame/wgsl/resolve.js +205 -0
  95. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  96. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  97. package/dist/core/frame/wgsl/shadows.js +328 -0
  98. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  99. package/dist/core/half.d.ts +11 -0
  100. package/dist/core/half.js +22 -0
  101. package/dist/core/half.js.map +1 -0
  102. package/dist/core/index.d.ts +25 -3
  103. package/dist/core/index.js +23 -4
  104. package/dist/core/index.js.map +1 -1
  105. package/dist/core/internal.d.ts +17 -1
  106. package/dist/core/internal.js +18 -1
  107. package/dist/core/internal.js.map +1 -1
  108. package/dist/core/pool/image-header.d.ts +13 -2
  109. package/dist/core/pool/image-header.js +24 -5
  110. package/dist/core/pool/image-header.js.map +1 -1
  111. package/dist/core/pool/layout.d.ts +35 -1
  112. package/dist/core/pool/layout.js +51 -2
  113. package/dist/core/pool/layout.js.map +1 -1
  114. package/dist/core/pool/limits.d.ts +1 -0
  115. package/dist/core/pool/limits.js +1 -0
  116. package/dist/core/pool/limits.js.map +1 -1
  117. package/dist/core/pool/pool.d.ts +120 -15
  118. package/dist/core/pool/pool.js +255 -24
  119. package/dist/core/pool/pool.js.map +1 -1
  120. package/dist/core/reference/index.d.ts +6 -0
  121. package/dist/core/reference/index.js +7 -0
  122. package/dist/core/reference/index.js.map +1 -0
  123. package/dist/core/reference/renderer.d.ts +105 -0
  124. package/dist/core/reference/renderer.js +474 -0
  125. package/dist/core/reference/renderer.js.map +1 -0
  126. package/dist/core/reference/wgsl.d.ts +65 -0
  127. package/dist/core/reference/wgsl.js +803 -0
  128. package/dist/core/reference/wgsl.js.map +1 -0
  129. package/dist/{three → core}/sequence.d.ts +32 -2
  130. package/dist/{three → core}/sequence.js +24 -2
  131. package/dist/core/sequence.js.map +1 -0
  132. package/dist/core/source/brick-cache.d.ts +165 -0
  133. package/dist/core/source/brick-cache.js +627 -0
  134. package/dist/core/source/brick-cache.js.map +1 -0
  135. package/dist/core/source/dense-fill.d.ts +53 -0
  136. package/dist/core/source/dense-fill.js +377 -0
  137. package/dist/core/source/dense-fill.js.map +1 -0
  138. package/dist/core/source/dense.d.ts +33 -2
  139. package/dist/core/source/dense.js +121 -24
  140. package/dist/core/source/dense.js.map +1 -1
  141. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  142. package/dist/core/source/sparse-wgsl.js +481 -0
  143. package/dist/core/source/sparse-wgsl.js.map +1 -0
  144. package/dist/core/source/sparse.d.ts +192 -0
  145. package/dist/core/source/sparse.js +762 -0
  146. package/dist/core/source/sparse.js.map +1 -0
  147. package/dist/core/source/types.d.ts +59 -2
  148. package/dist/core/source/types.js.map +1 -1
  149. package/dist/core/surface/index.d.ts +10 -0
  150. package/dist/core/surface/index.js +9 -0
  151. package/dist/core/surface/index.js.map +1 -0
  152. package/dist/core/surface/level-set-pass.d.ts +140 -0
  153. package/dist/core/surface/level-set-pass.js +291 -0
  154. package/dist/core/surface/level-set-pass.js.map +1 -0
  155. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  156. package/dist/core/surface/level-set-wgsl.js +99 -0
  157. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  158. package/dist/core/surface/points.d.ts +109 -0
  159. package/dist/core/surface/points.js +226 -0
  160. package/dist/core/surface/points.js.map +1 -0
  161. package/dist/core/types.d.ts +12 -3
  162. package/dist/core/types.js +6 -2
  163. package/dist/core/types.js.map +1 -1
  164. package/dist/core/wgsl/api.d.ts +29 -5
  165. package/dist/core/wgsl/api.js +110 -27
  166. package/dist/core/wgsl/api.js.map +1 -1
  167. package/dist/core/wgsl/generate.d.ts +8 -0
  168. package/dist/core/wgsl/generate.js +195 -22
  169. package/dist/core/wgsl/generate.js.map +1 -1
  170. package/dist/core/wgsl/lean.d.ts +50 -0
  171. package/dist/core/wgsl/lean.js +327 -0
  172. package/dist/core/wgsl/lean.js.map +1 -0
  173. package/dist/core/wgsl/level-set.d.ts +5 -1
  174. package/dist/core/wgsl/level-set.js +11 -5
  175. package/dist/core/wgsl/level-set.js.map +1 -1
  176. package/dist/core/wgsl/majorant.d.ts +62 -0
  177. package/dist/core/wgsl/majorant.js +381 -0
  178. package/dist/core/wgsl/majorant.js.map +1 -0
  179. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +2 -2
  180. package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
  181. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
  182. package/dist/core/wgsl/types.d.ts +97 -3
  183. package/dist/core/wgsl/types.js.map +1 -1
  184. package/dist/three/coarse-first.d.ts +53 -8
  185. package/dist/three/coarse-first.js +24 -6
  186. package/dist/three/coarse-first.js.map +1 -1
  187. package/dist/three/compute.d.ts +12 -2
  188. package/dist/three/compute.js +16 -6
  189. package/dist/three/compute.js.map +1 -1
  190. package/dist/three/device.d.ts +7 -0
  191. package/dist/three/device.js +3 -0
  192. package/dist/three/device.js.map +1 -1
  193. package/dist/three/frame/core-environment.d.ts +38 -0
  194. package/dist/three/frame/core-environment.js +154 -0
  195. package/dist/three/frame/core-environment.js.map +1 -0
  196. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  197. package/dist/three/frame/core-integrate-material.js +162 -0
  198. package/dist/three/frame/core-integrate-material.js.map +1 -0
  199. package/dist/three/frame/core-occluders.d.ts +53 -0
  200. package/dist/three/frame/core-occluders.js +193 -0
  201. package/dist/three/frame/core-occluders.js.map +1 -0
  202. package/dist/three/frame/core-structs.d.ts +34 -0
  203. package/dist/three/frame/core-structs.js +61 -0
  204. package/dist/three/frame/core-structs.js.map +1 -0
  205. package/dist/three/frame/core-textures.d.ts +41 -0
  206. package/dist/three/frame/core-textures.js +114 -0
  207. package/dist/three/frame/core-textures.js.map +1 -0
  208. package/dist/three/frame/emission-light.d.ts +64 -114
  209. package/dist/three/frame/emission-light.js +188 -567
  210. package/dist/three/frame/emission-light.js.map +1 -1
  211. package/dist/three/frame/index.d.ts +11 -31
  212. package/dist/three/frame/index.js +9 -29
  213. package/dist/three/frame/index.js.map +1 -1
  214. package/dist/three/frame/medium.d.ts +12 -0
  215. package/dist/three/frame/medium.js.map +1 -1
  216. package/dist/three/frame/renderer.d.ts +58 -454
  217. package/dist/three/frame/renderer.js +409 -1427
  218. package/dist/three/frame/renderer.js.map +1 -1
  219. package/dist/three/frame/spectrum.d.ts +0 -14
  220. package/dist/three/frame/spectrum.js +2 -23
  221. package/dist/three/frame/spectrum.js.map +1 -1
  222. package/dist/three/frame/three-internals.d.ts +3 -8
  223. package/dist/three/frame/three-internals.js +13 -11
  224. package/dist/three/frame/three-internals.js.map +1 -1
  225. package/dist/three/frame/volume-shadows.d.ts +93 -107
  226. package/dist/three/frame/volume-shadows.js +278 -631
  227. package/dist/three/frame/volume-shadows.js.map +1 -1
  228. package/dist/three/frame/volume.d.ts +91 -33
  229. package/dist/three/frame/volume.js +63 -51
  230. package/dist/three/frame/volume.js.map +1 -1
  231. package/dist/three/grid-node.d.ts +34 -1
  232. package/dist/three/grid-node.js +36 -1
  233. package/dist/three/grid-node.js.map +1 -1
  234. package/dist/three/index.d.ts +20 -11
  235. package/dist/three/index.js +21 -12
  236. package/dist/three/index.js.map +1 -1
  237. package/dist/three/internal.d.ts +14 -8
  238. package/dist/three/internal.js +11 -7
  239. package/dist/three/internal.js.map +1 -1
  240. package/dist/three/level-set-material.d.ts +81 -8
  241. package/dist/three/level-set-material.js +162 -125
  242. package/dist/three/level-set-material.js.map +1 -1
  243. package/dist/three/level-set-physical-material.d.ts +154 -0
  244. package/dist/three/level-set-physical-material.js +253 -0
  245. package/dist/three/level-set-physical-material.js.map +1 -0
  246. package/dist/three/level-set-velocity.d.ts +94 -0
  247. package/dist/three/level-set-velocity.js +208 -0
  248. package/dist/three/level-set-velocity.js.map +1 -0
  249. package/dist/three/material.d.ts +141 -11
  250. package/dist/three/material.js +161 -18
  251. package/dist/three/material.js.map +1 -1
  252. package/dist/three/points.d.ts +60 -4
  253. package/dist/three/points.js +140 -9
  254. package/dist/three/points.js.map +1 -1
  255. package/dist/three/sparse-source.d.ts +49 -117
  256. package/dist/three/sparse-source.js +109 -580
  257. package/dist/three/sparse-source.js.map +1 -1
  258. package/dist/three/volume-source.d.ts +11 -156
  259. package/dist/three/volume-source.js +29 -272
  260. package/dist/three/volume-source.js.map +1 -1
  261. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  262. package/dist/tools/cpu/brick-atlas.js +129 -0
  263. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  264. package/dist/tools/cpu/compute.d.ts +23 -4
  265. package/dist/tools/cpu/compute.js +35 -14
  266. package/dist/tools/cpu/compute.js.map +1 -1
  267. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  268. package/dist/tools/cpu/lean-reads.js +262 -0
  269. package/dist/tools/cpu/lean-reads.js.map +1 -0
  270. package/dist/tools/cpu/level-set.d.ts +42 -3
  271. package/dist/tools/cpu/level-set.js +59 -7
  272. package/dist/tools/cpu/level-set.js.map +1 -1
  273. package/dist/tools/cpu/majorant.d.ts +265 -0
  274. package/dist/tools/cpu/majorant.js +541 -0
  275. package/dist/tools/cpu/majorant.js.map +1 -0
  276. package/dist/tools/cpu/march.d.ts +93 -2
  277. package/dist/tools/cpu/march.js +165 -14
  278. package/dist/tools/cpu/march.js.map +1 -1
  279. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  280. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  281. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  282. package/dist/tools/cpu/points.d.ts +29 -0
  283. package/dist/tools/cpu/points.js +38 -0
  284. package/dist/tools/cpu/points.js.map +1 -0
  285. package/dist/tools/cpu/read-value.d.ts +19 -6
  286. package/dist/tools/cpu/read-value.js +32 -17
  287. package/dist/tools/cpu/read-value.js.map +1 -1
  288. package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
  289. package/dist/tools/cpu/sample-trilinear.js +19 -7
  290. package/dist/tools/cpu/sample-trilinear.js.map +1 -1
  291. package/dist/tools/cpu/stride-tables.d.ts +2 -2
  292. package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
  293. package/dist/tools/cpu/stride-tables.generated.js +7 -6
  294. package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
  295. package/dist/tools/cpu/stride-tables.js +1 -1
  296. package/dist/tools/cpu/stride-tables.js.map +1 -1
  297. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  298. package/dist/tools/cpu/surface-nets.js +597 -0
  299. package/dist/tools/cpu/surface-nets.js.map +1 -0
  300. package/dist/tools/errors.d.ts +9 -0
  301. package/dist/tools/errors.js +9 -0
  302. package/dist/tools/errors.js.map +1 -1
  303. package/dist/tools/frame/ambient.d.ts +98 -0
  304. package/dist/tools/frame/ambient.js +274 -0
  305. package/dist/tools/frame/ambient.js.map +1 -0
  306. package/dist/tools/frame/blackbody.d.ts +15 -0
  307. package/dist/tools/frame/blackbody.js +35 -0
  308. package/dist/tools/frame/blackbody.js.map +1 -1
  309. package/dist/tools/frame/brick-cache.d.ts +165 -0
  310. package/dist/tools/frame/brick-cache.js +326 -0
  311. package/dist/tools/frame/brick-cache.js.map +1 -0
  312. package/dist/tools/frame/emission.d.ts +9 -0
  313. package/dist/tools/frame/emission.js +9 -1
  314. package/dist/tools/frame/emission.js.map +1 -1
  315. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  316. package/dist/tools/frame/environment-gpu.js +280 -0
  317. package/dist/tools/frame/environment-gpu.js.map +1 -0
  318. package/dist/tools/frame/environment.d.ts +3 -2
  319. package/dist/tools/frame/environment.js +8 -4
  320. package/dist/tools/frame/environment.js.map +1 -1
  321. package/dist/tools/frame/froxel.d.ts +58 -0
  322. package/dist/tools/frame/froxel.js +115 -0
  323. package/dist/tools/frame/froxel.js.map +1 -0
  324. package/dist/tools/frame/grid.d.ts +90 -0
  325. package/dist/tools/frame/grid.js +112 -13
  326. package/dist/tools/frame/grid.js.map +1 -1
  327. package/dist/tools/frame/index.d.ts +14 -0
  328. package/dist/tools/frame/index.js +45 -4
  329. package/dist/tools/frame/index.js.map +1 -1
  330. package/dist/tools/frame/medium.d.ts +16 -0
  331. package/dist/tools/frame/medium.js +3 -1
  332. package/dist/tools/frame/medium.js.map +1 -1
  333. package/dist/tools/frame/mie.d.ts +9 -0
  334. package/dist/tools/frame/mie.js +18 -0
  335. package/dist/tools/frame/mie.js.map +1 -1
  336. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  337. package/dist/tools/frame/mlp-nn.js +159 -0
  338. package/dist/tools/frame/mlp-nn.js.map +1 -0
  339. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  340. package/dist/tools/frame/mlp-tza.js +186 -0
  341. package/dist/tools/frame/mlp-tza.js.map +1 -0
  342. package/dist/tools/frame/mlp.d.ts +183 -0
  343. package/dist/tools/frame/mlp.js +434 -0
  344. package/dist/tools/frame/mlp.js.map +1 -0
  345. package/dist/tools/frame/ms-exit.d.ts +42 -0
  346. package/dist/tools/frame/ms-exit.js +90 -0
  347. package/dist/tools/frame/ms-exit.js.map +1 -0
  348. package/dist/tools/frame/multi-scale.d.ts +152 -0
  349. package/dist/tools/frame/multi-scale.js +302 -0
  350. package/dist/tools/frame/multi-scale.js.map +1 -0
  351. package/dist/tools/frame/neural-weights.d.ts +6 -5
  352. package/dist/tools/frame/neural-weights.js +234 -235
  353. package/dist/tools/frame/neural-weights.js.map +1 -1
  354. package/dist/tools/frame/neural.js +1 -1
  355. package/dist/tools/frame/neural.js.map +1 -1
  356. package/dist/tools/frame/occluders.d.ts +51 -0
  357. package/dist/tools/frame/occluders.js +72 -0
  358. package/dist/tools/frame/occluders.js.map +1 -0
  359. package/dist/tools/frame/pyramid-layout.d.ts +17 -0
  360. package/dist/tools/frame/pyramid-layout.js +47 -0
  361. package/dist/tools/frame/pyramid-layout.js.map +1 -1
  362. package/dist/tools/frame/shadows.d.ts +110 -0
  363. package/dist/tools/frame/shadows.js +286 -0
  364. package/dist/tools/frame/shadows.js.map +1 -1
  365. package/dist/tools/frame/sparse.d.ts +82 -0
  366. package/dist/tools/frame/sparse.js +242 -1
  367. package/dist/tools/frame/sparse.js.map +1 -1
  368. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  369. package/dist/tools/frame/spectral-stack.js +391 -0
  370. package/dist/tools/frame/spectral-stack.js.map +1 -0
  371. package/dist/tools/frame/spectral.d.ts +21 -2
  372. package/dist/tools/frame/spectral.js +30 -8
  373. package/dist/tools/frame/spectral.js.map +1 -1
  374. package/dist/tools/frame/stack.d.ts +115 -0
  375. package/dist/tools/frame/stack.js +290 -0
  376. package/dist/tools/frame/stack.js.map +1 -0
  377. package/dist/tools/frame/view.d.ts +131 -0
  378. package/dist/tools/frame/view.js +337 -0
  379. package/dist/tools/frame/view.js.map +1 -0
  380. package/dist/tools/index.d.ts +66 -15
  381. package/dist/tools/index.js +55 -11
  382. package/dist/tools/index.js.map +1 -1
  383. package/dist/tools/internal.d.ts +58 -17
  384. package/dist/tools/internal.js +65 -11
  385. package/dist/tools/internal.js.map +1 -1
  386. package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
  387. package/dist/tools/nanovdb/build-from-vdb.js +10 -2
  388. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
  389. package/dist/tools/nanovdb/bytes.d.ts +17 -4
  390. package/dist/tools/nanovdb/bytes.js +46 -3
  391. package/dist/tools/nanovdb/bytes.js.map +1 -1
  392. package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
  393. package/dist/tools/nanovdb/coarse-first.js +7 -1
  394. package/dist/tools/nanovdb/coarse-first.js.map +1 -1
  395. package/dist/tools/nanovdb/half.d.ts +22 -0
  396. package/dist/tools/nanovdb/half.js +73 -0
  397. package/dist/tools/nanovdb/half.js.map +1 -0
  398. package/dist/tools/nanovdb/index.d.ts +3 -1
  399. package/dist/tools/nanovdb/index.js +2 -1
  400. package/dist/tools/nanovdb/index.js.map +1 -1
  401. package/dist/tools/nanovdb/inspect.d.ts +10 -1
  402. package/dist/tools/nanovdb/inspect.js +8 -1
  403. package/dist/tools/nanovdb/inspect.js.map +1 -1
  404. package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
  405. package/dist/tools/nanovdb/leaf-codec.js +40 -4
  406. package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
  407. package/dist/tools/nanovdb/quantize.d.ts +39 -10
  408. package/dist/tools/nanovdb/quantize.js +96 -44
  409. package/dist/tools/nanovdb/quantize.js.map +1 -1
  410. package/dist/tools/nanovdb/resample.d.ts +20 -3
  411. package/dist/tools/nanovdb/resample.js +20 -7
  412. package/dist/tools/nanovdb/resample.js.map +1 -1
  413. package/dist/tools/nanovdb/serialize.d.ts +34 -3
  414. package/dist/tools/nanovdb/serialize.js +51 -7
  415. package/dist/tools/nanovdb/serialize.js.map +1 -1
  416. package/dist/tools/nanovdb/stats.d.ts +34 -5
  417. package/dist/tools/nanovdb/stats.js +87 -11
  418. package/dist/tools/nanovdb/stats.js.map +1 -1
  419. package/dist/tools/nanovdb/transform.d.ts +4 -0
  420. package/dist/tools/nanovdb/transform.js +3 -0
  421. package/dist/tools/nanovdb/transform.js.map +1 -1
  422. package/dist/tools/nanovdb/tree.d.ts +14 -3
  423. package/dist/tools/nanovdb/tree.js +25 -13
  424. package/dist/tools/nanovdb/tree.js.map +1 -1
  425. package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
  426. package/dist/tools/nanovdb/write-nvdb.js +108 -28
  427. package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
  428. package/dist/tools/nvdb-file.d.ts +77 -7
  429. package/dist/tools/nvdb-file.js +177 -20
  430. package/dist/tools/nvdb-file.js.map +1 -1
  431. package/dist/tools/nvdb-stream.d.ts +23 -7
  432. package/dist/tools/nvdb-stream.js +78 -34
  433. package/dist/tools/nvdb-stream.js.map +1 -1
  434. package/dist/tools/reference/analytic.d.ts +41 -0
  435. package/dist/tools/reference/analytic.js +95 -0
  436. package/dist/tools/reference/analytic.js.map +1 -0
  437. package/dist/tools/reference/environment.d.ts +62 -0
  438. package/dist/tools/reference/environment.js +154 -0
  439. package/dist/tools/reference/environment.js.map +1 -0
  440. package/dist/tools/reference/index.d.ts +12 -0
  441. package/dist/tools/reference/index.js +13 -0
  442. package/dist/tools/reference/index.js.map +1 -0
  443. package/dist/tools/reference/media.d.ts +14 -0
  444. package/dist/tools/reference/media.js +30 -0
  445. package/dist/tools/reference/media.js.map +1 -0
  446. package/dist/tools/reference/rng.d.ts +20 -0
  447. package/dist/tools/reference/rng.js +30 -0
  448. package/dist/tools/reference/rng.js.map +1 -0
  449. package/dist/tools/reference/scene.d.ts +312 -0
  450. package/dist/tools/reference/scene.js +169 -0
  451. package/dist/tools/reference/scene.js.map +1 -0
  452. package/dist/tools/reference/tables.d.ts +98 -0
  453. package/dist/tools/reference/tables.js +264 -0
  454. package/dist/tools/reference/tables.js.map +1 -0
  455. package/dist/tools/reference/trace.d.ts +160 -0
  456. package/dist/tools/reference/trace.js +497 -0
  457. package/dist/tools/reference/trace.js.map +1 -0
  458. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  459. package/dist/tools/vdb/blosc-write.js +197 -0
  460. package/dist/tools/vdb/blosc-write.js.map +1 -0
  461. package/dist/tools/vdb/blosc.d.ts +35 -5
  462. package/dist/tools/vdb/blosc.js +82 -26
  463. package/dist/tools/vdb/blosc.js.map +1 -1
  464. package/dist/tools/vdb/blosclz.d.ts +33 -0
  465. package/dist/tools/vdb/blosclz.js +112 -0
  466. package/dist/tools/vdb/blosclz.js.map +1 -0
  467. package/dist/tools/vdb/byte-reader.d.ts +13 -3
  468. package/dist/tools/vdb/byte-reader.js +26 -4
  469. package/dist/tools/vdb/byte-reader.js.map +1 -1
  470. package/dist/tools/vdb/compression.d.ts +13 -5
  471. package/dist/tools/vdb/compression.js +13 -2
  472. package/dist/tools/vdb/compression.js.map +1 -1
  473. package/dist/tools/vdb/grid.js +8 -2
  474. package/dist/tools/vdb/grid.js.map +1 -1
  475. package/dist/tools/vdb/index.d.ts +2 -1
  476. package/dist/tools/vdb/index.js.map +1 -1
  477. package/dist/tools/vdb/lz4.d.ts +30 -0
  478. package/dist/tools/vdb/lz4.js +228 -0
  479. package/dist/tools/vdb/lz4.js.map +1 -0
  480. package/dist/tools/vdb/metadata.js +1 -1
  481. package/dist/tools/vdb/metadata.js.map +1 -1
  482. package/dist/tools/vdb/parse.d.ts +24 -2
  483. package/dist/tools/vdb/parse.js +102 -32
  484. package/dist/tools/vdb/parse.js.map +1 -1
  485. package/dist/tools/vdb/point-render-data.d.ts +49 -1
  486. package/dist/tools/vdb/point-render-data.js +91 -11
  487. package/dist/tools/vdb/point-render-data.js.map +1 -1
  488. package/dist/tools/vdb/points.d.ts +26 -0
  489. package/dist/tools/vdb/points.js +46 -5
  490. package/dist/tools/vdb/points.js.map +1 -1
  491. package/dist/tools/vdb/types.d.ts +59 -2
  492. package/dist/tools/vdb/types.js.map +1 -1
  493. package/dist/tools/wvdb/bake.d.ts +38 -9
  494. package/dist/tools/wvdb/bake.js +63 -13
  495. package/dist/tools/wvdb/bake.js.map +1 -1
  496. package/dist/tools/wvdb/dense.d.ts +80 -1
  497. package/dist/tools/wvdb/dense.js +67 -8
  498. package/dist/tools/wvdb/dense.js.map +1 -1
  499. package/dist/tools/wvdb/format.d.ts +59 -0
  500. package/dist/tools/wvdb/format.js +3 -0
  501. package/dist/tools/wvdb/format.js.map +1 -1
  502. package/dist/tools/wvdb/index.d.ts +1 -0
  503. package/dist/tools/wvdb/index.js +1 -0
  504. package/dist/tools/wvdb/index.js.map +1 -1
  505. package/dist/tools/wvdb/level-set.d.ts +10 -2
  506. package/dist/tools/wvdb/level-set.js.map +1 -1
  507. package/dist/tools/wvdb/nanovdb.d.ts +6 -1
  508. package/dist/tools/wvdb/nanovdb.js +5 -1
  509. package/dist/tools/wvdb/nanovdb.js.map +1 -1
  510. package/dist/tools/wvdb/partial.d.ts +74 -0
  511. package/dist/tools/wvdb/partial.js +233 -0
  512. package/dist/tools/wvdb/partial.js.map +1 -0
  513. package/dist/tools/wvdb/read.d.ts +77 -1
  514. package/dist/tools/wvdb/read.js +30 -7
  515. package/dist/tools/wvdb/read.js.map +1 -1
  516. package/dist/tools/wvdb/write.d.ts +23 -1
  517. package/dist/tools/wvdb/write.js +8 -1
  518. package/dist/tools/wvdb/write.js.map +1 -1
  519. package/package.json +2 -1
  520. package/vendor/VENDOR.md +21 -6
  521. package/vendor/pnanovdb.wgsl +52 -14
  522. package/dist/three/frame/blackbody.d.ts +0 -42
  523. package/dist/three/frame/blackbody.js +0 -74
  524. package/dist/three/frame/blackbody.js.map +0 -1
  525. package/dist/three/frame/chunks.d.ts +0 -157
  526. package/dist/three/frame/chunks.js +0 -559
  527. package/dist/three/frame/chunks.js.map +0 -1
  528. package/dist/three/frame/density-material.d.ts +0 -53
  529. package/dist/three/frame/density-material.js +0 -353
  530. package/dist/three/frame/density-material.js.map +0 -1
  531. package/dist/three/frame/environment-grid-material.d.ts +0 -21
  532. package/dist/three/frame/environment-grid-material.js +0 -184
  533. package/dist/three/frame/environment-grid-material.js.map +0 -1
  534. package/dist/three/frame/environment-material.d.ts +0 -22
  535. package/dist/three/frame/environment-material.js +0 -87
  536. package/dist/three/frame/environment-material.js.map +0 -1
  537. package/dist/three/frame/grid-mip-material.d.ts +0 -12
  538. package/dist/three/frame/grid-mip-material.js +0 -61
  539. package/dist/three/frame/grid-mip-material.js.map +0 -1
  540. package/dist/three/frame/inject-material.d.ts +0 -56
  541. package/dist/three/frame/inject-material.js +0 -424
  542. package/dist/three/frame/inject-material.js.map +0 -1
  543. package/dist/three/frame/integrate-material.d.ts +0 -26
  544. package/dist/three/frame/integrate-material.js +0 -198
  545. package/dist/three/frame/integrate-material.js.map +0 -1
  546. package/dist/three/frame/layout.d.ts +0 -34
  547. package/dist/three/frame/layout.js +0 -48
  548. package/dist/three/frame/layout.js.map +0 -1
  549. package/dist/three/frame/lighting-material.d.ts +0 -41
  550. package/dist/three/frame/lighting-material.js +0 -257
  551. package/dist/three/frame/lighting-material.js.map +0 -1
  552. package/dist/three/frame/lights.d.ts +0 -11
  553. package/dist/three/frame/lights.js +0 -16
  554. package/dist/three/frame/lights.js.map +0 -1
  555. package/dist/three/frame/neural.d.ts +0 -14
  556. package/dist/three/frame/neural.js +0 -105
  557. package/dist/three/frame/neural.js.map +0 -1
  558. package/dist/three/frame/phase.d.ts +0 -44
  559. package/dist/three/frame/phase.js +0 -80
  560. package/dist/three/frame/phase.js.map +0 -1
  561. package/dist/three/frame/shadow-density-material.d.ts +0 -30
  562. package/dist/three/frame/shadow-density-material.js +0 -123
  563. package/dist/three/frame/shadow-density-material.js.map +0 -1
  564. package/dist/three/frame/temporal-material.d.ts +0 -29
  565. package/dist/three/frame/temporal-material.js +0 -152
  566. package/dist/three/frame/temporal-material.js.map +0 -1
  567. package/dist/three/frame/transmittance-material.d.ts +0 -31
  568. package/dist/three/frame/transmittance-material.js +0 -315
  569. package/dist/three/frame/transmittance-material.js.map +0 -1
  570. package/dist/three/frame/view.d.ts +0 -103
  571. package/dist/three/frame/view.js +0 -296
  572. package/dist/three/frame/view.js.map +0 -1
  573. package/dist/three/frame/volume-shadow-material.d.ts +0 -36
  574. package/dist/three/frame/volume-shadow-material.js +0 -128
  575. package/dist/three/frame/volume-shadow-material.js.map +0 -1
  576. package/dist/three/sequence.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lean.js","sourceRoot":"","sources":["../../../src/core/wgsl/lean.ts"],"names":[],"mappings":"AAuBA,sHAAsH;AACtH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,8CAA8C;IAC9C,QAAQ,EAAE,GAAG;IACb,iFAAiF;IACjF,cAAc,EAAE,EAAE;IAClB,aAAa,EAAE,EAAE;IACjB,cAAc,EAAE,EAAE;IAClB,2DAA2D;IAC3D,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,EAAE;IACjB,aAAa,EAAE,EAAE;IACjB,cAAc,EAAE,EAAE;IAClB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,EAAE;IAClB,cAAc,EAAE,GAAG;IACnB,UAAU,EAAE,IAAI;IAChB,qDAAqD;IACrD,WAAW,EAAE,CAAC;IACd,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,EAAE;IACjB,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,EAAE;CACL,CAAC;AAEX,MAAM,CAAC,GAAG,YAAY,CAAC;AAEvB,8FAA8F;AAC9F,MAAM,UAAU,GAA8C;IAC5D,KAAK,EAAE,qBAAqB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,oBAAoB;CAC3B,CAAC;AAEF,uDAAuD;AACvD,MAAM,WAAW,GAA6C,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,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C,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAa,EAAE,IAAa;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,mEAAmE,CAAC,CAAC,CAAC,YAAY,CAAC;IACxG,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO;YACL;;mBAEa,IAAI,CAAC,CAAC,CAAC,kDAAkD,CAAC,CAAC,CAAC,EAAE;;;;EAI/E;SACG,CAAC;IACJ,CAAC;IACD,OAAO;QACL,sEACE,IAAI;YACF,CAAC,CAAC;;;MAGJ;YACE,CAAC,CAAC,EACN;;EAEF;QACE;;SAEK,KAAK;;;;;;;;;EASZ;KACC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The lean reader (`reader: 'lean'`, P1.5 = K1.8; docs/dev/design/K1-core.md §8): a compact root ->\n * upper -> lower -> leaf descent with literal NanoVDB offsets, a one-leaf cache and no vendored code,\n * for kernels near a compiler's size cap (pmndrs/pathtracer's media kernels sit at 46.9-50.1 KB against\n * a ~50 KB DXC class). Same public API as the vendored reader (`VdbAccessor`, `vdbAccessorInit`,\n * `vdbReadValue`, `vdbIsActive`, `vdbSample`), same values: a voxel reads what `vdbReadValue` reads\n * (CPU twin `vdbReadValueF32Cpu`), and the sampler is the `outside: 'zero'` lerp order of the vendored\n * module's API layer.\n *\n * Derived from PNanoVDB.h (OpenVDB, Apache-2.0; see NOTICE): the node layout (offsets from\n * vendor/stride-tables.json, which every NanoVDB scalar grid type shares above the leaf), the root key\n * (`pnanovdb_coord_to_key`), the child/value table lookups and the leaf decoders (Float f32, Half binary16,\n * Fp4/Fp8/Fp16 fixed-width codes, FpN codes of the leaf's own width; `code * quantum + minimum`). What it\n * leaves out of the vendored accessor: the upper cache level and the per-level typed getters; the lower node is\n * cached only with `cache: 'lower'` / `'lowerLeaf'` (P1.16), where a read in the cached lower node is one child\n * lookup instead of a walk from the root.\n *\n * Every name is `vdb_ln_*` (internal) or the shared public API; none maps to a vendored declaration, so\n * the generator's closure pulls in nothing from the vendored file for these functions.\n */\nimport type { VDBGridTypeName } from \"../types.js\";\nimport type { ApiOptions } from \"./api.js\";\n\n/** NanoVDB byte offsets the lean reader bakes in (ABI 32; equal for Float, Half and every Fp type above the leaf). */\nexport const LEAN_OFFSETS = {\n /** `GridData` size, where the tree starts. */\n gridSize: 672,\n /** Tree: byte offset of the root, relative to the tree (low word of the i64). */\n treeRootOffset: 24,\n rootTableSize: 24,\n rootBackground: 28,\n /** First root tile, relative to the root (`root_size`). */\n rootTiles: 64,\n rootTileSize: 32,\n rootTileChild: 8,\n rootTileState: 16,\n rootTileValue: 20,\n upperValueMask: 32,\n upperChildMask: 4128,\n upperTable: 8256,\n lowerValueMask: 32,\n lowerChildMask: 544,\n lowerTable: 1088,\n /** Child/value table entry size (`table_stride`). */\n tableStride: 8,\n leafFlags: 12,\n leafValueMask: 16,\n leafMinimum: 80,\n leafQuantum: 84,\n leafTable: 96,\n} as const;\n\nconst L = LEAN_OFFSETS;\n\n/** Grid type constant names after the rename (the vendored `PNANOVDB_GRID_TYPE_*` consts). */\nconst TYPE_CONST: Readonly<Record<VDBGridTypeName, string>> = {\n float: \"VDB_GRID_TYPE_FLOAT\",\n fp4: \"VDB_GRID_TYPE_FP4\",\n fp8: \"VDB_GRID_TYPE_FP8\",\n fp16: \"VDB_GRID_TYPE_FP16\",\n fpn: \"VDB_GRID_TYPE_FPN\",\n half: \"VDB_GRID_TYPE_HALF\",\n};\n\n/** log2 of the code width of a fixed-width Fp type. */\nconst FP_LOG_BITS: Partial<Record<VDBGridTypeName, string>> = { fp4: \"2u\", fp8: \"3u\", fp16: \"4u\" };\n\n/** The leaf decode of one type, as statements ending in a `return` (inputs `b`, `l`, `n`). */\nfunction leafDecode(t: VDBGridTypeName): string {\n if (t === \"float\") return `return bitcast<f32>(vdb_ln_w(b, l + ${L.leafTable}u + 4u * n));`;\n if (t === \"half\") return `return unpack2x16float(vdb_ln_w(b, l + ${L.leafTable}u + 2u * n) >> ((n & 1u) << 4u)).x;`;\n const lb = FP_LOG_BITS[t] ?? `(vdb_ln_w(b, l + ${L.leafFlags}u) >> 29u)`;\n return `let lb = ${lb};\n let pw = 5u - lb;\n let c = (vdb_ln_w(b, l + ${L.leafTable}u + ((n >> pw) << 2u)) >> ((n & ((1u << pw) - 1u)) << lb)) & ((1u << (1u << lb)) - 1u);\n return f32(c) * bitcast<f32>(vdb_ln_w(b, l + ${L.leafQuantum}u)) + bitcast<f32>(vdb_ln_w(b, l + ${L.leafMinimum}u));`;\n}\n\n/** Statements dispatching on `t` over the compiled types; the last type is the fallthrough (`ok` rejected the rest). */\nfunction dispatch(types: readonly VDBGridTypeName[], body: (t: VDBGridTypeName) => string, groupKey: (t: VDBGridTypeName) => string): string {\n const groups: { key: string; types: VDBGridTypeName[] }[] = [];\n for (const t of types) {\n const k = groupKey(t);\n const g = groups.find((x) => x.key === k);\n if (g) g.types.push(t);\n else groups.push({ key: k, types: [t] });\n }\n const lines: string[] = [];\n groups.forEach((g, i) => {\n const text = body(g.types[0]!);\n if (i === groups.length - 1) {\n lines.push(` ${text}`);\n } else {\n lines.push(` if ${g.types.map((x) => `t == ${TYPE_CONST[x]}`).join(\" || \")} {`);\n lines.push(` ${text.replace(/\\n {4}/g, \"\\n \")}`);\n lines.push(\" }\");\n }\n });\n return lines.join(\"\\n\");\n}\n\n/** The root-to-lower part of the descent, shared by every cache mode's text. */\nconst ROOT_KEY = ` let u = bitcast<vec3u>(ijk);\n let kl = (u.z >> 12u) | ((u.y >> 12u) << 21u);\n let kh = (u.y >> 23u) | ((u.x >> 12u) << 10u);\n let n = vdb_ln_w(b, r + ${L.rootTableSize}u);\n for (var i = 0u; i < n; i++) {\n let t = r + ${L.rootTiles}u + i * ${L.rootTileSize}u;\n if vdb_ln_w(b, t) == kl && vdb_ln_w(b, t + 4u) == kh {\n let c = vdb_ln_w(b, t + ${L.rootTileChild}u);\n if c == 0u && vdb_ln_w(b, t + ${L.rootTileChild + 4}u) == 0u {\n return vec4u(t + ${L.rootTileValue}u, 3u, t + ${L.rootTileState}u, 0u);\n }\n let p = r + c;\n let un = (((u.x & 4095u) >> 7u) << 10u) | (((u.y & 4095u) >> 7u) << 5u) | ((u.z & 4095u) >> 7u);\n let e = p + ${L.upperTable}u + ${L.tableStride}u * un;\n if vdb_ln_bit(b, p + ${L.upperChildMask}u, un) == 0u {\n return vec4u(e, 2u, p + ${L.upperValueMask}u, un);\n }`;\nconst LOWER_DOWN = (q: string, pad: string): string => `${pad}let ln = (((u.x & 127u) >> 3u) << 8u) | (((u.y & 127u) >> 3u) << 4u) | ((u.z & 127u) >> 3u);\n${pad}let f = ${q} + ${L.lowerTable}u + ${L.tableStride}u * ln;\n${pad}if vdb_ln_bit(b, ${q} + ${L.lowerChildMask}u, ln) == 0u {\n${pad} return vec4u(f, 1u, ${q} + ${L.lowerValueMask}u, ln);\n${pad}}\n${pad}let l = ${q} + vdb_ln_w(b, f);\n${pad}return vec4u(l, 0u, l + ${L.leafValueMask}u, ((u.x & 7u) << 6u) | ((u.y & 7u) << 3u) | (u.z & 7u));`;\nconst ROOT_END = ` }\n }\n return vec4u(r + ${L.rootBackground}u, 4u, 0u, 0u);\n}`;\n\n/**\n * The descent. Every function returns (address, level, mask word address, bit) with level 0 leaf / 1 lower tile /\n * 2 upper tile / 3 root tile / 4 background.\n * - `cache: 'leaf'`: `vdb_ln_find`, root to leaf in one function (the P1.5 text, byte for byte).\n * - `'lower'` / `'lowerLeaf'` (P1.16): `vdb_ln_lower`, root to the lower node (level 1 here means \"the lower node\n * at this address\"), and `vdb_ln_down`, the lower node's child lookup; `vdb_ln_find` (for `vdbIsActive`) chains them.\n */\nfunction findFunctions(o: ApiOptions): string[] {\n if (o.cache === \"leaf\") {\n return [\n `fn vdb_ln_find(b: u32, r: u32, ijk: vec3i) -> vec4u {\n${ROOT_KEY}\n let q = p + vdb_ln_w(b, e);\n${LOWER_DOWN(\"q\", \" \")}\n${ROOT_END}`,\n ];\n }\n const out = [\n `fn vdb_ln_lower(b: u32, r: u32, ijk: vec3i) -> vec4u {\n${ROOT_KEY}\n return vec4u(p + vdb_ln_w(b, e), 1u, 0u, 0u);\n${ROOT_END}`,\n `fn vdb_ln_down(b: u32, q: u32, ijk: vec3i) -> vec4u {\n let u = bitcast<vec3u>(ijk);\n${LOWER_DOWN(\"q\", \" \")}\n}`,\n ];\n if (o.isActive) {\n out.push(`fn vdb_ln_find(b: u32, r: u32, ijk: vec3i) -> vec4u {\n let f = vdb_ln_lower(b, r, ijk);\n if f.y != 1u {\n return f;\n }\n return vdb_ln_down(b, f.x, ijk);\n}`);\n }\n return out;\n}\n\n/** `vdbReadValue` per cache mode: the same value, a different number of pool words (docs: \"Reads per lookup\"). */\nfunction readValueFunction(o: ApiOptions): string {\n if (o.cache === \"leaf\") {\n return `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n let n = bitcast<u32>(((ijk.x & 7) << 6u) | ((ijk.y & 7) << 3u) | (ijk.z & 7));\n if (*acc).la == 0u || any((ijk & vec3i(-8)) != (*acc).lk) {\n let f = vdb_ln_find((*acc).b, (*acc).r, ijk);\n if f.y != 0u {\n return vdb_ln_tile((*acc).gridType, (*acc).b, f.x);\n }\n (*acc).la = f.x;\n (*acc).lk = ijk & vec3i(-8);\n }\n return vdb_ln_leaf((*acc).gridType, (*acc).b, (*acc).la, n);\n}`;\n }\n // The lower node of ijk: the cached one, else a walk from the root (a tile or the background returns its value).\n const lower = (key: string, addr: string, pad: string): string => `${pad}if (*acc).${addr} == 0u || any((ijk & vec3i(-128)) != (*acc).${key}) {\n${pad} let f = vdb_ln_lower((*acc).b, (*acc).r, ijk);\n${pad} if f.y != 1u {\n${pad} return vdb_ln_tile((*acc).gridType, (*acc).b, f.x);\n${pad} }\n${pad} (*acc).${addr} = f.x;\n${pad} (*acc).${key} = ijk & vec3i(-128);\n${pad}}\n${pad}let d = vdb_ln_down((*acc).b, (*acc).${addr}, ijk);\n${pad}if d.y != 0u {\n${pad} return vdb_ln_tile((*acc).gridType, (*acc).b, d.x);\n${pad}}`;\n if (o.cache === \"lower\") {\n return `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n${lower(\"lk\", \"la\", \" \")}\n return vdb_ln_leaf((*acc).gridType, (*acc).b, d.x, d.w);\n}`;\n }\n return `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {\n if !(*acc).ok {\n return 0.0;\n }\n let n = bitcast<u32>(((ijk.x & 7) << 6u) | ((ijk.y & 7) << 3u) | (ijk.z & 7));\n if (*acc).la == 0u || any((ijk & vec3i(-8)) != (*acc).lk) {\n${lower(\"qk\", \"qa\", \" \")}\n (*acc).la = d.x;\n (*acc).lk = ijk & vec3i(-8);\n }\n return vdb_ln_leaf((*acc).gridType, (*acc).b, (*acc).la, n);\n}`;\n}\n\n/**\n * The lean reader's opt-in helpers (P1.16), emitted after the layers.\n *\n * `vdbAccessorInitUnchecked(g)`: `vdbAccessorInit` without `vdb_live` and `vdb_type_ok`, with the bbox read straight\n * from the record. The host guarantees a live grid of a compiled type; a single-type module does not read the type.\n *\n * `vdbSampleFast` (`'fastTrilinear'`, cache `'lower'` / `'lowerLeaf'` only): `vdbSample` under the vendored\n * helper's name. With those caches every tap is already one lower-node child lookup.\n */\nexport function leanHelperFunctions(o: ApiOptions, bbox: boolean): string[] {\n const out: string[] = [];\n if (o.helpers.includes(\"fastTrilinear\")) {\n out.push(`fn vdbSampleFast(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n return vdbSample(acc, xyz);\n}`);\n }\n if (o.helpers.includes(\"accessorUnchecked\")) {\n const rec3 = (w: string) => `bitcast<vec3i>(vec3u(vdb_rec(g, ${w}), vdb_rec(g, ${w} + 1u), vdb_rec(g, ${w} + 2u)))`;\n const type = o.types.length === 1 ? TYPE_CONST[o.types[0]!] : \"vdb_rec(g, VDB_REC_GRID_TYPE)\";\n out.push(`fn vdbAccessorInitUnchecked(g: u32) -> VdbAccessor {\n var a: VdbAccessor;\n a.gridType = ${type};\n a.ok = true;\n a.b = vdb_rec(g, VDB_REC_IMAGE_OFFSET) >> 2u;\n a.r = ${L.gridSize}u + vdb_ln_w(a.b, ${L.gridSize + L.treeRootOffset}u);${\n bbox ? `\\n a.lo = ${rec3(\"VDB_REC_INDEX_BBOX_MIN\")};\\n a.hi = ${rec3(\"VDB_REC_INDEX_BBOX_MAX\")};` : \"\"\n }\n return a;\n}`);\n }\n return out;\n}\n\n/**\n * The lean accessor parts of the read layer: the struct, `vdbAccessorInit`, the descent, the leaf and\n * tile decoders, `vdbReadValue` and (with `isActive`) `vdbIsActive`. `common` are the record functions\n * every reader shares (`vdb_rec`, `vdbGridCount`, `vdb_live`, ...).\n */\nexport function leanReadLayer(o: ApiOptions, bbox: boolean, common: readonly string[]): string {\n const extra = bbox ? \"\\n lo: vec3i,\\n hi: vec3i,\" : \"\";\n const extraInit = bbox ? \"\\n a.lo = vdbIndexMin(g);\\n a.hi = vdbIndexMax(g);\" : \"\";\n const half = o.types.includes(\"half\");\n // A tile or background slot: f32, or binary16 at a 2-byte-aligned address for Half.\n const slot = (t: VDBGridTypeName) =>\n t === \"half\" ? \"return unpack2x16float(vdb_ln_w(b, a) >> ((a & 2u) << 3u)).x;\" : \"return bitcast<f32>(vdb_ln_w(b, a));\";\n const both = o.cache === \"lowerLeaf\";\n const parts = [\n `struct VdbAccessor {\n b: u32,\n r: u32,\n gridType: u32,\n ok: bool,\n lk: vec3i,\n la: u32,${both ? \"\\n qk: vec3i,\\n qa: u32,\" : \"\"}${extra}\n}`,\n ...common,\n `fn vdb_ln_w(b: u32, a: u32) -> u32 {\n return vdb_load(b + (a >> 2u));\n}`,\n `fn vdb_ln_bit(b: u32, m: u32, n: u32) -> u32 {\n return (vdb_ln_w(b, m + 4u * (n >> 5u)) >> (n & 31u)) & 1u;\n}`,\n `fn vdbAccessorInit(g: u32) -> VdbAccessor {\n var a: VdbAccessor;\n a.gridType = vdbGridType(g);\n a.ok = vdb_type_ok(a.gridType);\n if a.ok {\n a.b = vdb_rec(g, VDB_REC_IMAGE_OFFSET) >> 2u;\n a.r = ${L.gridSize}u + vdb_ln_w(a.b, ${L.gridSize + L.treeRootOffset}u);${extraInit}\n }\n return a;\n}`,\n ...findFunctions(o),\n `fn vdb_ln_leaf(t: u32, b: u32, l: u32, n: u32) -> f32 {\n${dispatch(o.types, leafDecode, (t) => (FP_LOG_BITS[t] !== undefined || t === \"fpn\" ? `fp:${t}` : t))}\n}`,\n `fn vdb_ln_tile(t: u32, b: u32, a: u32) -> f32 {\n${half ? dispatch(o.types, slot, (t) => (t === \"half\" ? \"half\" : \"f32\")) : ` ${slot(\"float\")}`}\n}`,\n readValueFunction(o),\n ];\n if (o.isActive) {\n parts.push(`fn vdbIsActive(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> bool {\n if !(*acc).ok {\n return false;\n }\n let f = vdb_ln_find((*acc).b, (*acc).r, ijk);\n return f.y < 4u && vdb_ln_bit((*acc).b, f.z, f.w) != 0u;\n}`);\n }\n return parts.join(\"\\n\");\n}\n\n/**\n * The lean `vdbSample`: taps through `vdbReadValue` (so through the one-leaf cache), the zero-mode lerp\n * order of the vendored API layer; with `outside: 'zero'` a tap outside `[lo, hi]` reads 0.\n */\nexport function leanSampleFunctions(o: ApiOptions, bbox: boolean): string[] {\n const guard = bbox ? \"!(*acc).ok || any(b < (*acc).lo - vec3i(1)) || any(b > (*acc).hi)\" : \"!(*acc).ok\";\n if (o.sampler === \"nearest\") {\n return [\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let ijk = vec3i(floor(xyz + vec3f(0.5)));\n if !(*acc).ok${bbox ? \" || any(ijk < (*acc).lo) || any(ijk > (*acc).hi)\" : \"\"} {\n return 0.0;\n }\n return vdbReadValue(acc, ijk);\n}`,\n ];\n }\n return [\n `fn vdb_ln_tap(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {${\n bbox\n ? `\n if any(ijk < (*acc).lo) || any(ijk > (*acc).hi) {\n return 0.0;\n }`\n : \"\"\n }\n return vdbReadValue(acc, ijk);\n}`,\n `fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {\n let b = vec3i(floor(xyz));\n if ${guard} {\n return 0.0;\n }\n let u = xyz - vec3f(b);\n let x00 = mix(vdb_ln_tap(acc, b), vdb_ln_tap(acc, b + vec3i(1, 0, 0)), u.x);\n let x10 = mix(vdb_ln_tap(acc, b + vec3i(0, 1, 0)), vdb_ln_tap(acc, b + vec3i(1, 1, 0)), u.x);\n let x01 = mix(vdb_ln_tap(acc, b + vec3i(0, 0, 1)), vdb_ln_tap(acc, b + vec3i(1, 0, 1)), u.x);\n let x11 = mix(vdb_ln_tap(acc, b + vec3i(0, 1, 1)), vdb_ln_tap(acc, b + vec3i(1, 1, 1)), u.x);\n return mix(mix(x00, x10, u.y), mix(x01, x11, u.y), u.z);\n}`,\n ];\n}\n"]}
@@ -30,7 +30,11 @@
30
30
  * the step is `max(0.95 * v * sdfToIndex, 0.25)` voxels. `maxSamples` caps
31
31
  * the samples (a ray that runs out misses).
32
32
  * - `vdbLevelSetGradient(acc, xyz, h) -> vec3f`: central differences of
33
- * `vdbSample` at +/- `h` voxels, in SDF units per index voxel.
33
+ * `vdbSample` at +/- `h` voxels, in SDF units per index voxel. `h <= 0`
34
+ * (G13c-a): the exact gradient of the trilinear cell holding `xyz` (the
35
+ * surface the trace hits): per axis the difference of `vdbSample` on the
36
+ * cell's two faces through `xyz` (trilinear is linear along each axis), the
37
+ * `h -> 0` limit inside the cell; discontinuous across cell faces.
34
38
  * - `vdbLevelSetNormal(g, xyz, h) -> vec3f`: the outward unit normal in world
35
39
  * space, `normalize(W^T * gradient)` with `W` the record's world-to-index
36
40
  * linear part (correct under rotation and non-uniform scale).
@@ -30,7 +30,11 @@
30
30
  * the step is `max(0.95 * v * sdfToIndex, 0.25)` voxels. `maxSamples` caps
31
31
  * the samples (a ray that runs out misses).
32
32
  * - `vdbLevelSetGradient(acc, xyz, h) -> vec3f`: central differences of
33
- * `vdbSample` at +/- `h` voxels, in SDF units per index voxel.
33
+ * `vdbSample` at +/- `h` voxels, in SDF units per index voxel. `h <= 0`
34
+ * (G13c-a): the exact gradient of the trilinear cell holding `xyz` (the
35
+ * surface the trace hits): per axis the difference of `vdbSample` on the
36
+ * cell's two faces through `xyz` (trilinear is linear along each axis), the
37
+ * `h -> 0` limit inside the cell; discontinuous across cell faces.
34
38
  * - `vdbLevelSetNormal(g, xyz, h) -> vec3f`: the outward unit normal in world
35
39
  * space, `normalize(W^T * gradient)` with `W` the record's world-to-index
36
40
  * linear part (correct under rotation and non-uniform scale).
@@ -169,15 +173,17 @@ export function levelSetWgsl() {
169
173
  return true;
170
174
  }`,
171
175
  `fn vdbLevelSetGradient(acc: ptr<function, VdbAccessor>, xyz: vec3f, h: f32) -> vec3f {
176
+ let cell = !(h > 0.0);
177
+ let lo = floor(xyz);
172
178
  var gr = vec3f(0.0);
173
179
  for (var i = 0u; i < 6u; i++) {
174
180
  let axis = i >> 1u;
175
181
  let sgn = select(-1.0, 1.0, (i & 1u) == 0u);
176
- var e = vec3f(0.0);
177
- e[axis] = sgn * h;
178
- gr[axis] += sgn * vdbSample(acc, xyz + e);
182
+ var p = xyz;
183
+ p[axis] = select(xyz[axis] + sgn * h, lo[axis] + select(0.0, 1.0, sgn > 0.0), cell);
184
+ gr[axis] += sgn * vdbSample(acc, p);
179
185
  }
180
- return gr / (2.0 * h);
186
+ return gr / select(2.0 * h, 1.0, cell);
181
187
  }`,
182
188
  `fn vdbLevelSetNormal(g: u32, xyz: vec3f, h: f32) -> vec3f {
183
189
  var acc = vdbAccessorInit(g);
@@ -1 +1 @@
1
- {"version":3,"file":"level-set.js","sourceRoot":"","sources":["../../../src/core/wgsl/level-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL;;;;;;;;;;;EAWF;QACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGF;QACE;;;;;;;;;;EAUF;QACE;;;;;;;;;EASF;KACC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The opt-in `'levelSet'` helper (K3.7, R1 §6 Step 7): a zero-crossing finder\n * for NanoVDB level sets on the sparse tree, and its gradient normal. Written\n * in the generated module's final names (public `vdb*` API plus the vendored\n * HDDA fields it reads), emitted only when `helpers` lists it.\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345\n * (`src/three-openvdb/levelset/webgpu/LevelSetSurfaceMaterial.js`: the sphere\n * trace with a minimum step, the secant step between the last outside and the\n * first inside sample, central-difference normals). Copyright (c)\n * mjurczyk/openvdb contributors, MIT (see THIRD_PARTY_NOTICES.md). Changes: traced on\n * the sparse NanoVDB tree (trilinear `vdbSample`, full resolution) instead of\n * his dense 8-bit distance texture; an HDDA walk skips cells whose trilinear\n * support is all tiles or background above zero; bisection before the secant\n * step; normals through the grid's affine. See DIVERGES.md.\n *\n * CPU twins: `tools` `levelSetHit`, `levelSetGradient`, `levelSetNormal`\n * (`tools/cpu/level-set.ts`), same walk, same sample positions.\n */\n\n/**\n * The WGSL text of the `'levelSet'` helper (`march` profile).\n *\n * - `vdbLevelSetHit(g, o, d, t, sdfToIndex, maxSamples) -> bool`: the first\n * `t` in `(*t).x .. (*t).y` (clipped to the trilinear support box\n * `[min - 1, max + 1]`) where the trilinear SDF `vdbSample` goes below 0,\n * along `o + d * t` in grid `g`'s index space (`d` need not be unit length).\n * On a hit `(*t).x` is the crossing; a ray whose first sample is already\n * inside hits at that sample. `sdfToIndex` converts SDF values to index\n * voxels (1 / the grid's voxel size for a level set in its own world units);\n * the step is `max(0.95 * v * sdfToIndex, 0.25)` voxels. `maxSamples` caps\n * the samples (a ray that runs out misses).\n * - `vdbLevelSetGradient(acc, xyz, h) -> vec3f`: central differences of\n * `vdbSample` at +/- `h` voxels, in SDF units per index voxel.\n * - `vdbLevelSetNormal(g, xyz, h) -> vec3f`: the outward unit normal in world\n * space, `normalize(W^T * gradient)` with `W` the record's world-to-index\n * linear part (correct under rotation and non-uniform scale).\n *\n * The walk: an HDDA over aligned cells of at least 8 voxels, the cell size\n * following `vdbGetDim` at the cell corner (8 inside leaves and lower tiles,\n * larger in upper and root tiles). A cell is skipped when the 2x2x2 block of\n * same-size cells from its corner (every tap a trilinear sample in the cell can\n * read) is all uniform (`vdbGetDim >= dim`) with values above 0: no sample in\n * it can be inside. A larger cell that fails the test is walked again at 8.\n * Other cells are sphere traced; a sample below 0 brackets the crossing with\n * the previous sample, which 8 bisections and a secant step refine.\n *\n * Every `vdbSample` call site inlines the type-dispatched trilinear reader,\n * so the gradient's six taps run in a loop (one site): with six sites a\n * module took 98-168 s to compile on SwiftShader, with one 10-19 s. The hit\n * keeps three sites (march, closing sample, bisection): folding them into one\n * moded loop compiled faster again (6-11 s) but ran 2x slower on Metal\n * (teapot frame 15.7 vs 8.0 ms). The sample sequence is the twin's.\n */\nexport function levelSetWgsl(): string[] {\n return [\n `fn vdb_ls_skip(acc: ptr<function, VdbAccessor>, c: vec3i, dim: u32) -> bool {\n for (var k = 0u; k < 8u; k++) {\n let p = c + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, (k >> 2u) & 1u)) * i32(dim);\n if vdbGetDim(acc, p) < dim {\n return false;\n }\n if !(vdbReadValue(acc, p) > 0.0) {\n return false;\n }\n }\n return true;\n}`,\n `fn vdbLevelSetHit(g: u32, o: vec3f, d: vec3f, t: ptr<function, vec2f>, sdfToIndex: f32, maxSamples: u32) -> bool {\n if !vdb_live(g) {\n return false;\n }\n var t0 = (*t).x;\n var t1 = (*t).y;\n let clip = vdb_hdda_ray_clip(vec3f(vdbIndexMin(g)) - vec3f(1.0), vec3f(vdbIndexMax(g)) + vec3f(1.0), o, &t0, d, &t1);\n if !clip || !(t0 <= t1) {\n return false;\n }\n var acc = vdbAccessorInit(g);\n if !acc.ok {\n return false;\n }\n let inv = 1.0 / max(length(d), 1e-30);\n let minStep = 0.25 * inv;\n let k = 0.95 * sdfToIndex * inv;\n var h: VdbHdda;\n vdbHddaInit(&h, o, t0, d, t1, max(vdbGetDim(&acc, vec3i(floor(o + d * t0))), 8u));\n var tc = t0;\n var tp = t0;\n var vp = 0.0;\n var have = false;\n var n = 0u;\n var updates = 0u;\n var fineUntil = -3.0e38;\n var crossed = false;\n var vc = 0.0;\n for (var it = 0u; it < 8192u; it++) {\n var want = max(vdbGetDim(&acc, h.voxel), 8u);\n if h.tmin < fineUntil {\n want = 8u;\n }\n if want != u32(h.dim) && updates < 2u {\n vdbHddaUpdate(&h, o, d, want);\n updates++;\n continue;\n }\n updates = 0u;\n let te = min(min(h.next.x, h.next.y), min(h.next.z, h.tmax));\n if te >= tc {\n let dim = u32(h.dim);\n if vdb_ls_skip(&acc, h.voxel, dim) {\n tc = te;\n } else if dim > 8u && te > h.tmin {\n fineUntil = te;\n vdbHddaUpdate(&h, o, d, 8u);\n continue;\n } else {\n loop {\n if tc > te || n >= maxSamples {\n break;\n }\n vc = vdbSample(&acc, o + d * tc);\n n++;\n if vc < 0.0 {\n crossed = true;\n break;\n }\n tp = tc;\n vp = vc;\n have = true;\n tc += max(vc * k, minStep);\n }\n if crossed || n >= maxSamples {\n break;\n }\n }\n }\n if !vdbHddaStep(&h) {\n break;\n }\n }\n if !crossed && have && tp < t1 && n < maxSamples {\n tc = t1;\n vc = vdbSample(&acc, o + d * tc);\n crossed = vc < 0.0;\n }\n if !crossed {\n return false;\n }\n if !have {\n (*t).x = tc;\n return true;\n }\n var lo = tp;\n var hi = tc;\n var vlo = vp;\n var vhi = vc;\n for (var i = 0u; i < 8u; i++) {\n let m = 0.5 * (lo + hi);\n let vm = vdbSample(&acc, o + d * m);\n if vm < 0.0 {\n hi = m;\n vhi = vm;\n } else {\n lo = m;\n vlo = vm;\n }\n }\n (*t).x = lo + (hi - lo) * (vlo / (vlo - vhi));\n return true;\n}`,\n `fn vdbLevelSetGradient(acc: ptr<function, VdbAccessor>, xyz: vec3f, h: f32) -> vec3f {\n var gr = vec3f(0.0);\n for (var i = 0u; i < 6u; i++) {\n let axis = i >> 1u;\n let sgn = select(-1.0, 1.0, (i & 1u) == 0u);\n var e = vec3f(0.0);\n e[axis] = sgn * h;\n gr[axis] += sgn * vdbSample(acc, xyz + e);\n }\n return gr / (2.0 * h);\n}`,\n `fn vdbLevelSetNormal(g: u32, xyz: vec3f, h: f32) -> vec3f {\n var acc = vdbAccessorInit(g);\n let gi = vdbLevelSetGradient(&acc, xyz, h);\n let n = vec3f(dot(vdbWorldToIndexDir(g, vec3f(1.0, 0.0, 0.0)), gi), dot(vdbWorldToIndexDir(g, vec3f(0.0, 1.0, 0.0)), gi), dot(vdbWorldToIndexDir(g, vec3f(0.0, 0.0, 1.0)), gi));\n let l = length(n);\n if !(l > 0.0) {\n return vec3f(0.0, 1.0, 0.0);\n }\n return n / l;\n}`,\n ];\n}\n"]}
1
+ {"version":3,"file":"level-set.js","sourceRoot":"","sources":["../../../src/core/wgsl/level-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL;;;;;;;;;;;EAWF;QACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGF;QACE;;;;;;;;;;;;EAYF;QACE;;;;;;;;;EASF;KACC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The opt-in `'levelSet'` helper (K3.7, R1 §6 Step 7): a zero-crossing finder\n * for NanoVDB level sets on the sparse tree, and its gradient normal. Written\n * in the generated module's final names (public `vdb*` API plus the vendored\n * HDDA fields it reads), emitted only when `helpers` lists it.\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345\n * (`src/three-openvdb/levelset/webgpu/LevelSetSurfaceMaterial.js`: the sphere\n * trace with a minimum step, the secant step between the last outside and the\n * first inside sample, central-difference normals). Copyright (c)\n * mjurczyk/openvdb contributors, MIT (see THIRD_PARTY_NOTICES.md). Changes: traced on\n * the sparse NanoVDB tree (trilinear `vdbSample`, full resolution) instead of\n * his dense 8-bit distance texture; an HDDA walk skips cells whose trilinear\n * support is all tiles or background above zero; bisection before the secant\n * step; normals through the grid's affine. See DIVERGES.md.\n *\n * CPU twins: `tools` `levelSetHit`, `levelSetGradient`, `levelSetNormal`\n * (`tools/cpu/level-set.ts`), same walk, same sample positions.\n */\n\n/**\n * The WGSL text of the `'levelSet'` helper (`march` profile).\n *\n * - `vdbLevelSetHit(g, o, d, t, sdfToIndex, maxSamples) -> bool`: the first\n * `t` in `(*t).x .. (*t).y` (clipped to the trilinear support box\n * `[min - 1, max + 1]`) where the trilinear SDF `vdbSample` goes below 0,\n * along `o + d * t` in grid `g`'s index space (`d` need not be unit length).\n * On a hit `(*t).x` is the crossing; a ray whose first sample is already\n * inside hits at that sample. `sdfToIndex` converts SDF values to index\n * voxels (1 / the grid's voxel size for a level set in its own world units);\n * the step is `max(0.95 * v * sdfToIndex, 0.25)` voxels. `maxSamples` caps\n * the samples (a ray that runs out misses).\n * - `vdbLevelSetGradient(acc, xyz, h) -> vec3f`: central differences of\n * `vdbSample` at +/- `h` voxels, in SDF units per index voxel. `h <= 0`\n * (G13c-a): the exact gradient of the trilinear cell holding `xyz` (the\n * surface the trace hits): per axis the difference of `vdbSample` on the\n * cell's two faces through `xyz` (trilinear is linear along each axis), the\n * `h -> 0` limit inside the cell; discontinuous across cell faces.\n * - `vdbLevelSetNormal(g, xyz, h) -> vec3f`: the outward unit normal in world\n * space, `normalize(W^T * gradient)` with `W` the record's world-to-index\n * linear part (correct under rotation and non-uniform scale).\n *\n * The walk: an HDDA over aligned cells of at least 8 voxels, the cell size\n * following `vdbGetDim` at the cell corner (8 inside leaves and lower tiles,\n * larger in upper and root tiles). A cell is skipped when the 2x2x2 block of\n * same-size cells from its corner (every tap a trilinear sample in the cell can\n * read) is all uniform (`vdbGetDim >= dim`) with values above 0: no sample in\n * it can be inside. A larger cell that fails the test is walked again at 8.\n * Other cells are sphere traced; a sample below 0 brackets the crossing with\n * the previous sample, which 8 bisections and a secant step refine.\n *\n * Every `vdbSample` call site inlines the type-dispatched trilinear reader,\n * so the gradient's six taps run in a loop (one site): with six sites a\n * module took 98-168 s to compile on SwiftShader, with one 10-19 s. The hit\n * keeps three sites (march, closing sample, bisection): folding them into one\n * moded loop compiled faster again (6-11 s) but ran 2x slower on Metal\n * (teapot frame 15.7 vs 8.0 ms). The sample sequence is the twin's.\n */\nexport function levelSetWgsl(): string[] {\n return [\n `fn vdb_ls_skip(acc: ptr<function, VdbAccessor>, c: vec3i, dim: u32) -> bool {\n for (var k = 0u; k < 8u; k++) {\n let p = c + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, (k >> 2u) & 1u)) * i32(dim);\n if vdbGetDim(acc, p) < dim {\n return false;\n }\n if !(vdbReadValue(acc, p) > 0.0) {\n return false;\n }\n }\n return true;\n}`,\n `fn vdbLevelSetHit(g: u32, o: vec3f, d: vec3f, t: ptr<function, vec2f>, sdfToIndex: f32, maxSamples: u32) -> bool {\n if !vdb_live(g) {\n return false;\n }\n var t0 = (*t).x;\n var t1 = (*t).y;\n let clip = vdb_hdda_ray_clip(vec3f(vdbIndexMin(g)) - vec3f(1.0), vec3f(vdbIndexMax(g)) + vec3f(1.0), o, &t0, d, &t1);\n if !clip || !(t0 <= t1) {\n return false;\n }\n var acc = vdbAccessorInit(g);\n if !acc.ok {\n return false;\n }\n let inv = 1.0 / max(length(d), 1e-30);\n let minStep = 0.25 * inv;\n let k = 0.95 * sdfToIndex * inv;\n var h: VdbHdda;\n vdbHddaInit(&h, o, t0, d, t1, max(vdbGetDim(&acc, vec3i(floor(o + d * t0))), 8u));\n var tc = t0;\n var tp = t0;\n var vp = 0.0;\n var have = false;\n var n = 0u;\n var updates = 0u;\n var fineUntil = -3.0e38;\n var crossed = false;\n var vc = 0.0;\n for (var it = 0u; it < 8192u; it++) {\n var want = max(vdbGetDim(&acc, h.voxel), 8u);\n if h.tmin < fineUntil {\n want = 8u;\n }\n if want != u32(h.dim) && updates < 2u {\n vdbHddaUpdate(&h, o, d, want);\n updates++;\n continue;\n }\n updates = 0u;\n let te = min(min(h.next.x, h.next.y), min(h.next.z, h.tmax));\n if te >= tc {\n let dim = u32(h.dim);\n if vdb_ls_skip(&acc, h.voxel, dim) {\n tc = te;\n } else if dim > 8u && te > h.tmin {\n fineUntil = te;\n vdbHddaUpdate(&h, o, d, 8u);\n continue;\n } else {\n loop {\n if tc > te || n >= maxSamples {\n break;\n }\n vc = vdbSample(&acc, o + d * tc);\n n++;\n if vc < 0.0 {\n crossed = true;\n break;\n }\n tp = tc;\n vp = vc;\n have = true;\n tc += max(vc * k, minStep);\n }\n if crossed || n >= maxSamples {\n break;\n }\n }\n }\n if !vdbHddaStep(&h) {\n break;\n }\n }\n if !crossed && have && tp < t1 && n < maxSamples {\n tc = t1;\n vc = vdbSample(&acc, o + d * tc);\n crossed = vc < 0.0;\n }\n if !crossed {\n return false;\n }\n if !have {\n (*t).x = tc;\n return true;\n }\n var lo = tp;\n var hi = tc;\n var vlo = vp;\n var vhi = vc;\n for (var i = 0u; i < 8u; i++) {\n let m = 0.5 * (lo + hi);\n let vm = vdbSample(&acc, o + d * m);\n if vm < 0.0 {\n hi = m;\n vhi = vm;\n } else {\n lo = m;\n vlo = vm;\n }\n }\n (*t).x = lo + (hi - lo) * (vlo / (vlo - vhi));\n return true;\n}`,\n `fn vdbLevelSetGradient(acc: ptr<function, VdbAccessor>, xyz: vec3f, h: f32) -> vec3f {\n let cell = !(h > 0.0);\n let lo = floor(xyz);\n var gr = vec3f(0.0);\n for (var i = 0u; i < 6u; i++) {\n let axis = i >> 1u;\n let sgn = select(-1.0, 1.0, (i & 1u) == 0u);\n var p = xyz;\n p[axis] = select(xyz[axis] + sgn * h, lo[axis] + select(0.0, 1.0, sgn > 0.0), cell);\n gr[axis] += sgn * vdbSample(acc, p);\n }\n return gr / select(2.0 * h, 1.0, cell);\n}`,\n `fn vdbLevelSetNormal(g: u32, xyz: vec3f, h: f32) -> vec3f {\n var acc = vdbAccessorInit(g);\n let gi = vdbLevelSetGradient(&acc, xyz, h);\n let n = vec3f(dot(vdbWorldToIndexDir(g, vec3f(1.0, 0.0, 0.0)), gi), dot(vdbWorldToIndexDir(g, vec3f(0.0, 1.0, 0.0)), gi), dot(vdbWorldToIndexDir(g, vec3f(0.0, 0.0, 1.0)), gi));\n let l = length(n);\n if !(l > 0.0) {\n return vec3f(0.0, 1.0, 0.0);\n }\n return n / l;\n}`,\n ];\n}\n"]}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The `majorant` profile's API layer (P1.3, P1.4; docs/dev/design/K1-core.md §3.2, §5): a piecewise-constant
3
+ * bound of the sampled field along an index-space ray, for delta and ratio tracking.
4
+ *
5
+ * ```wgsl
6
+ * var it = vdbMajorantInit(g, oIdx, dIdx, tMin, tMax); // index-space ray, d unnormalized, t the caller's
7
+ * loop { let s = vdbMajorantNext(&it); if s.y <= s.x { break; } } // s.z bounds every sample on [s.x, s.y)
8
+ * ```
9
+ *
10
+ * Segments are contiguous, never of zero length, and cover the walk's box: the brick grid's cells
11
+ * (`'brick'`), else the sampler's support box (`[min - 1, max + 1]` trilinear, `[min - 0.5, max + 0.5]`
12
+ * nearest). Outside it the field is 0 with `outside: 'zero'` (with `'background'` it is the tree's
13
+ * background, which the walk does not cover: use a fog grid with background 0).
14
+ *
15
+ * - `'brick'`: the pathtracer's DDA (`ptDdaInit` / `ptDdaNext`) over the brick cells in cell space
16
+ * `(p - origin) / B`; a grid without a brick range (or a 0.1 pool's range, which has no "VDBM" header)
17
+ * walks as `'global'`.
18
+ * - `'global'`: one segment with the record's `valueMax` (`vdbMajorantGlobal(g)`, the scalar a VSPG or
19
+ * emission estimator needs).
20
+ * - `'nodeMax'` (needs the march layer): the vendored HDDA at leaf size 8 widening over tiles; a cell's
21
+ * bound is the max of `vdbNodeMax` over the 2x2x2 block of cells from its corner (the 8-leaf support of
22
+ * a trilinear sample). Stats bound ACTIVE values: inactive leaf voxels must be <= their leaf's max (fog).
23
+ *
24
+ * With `outside: 'zero'` a bound below 0 becomes 0 (a tap outside the bbox reads 0). With `minima`,
25
+ * `vdbMajorantMinimum(&it)` is the lower bound of the segment the last `vdbMajorantNext` returned: the
26
+ * brick minimum when the range carries minima, else 0 (a minorant of a non-negative field).
27
+ *
28
+ * CPU twin: `tools` `vdbMajorantWalk`. Axis-parallel rays: a direction component below 1e-20 in
29
+ * magnitude never divides (WGSL may assume no infinities; CLAUDE.md Traps).
30
+ *
31
+ * Opt-in helpers (EX1f-b, {@link majorantHelpersWgsl}): `vdbMajorantInitWorld`, `vdbMajorantInitGlobal`,
32
+ * `vdbDeltaTrack`, `vdbRatioTrack`. With a tracker the iterator also keeps the ray (`o`, `d`), so a
33
+ * tracker takes only the iterator and an accessor.
34
+ */
35
+ import type { ApiOptions } from "./api.js";
36
+ /** The `majorant` module option: which walk the profile compiles. */
37
+ export type VDBMajorantMode = "brick" | "global" | "nodeMax";
38
+ /** The majorant layer for the normalized options (`o.majorant`, `o.minima`, `o.sampler`, `o.outside`). */
39
+ export declare function majorantWgsl(o: ApiOptions): string;
40
+ /**
41
+ * The `majorant` profile's opt-in helpers (EX1f-b), emitted after the layer in this order. None is emitted unless
42
+ * listed, so a module without them keeps its bytes.
43
+ *
44
+ * - `'majorantWorld'`: `vdbMajorantInitWorld(g, o, d, tMin, tMax)`, `vdbMajorantInit` for a world-space ray (the
45
+ * record's world-to-index affine; `d` is not renormalized, so `t` stays the caller's world parameter).
46
+ * - `'majorantGlobal'` (`'brick'` and `'global'`): `vdbMajorantInitGlobal(g, o, d, tMin, tMax)`, the one-segment walk
47
+ * on the grid's global bound whatever brick bounds it has: bricks or the global bound picked per ray at run time
48
+ * in one module.
49
+ * - `'deltaTrack'`: `vdbDeltaTrack(it, acc, sigma, maxLookups) -> VdbCollision`, delta (Woodcock) tracking over the
50
+ * rest of the walk: the next real collision of the medium with extinction `sigma * vdbSample`.
51
+ * - `'ratioTrack'`: `vdbRatioTrack(it, acc, sigma, cutoff, maxLookups) -> VdbTransmittance`, ratio tracking over the
52
+ * rest of the walk: an unbiased transmittance per channel for the extinctions `sigma.rgb * vdbSample`, with the
53
+ * majorant of the largest channel; below `cutoff` (its largest channel) the estimate plays Russian roulette: it
54
+ * survives with probability `w / cutoff` and is scaled so that its largest channel is exactly `cutoff` (assigned,
55
+ * not multiplied: a product one ulp under `cutoff` would play again at the next collision on some GPUs only).
56
+ *
57
+ * The trackers draw uniform numbers in [0, 1) from the host's function `o.random` (the module option `random`: the
58
+ * name of a `fn name() -> f32` the host declares in the same shader), in this order: per tentative collision one for
59
+ * the distance, then (delta) one for the accept test, or (ratio) one when the roulette plays. CPU twins: `tools`
60
+ * `vdbDeltaTrack` / `vdbRatioTrack` (same draws, f32 in this evaluation order).
61
+ */
62
+ export declare function majorantHelpersWgsl(o: ApiOptions): string[];
@@ -0,0 +1,381 @@
1
+ /** `vdb_maj_clip`: slab test with the axis-parallel guard. */
2
+ const CLIP = `fn vdb_maj_clip(lo: vec3f, hi: vec3f, o: vec3f, d: vec3f, t0: f32, t1: f32) -> vec2f {
3
+ var t = vec2f(t0, t1);
4
+ for (var k = 0; k < 3; k++) {
5
+ if abs(d[k]) < 1e-20 {
6
+ if o[k] < lo[k] || o[k] >= hi[k] {
7
+ return vec2f(t0, t0);
8
+ }
9
+ } else {
10
+ let p = (lo[k] - o[k]) / d[k];
11
+ let q = (hi[k] - o[k]) / d[k];
12
+ t = vec2f(max(t.x, min(p, q)), min(t.y, max(p, q)));
13
+ }
14
+ }
15
+ return t;
16
+ }`;
17
+ /** Whether a tracking helper is listed: the iterator then keeps the index-space ray. */
18
+ function tracks(o) {
19
+ return o.helpers.includes("deltaTrack") || o.helpers.includes("ratioTrack");
20
+ }
21
+ /** The record's global bound and the sampler's support clip, as WGSL expressions of `g`, `o`, `d`, `tMin`, `tMax`. */
22
+ function globalParts(o) {
23
+ const pad = o.sampler === "nearest" ? "0.5" : "1.0";
24
+ return {
25
+ vmax: o.outside === "zero" ? "max(bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX)), 0.0)" : "bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX))",
26
+ support: `vdb_maj_clip(vec3f(vdbIndexMin(g)) - vec3f(${pad}), vec3f(vdbIndexMax(g)) + vec3f(${pad}), o, d, tMin, tMax)`,
27
+ };
28
+ }
29
+ /** The majorant layer for the normalized options (`o.majorant`, `o.minima`, `o.sampler`, `o.outside`). */
30
+ export function majorantWgsl(o) {
31
+ const zero = o.outside === "zero";
32
+ const { vmax, support } = globalParts(o);
33
+ // EX1f-b: with a tracker the brick / global iterator keeps the ray (the nodeMax one always has it).
34
+ const ray = tracks(o) ? "\n o: vec3f,\n d: vec3f," : "";
35
+ const setRay = tracks(o) ? "\n it.o = o;\n it.d = d;" : "";
36
+ const parts = [
37
+ CLIP,
38
+ `fn vdbMajorantGlobal(g: u32) -> f32 {
39
+ if !vdb_live(g) {
40
+ return 0.0;
41
+ }
42
+ return ${vmax};
43
+ }`,
44
+ ];
45
+ const lo = o.minima ? "\n lo: f32," : "";
46
+ if (o.majorant === "nodeMax") {
47
+ parts.push(`struct VdbMajorantIter {
48
+ t: f32,
49
+ te: f32,
50
+ o: vec3f,
51
+ d: vec3f,
52
+ h: VdbHdda,
53
+ acc: VdbAccessor,${lo}
54
+ }`, `fn vdb_maj_bound(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {
55
+ var m = vdbNodeMax(acc, ijk, dim);
56
+ for (var k = 1u; k < 8u; k++) {
57
+ m = max(m, vdbNodeMax(acc, ijk + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, k >> 2u)) * i32(dim), dim));
58
+ }
59
+ return ${zero ? "max(m, 0.0)" : "m"};
60
+ }`, `fn vdbMajorantInit(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {
61
+ var it: VdbMajorantIter;
62
+ it.t = tMin;
63
+ it.te = tMin;
64
+ if !vdb_live(g) {
65
+ return it;
66
+ }
67
+ let c = ${support};
68
+ if c.x < c.y {
69
+ it.t = c.x;
70
+ it.te = c.y;
71
+ it.o = o;
72
+ it.d = d;
73
+ var a = vdbAccessorInit(g);
74
+ var h: VdbHdda;
75
+ vdbHddaInit(&h, o, c.x, d, c.y, max(vdbGetDim(&a, vec3i(floor(o + d * c.x))), 8u));
76
+ it.h = h;
77
+ it.acc = a;
78
+ }
79
+ return it;
80
+ }`, `fn vdbMajorantNext(it: ptr<function, VdbMajorantIter>) -> vec3f {
81
+ var h = (*it).h;
82
+ var a = (*it).acc;
83
+ var s = vec3f((*it).t, (*it).t, 0.0);
84
+ for (var i = 0u; i < 16u; i++) {
85
+ let t0 = (*it).t;
86
+ if !(t0 < (*it).te) {
87
+ break;
88
+ }
89
+ var u = 0u;
90
+ loop {
91
+ let w = max(vdbGetDim(&a, h.voxel), 8u);
92
+ if w == u32(h.dim) || u >= 2u {
93
+ break;
94
+ }
95
+ vdbHddaUpdate(&h, (*it).o, (*it).d, w);
96
+ u++;
97
+ }
98
+ var t1 = min(min(min(h.next.x, h.next.y), min(h.next.z, h.tmax)), (*it).te);
99
+ let v = h.voxel;
100
+ let dim = u32(h.dim);
101
+ if !vdbHddaStep(&h) {
102
+ t1 = (*it).te;
103
+ }
104
+ if t1 > t0 {
105
+ (*it).t = t1;
106
+ s = vec3f(t0, t1, vdb_maj_bound(&a, v, dim));
107
+ break;
108
+ }
109
+ }
110
+ (*it).h = h;
111
+ (*it).acc = a;${o.minima ? "\n (*it).lo = 0.0;" : ""}
112
+ return s;
113
+ }`);
114
+ }
115
+ else {
116
+ const brick = o.majorant === "brick";
117
+ const fields = brick
118
+ ? `
119
+ mode: u32,
120
+ cell: vec3i,
121
+ n: vec3i,
122
+ sgn: vec3i,
123
+ tn: vec3f,
124
+ dt: vec3f,
125
+ base: u32,${o.minima ? "\n mn: u32," : ""}`
126
+ : "";
127
+ parts.push(`struct VdbMajorantIter {
128
+ t: f32,
129
+ te: f32,
130
+ vmax: f32,${fields}${ray}${lo}
131
+ }`);
132
+ const brickInit = brick
133
+ ? `
134
+ let f = vdb_rec(g, VDB_REC_FLAGS);
135
+ let mb = vdb_rec(g, VDB_REC_MAJORANT_OFFSET) >> 2u;
136
+ if (f & VDB_REC_FLAG_HAS_BRICK_MAJORANT) != 0u && vdb_load(mb + VDB_MAJ_MAGIC) == VDB_MAJORANT_MAGIC {
137
+ let s = 1.0 / f32(1u << ((f >> VDB_REC_BRICK_LOG2_SHIFT) & VDB_REC_BYTE_FIELD_MASK));
138
+ let n = bitcast<vec3i>(vec3u(vdb_rec(g, VDB_REC_MAJORANT_DIMS), vdb_rec(g, VDB_REC_MAJORANT_DIMS + 1u), vdb_rec(g, VDB_REC_MAJORANT_DIMS + 2u)));
139
+ let u = (o - vec3f(bitcast<vec3i>(vec3u(vdb_load(mb + VDB_MAJ_ORIGIN), vdb_load(mb + VDB_MAJ_ORIGIN + 1u), vdb_load(mb + VDB_MAJ_ORIGIN + 2u))))) * s;
140
+ let du = d * s;
141
+ let c = vdb_maj_clip(vec3f(0.0), vec3f(n), u, du, tMin, tMax);
142
+ if c.x < c.y {
143
+ let par = abs(du) < vec3f(1e-20);
144
+ let q = select(du, vec3f(1.0), par);
145
+ it.mode = 2u;
146
+ it.t = c.x;
147
+ it.te = c.y;
148
+ it.n = n;
149
+ it.cell = clamp(vec3i(floor(u + du * c.x)), vec3i(0), n - vec3i(1));
150
+ it.sgn = select(vec3i(-1), vec3i(1), du > vec3f(0.0));
151
+ it.tn = select((vec3f(it.cell + max(it.sgn, vec3i(0))) - u) / q, vec3f(1e30), par);
152
+ it.dt = select(abs(1.0 / q), vec3f(1e30), par);
153
+ it.base = mb + VDB_MAJORANT_HEADER_WORDS;${o.minima
154
+ ? `
155
+ if (vdb_load(mb + VDB_MAJ_FLAGS) & VDB_MAJ_FLAG_MINIMA) != 0u {
156
+ it.mn = it.base + u32(n.x * n.y * n.z);
157
+ }`
158
+ : ""}
159
+ }
160
+ return it;
161
+ }`
162
+ : "";
163
+ parts.push(`fn vdbMajorantInit(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {
164
+ var it: VdbMajorantIter;
165
+ it.t = tMin;
166
+ it.te = tMin;
167
+ if !vdb_live(g) {
168
+ return it;
169
+ }
170
+ it.vmax = ${vmax};${setRay}${brickInit}
171
+ let c = ${support};${brick ? "\n it.mode = 1u;" : ""}
172
+ it.t = c.x;
173
+ it.te = c.y;
174
+ return it;
175
+ }`);
176
+ const global = `(*it).t = (*it).te;${o.minima ? "\n (*it).lo = 0.0;" : ""}
177
+ return vec3f(t0, (*it).te, (*it).vmax);`;
178
+ parts.push(brick
179
+ ? `fn vdbMajorantNext(it: ptr<function, VdbMajorantIter>) -> vec3f {
180
+ for (var i = 0u; i < 4u; i++) {
181
+ let t0 = (*it).t;
182
+ if !(t0 < (*it).te) {
183
+ break;
184
+ }
185
+ if (*it).mode == 1u {
186
+ ${global.replace(/\n {8}/g, "\n ")}
187
+ }
188
+ let tn = (*it).tn;
189
+ var k = 0;
190
+ if tn.y < tn[k] {
191
+ k = 1;
192
+ }
193
+ if tn.z < tn[k] {
194
+ k = 2;
195
+ }
196
+ let t1 = min(tn[k], (*it).te);
197
+ let c = (*it).cell;
198
+ let n = (*it).n;
199
+ let w = u32(c.x + n.x * (c.y + n.y * c.z));
200
+ (*it).cell[k] = c[k] + (*it).sgn[k];
201
+ (*it).tn[k] = tn[k] + (*it).dt[k];
202
+ if (*it).cell[k] < 0 || (*it).cell[k] >= n[k] {
203
+ (*it).te = t1;
204
+ }
205
+ if t1 > t0 {
206
+ (*it).t = t1;${o.minima
207
+ ? `
208
+ (*it).lo = 0.0;
209
+ if (*it).mn != 0u {
210
+ (*it).lo = bitcast<f32>(vdb_load((*it).mn + w));
211
+ }`
212
+ : ""}
213
+ return vec3f(t0, t1, bitcast<f32>(vdb_load((*it).base + w)));
214
+ }
215
+ }
216
+ return vec3f((*it).t, (*it).t, 0.0);
217
+ }`
218
+ : `fn vdbMajorantNext(it: ptr<function, VdbMajorantIter>) -> vec3f {
219
+ let t0 = (*it).t;
220
+ if !(t0 < (*it).te) {
221
+ return vec3f(t0, t0, 0.0);
222
+ }
223
+ ${global.replace(/\n {8}/g, "\n ")}
224
+ }`);
225
+ }
226
+ if (o.minima) {
227
+ parts.push(`fn vdbMajorantMinimum(it: ptr<function, VdbMajorantIter>) -> f32 {
228
+ return (*it).lo;
229
+ }`);
230
+ }
231
+ return parts.join("\n");
232
+ }
233
+ /**
234
+ * The `majorant` profile's opt-in helpers (EX1f-b), emitted after the layer in this order. None is emitted unless
235
+ * listed, so a module without them keeps its bytes.
236
+ *
237
+ * - `'majorantWorld'`: `vdbMajorantInitWorld(g, o, d, tMin, tMax)`, `vdbMajorantInit` for a world-space ray (the
238
+ * record's world-to-index affine; `d` is not renormalized, so `t` stays the caller's world parameter).
239
+ * - `'majorantGlobal'` (`'brick'` and `'global'`): `vdbMajorantInitGlobal(g, o, d, tMin, tMax)`, the one-segment walk
240
+ * on the grid's global bound whatever brick bounds it has: bricks or the global bound picked per ray at run time
241
+ * in one module.
242
+ * - `'deltaTrack'`: `vdbDeltaTrack(it, acc, sigma, maxLookups) -> VdbCollision`, delta (Woodcock) tracking over the
243
+ * rest of the walk: the next real collision of the medium with extinction `sigma * vdbSample`.
244
+ * - `'ratioTrack'`: `vdbRatioTrack(it, acc, sigma, cutoff, maxLookups) -> VdbTransmittance`, ratio tracking over the
245
+ * rest of the walk: an unbiased transmittance per channel for the extinctions `sigma.rgb * vdbSample`, with the
246
+ * majorant of the largest channel; below `cutoff` (its largest channel) the estimate plays Russian roulette: it
247
+ * survives with probability `w / cutoff` and is scaled so that its largest channel is exactly `cutoff` (assigned,
248
+ * not multiplied: a product one ulp under `cutoff` would play again at the next collision on some GPUs only).
249
+ *
250
+ * The trackers draw uniform numbers in [0, 1) from the host's function `o.random` (the module option `random`: the
251
+ * name of a `fn name() -> f32` the host declares in the same shader), in this order: per tentative collision one for
252
+ * the distance, then (delta) one for the accept test, or (ratio) one when the roulette plays. CPU twins: `tools`
253
+ * `vdbDeltaTrack` / `vdbRatioTrack` (same draws, f32 in this evaluation order).
254
+ */
255
+ export function majorantHelpersWgsl(o) {
256
+ const out = [];
257
+ const has = (h) => o.helpers.includes(h);
258
+ if (has("majorantWorld")) {
259
+ out.push(`fn vdbMajorantInitWorld(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {
260
+ return vdbMajorantInit(g, vdbWorldToIndex(g, o), vdbWorldToIndexDir(g, d), tMin, tMax);
261
+ }`);
262
+ }
263
+ if (has("majorantGlobal")) {
264
+ const { vmax, support } = globalParts(o);
265
+ out.push(o.majorant === "brick"
266
+ ? `fn vdbMajorantInitGlobal(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {
267
+ var it: VdbMajorantIter;
268
+ it.t = tMin;
269
+ it.te = tMin;
270
+ if !vdb_live(g) {
271
+ return it;
272
+ }
273
+ it.vmax = ${vmax};${tracks(o) ? "\n it.o = o;\n it.d = d;" : ""}
274
+ let c = ${support};
275
+ it.mode = 1u;
276
+ it.t = c.x;
277
+ it.te = c.y;
278
+ return it;
279
+ }`
280
+ : `fn vdbMajorantInitGlobal(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {
281
+ return vdbMajorantInit(g, o, d, tMin, tMax);
282
+ }`);
283
+ }
284
+ const rand = `${o.random ?? "vdbRandomMissing"}()`;
285
+ if (has("deltaTrack")) {
286
+ out.push(`struct VdbCollision {
287
+ t: f32,
288
+ density: f32,
289
+ hit: bool,
290
+ truncated: bool,
291
+ steps: u32,
292
+ lookups: u32,
293
+ }`, `fn vdbDeltaTrack(it: ptr<function, VdbMajorantIter>, acc: ptr<function, VdbAccessor>, sigma: f32, maxLookups: u32) -> VdbCollision {
294
+ var r = VdbCollision((*it).t, 0.0, false, false, 0u, 0u);
295
+ let o = (*it).o;
296
+ let d = (*it).d;
297
+ loop {
298
+ let s = vdbMajorantNext(it);
299
+ if s.y <= s.x {
300
+ break;
301
+ }
302
+ r.steps += 1u;
303
+ r.t = s.y;
304
+ let m = s.z * sigma;
305
+ if m <= 0.0 {
306
+ continue;
307
+ }
308
+ var t = s.x;
309
+ loop {
310
+ t -= log(1.0 - ${rand}) / m;
311
+ if t >= s.y {
312
+ break;
313
+ }
314
+ if r.lookups >= maxLookups {
315
+ r.t = t;
316
+ r.truncated = true;
317
+ return r;
318
+ }
319
+ r.lookups += 1u;
320
+ let v = vdbSample(acc, o + d * t);
321
+ if ${rand} * m < v * sigma {
322
+ r.t = t;
323
+ r.density = v;
324
+ r.hit = true;
325
+ return r;
326
+ }
327
+ }
328
+ }
329
+ return r;
330
+ }`);
331
+ }
332
+ if (has("ratioTrack")) {
333
+ out.push(`struct VdbTransmittance {
334
+ value: vec3f,
335
+ truncated: bool,
336
+ steps: u32,
337
+ lookups: u32,
338
+ }`, `fn vdbRatioTrack(it: ptr<function, VdbMajorantIter>, acc: ptr<function, VdbAccessor>, sigma: vec3f, cutoff: f32, maxLookups: u32) -> VdbTransmittance {
339
+ var r = VdbTransmittance(vec3f(1.0), false, 0u, 0u);
340
+ let o = (*it).o;
341
+ let d = (*it).d;
342
+ let top = max(sigma.x, max(sigma.y, sigma.z));
343
+ loop {
344
+ let s = vdbMajorantNext(it);
345
+ if s.y <= s.x {
346
+ break;
347
+ }
348
+ r.steps += 1u;
349
+ let m = s.z * top;
350
+ if m <= 0.0 {
351
+ continue;
352
+ }
353
+ var t = s.x;
354
+ loop {
355
+ t -= log(1.0 - ${rand}) / m;
356
+ if t >= s.y {
357
+ break;
358
+ }
359
+ if r.lookups >= maxLookups {
360
+ r.truncated = true;
361
+ return r;
362
+ }
363
+ r.lookups += 1u;
364
+ let v = vdbSample(acc, o + d * t);
365
+ r.value *= vec3f(1.0) - sigma * (v / m);
366
+ let w = max(r.value.x, max(r.value.y, r.value.z));
367
+ if w < cutoff || w <= 0.0 {
368
+ if ${rand} * cutoff >= w {
369
+ r.value = vec3f(0.0);
370
+ return r;
371
+ }
372
+ r.value = select(r.value * (cutoff / w), vec3f(cutoff), r.value >= vec3f(w));
373
+ }
374
+ }
375
+ }
376
+ return r;
377
+ }`);
378
+ }
379
+ return out;
380
+ }
381
+ //# sourceMappingURL=majorant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"majorant.js","sourceRoot":"","sources":["../../../src/core/wgsl/majorant.ts"],"names":[],"mappings":"AAuCA,8DAA8D;AAC9D,MAAM,IAAI,GAAG;;;;;;;;;;;;;;EAcX,CAAC;AAEH,wFAAwF;AACxF,SAAS,MAAM,CAAC,CAAa;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC9E,CAAC;AAED,sHAAsH;AACtH,SAAS,WAAW,CAAC,CAAa;IAChC,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACpD,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,uDAAuD,CAAC,CAAC,CAAC,6CAA6C;QACpI,OAAO,EAAE,8CAA8C,GAAG,oCAAoC,GAAG,sBAAsB;KACx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CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACjF,IAAI,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;QACzB,GAAG,CAAC,IAAI,CAAC;;EAEX,CAAC,CAAC;IACF,CAAC;IACD,IAAI,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QACzC,GAAG,CAAC,IAAI,CACN,CAAC,CAAC,QAAQ,KAAK,OAAO;YACpB,CAAC,CAAC;;;;;;;gBAOM,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,EAAE;cAC3D,OAAO;;;;;EAKnB;YACM,CAAC,CAAC;;EAER,CACG,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,MAAM,IAAI,kBAAkB,IAAI,CAAC;IACnD,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,IAAI,CACN;;;;;;;EAOJ,EACI;;;;;;;;;;;;;;;;;6BAiBuB,IAAI;;;;;;;;;;;iBAWhB,IAAI;;;;;;;;;EASnB,CACG,CAAC;IACJ,CAAC;IACD,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,IAAI,CACN;;;;;EAKJ,EACI;;;;;;;;;;;;;;;;;6BAiBuB,IAAI;;;;;;;;;;;;;qBAaZ,IAAI;;;;;;;;;EASvB,CACG,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * The `majorant` profile's API layer (P1.3, P1.4; docs/dev/design/K1-core.md §3.2, §5): a piecewise-constant\n * bound of the sampled field along an index-space ray, for delta and ratio tracking.\n *\n * ```wgsl\n * var it = vdbMajorantInit(g, oIdx, dIdx, tMin, tMax); // index-space ray, d unnormalized, t the caller's\n * loop { let s = vdbMajorantNext(&it); if s.y <= s.x { break; } } // s.z bounds every sample on [s.x, s.y)\n * ```\n *\n * Segments are contiguous, never of zero length, and cover the walk's box: the brick grid's cells\n * (`'brick'`), else the sampler's support box (`[min - 1, max + 1]` trilinear, `[min - 0.5, max + 0.5]`\n * nearest). Outside it the field is 0 with `outside: 'zero'` (with `'background'` it is the tree's\n * background, which the walk does not cover: use a fog grid with background 0).\n *\n * - `'brick'`: the pathtracer's DDA (`ptDdaInit` / `ptDdaNext`) over the brick cells in cell space\n * `(p - origin) / B`; a grid without a brick range (or a 0.1 pool's range, which has no \"VDBM\" header)\n * walks as `'global'`.\n * - `'global'`: one segment with the record's `valueMax` (`vdbMajorantGlobal(g)`, the scalar a VSPG or\n * emission estimator needs).\n * - `'nodeMax'` (needs the march layer): the vendored HDDA at leaf size 8 widening over tiles; a cell's\n * bound is the max of `vdbNodeMax` over the 2x2x2 block of cells from its corner (the 8-leaf support of\n * a trilinear sample). Stats bound ACTIVE values: inactive leaf voxels must be <= their leaf's max (fog).\n *\n * With `outside: 'zero'` a bound below 0 becomes 0 (a tap outside the bbox reads 0). With `minima`,\n * `vdbMajorantMinimum(&it)` is the lower bound of the segment the last `vdbMajorantNext` returned: the\n * brick minimum when the range carries minima, else 0 (a minorant of a non-negative field).\n *\n * CPU twin: `tools` `vdbMajorantWalk`. Axis-parallel rays: a direction component below 1e-20 in\n * magnitude never divides (WGSL may assume no infinities; CLAUDE.md Traps).\n *\n * Opt-in helpers (EX1f-b, {@link majorantHelpersWgsl}): `vdbMajorantInitWorld`, `vdbMajorantInitGlobal`,\n * `vdbDeltaTrack`, `vdbRatioTrack`. With a tracker the iterator also keeps the ray (`o`, `d`), so a\n * tracker takes only the iterator and an accessor.\n */\nimport type { ApiOptions } from \"./api.js\";\n\n/** The `majorant` module option: which walk the profile compiles. */\nexport type VDBMajorantMode = \"brick\" | \"global\" | \"nodeMax\";\n\n/** `vdb_maj_clip`: slab test with the axis-parallel guard. */\nconst CLIP = `fn vdb_maj_clip(lo: vec3f, hi: vec3f, o: vec3f, d: vec3f, t0: f32, t1: f32) -> vec2f {\n var t = vec2f(t0, t1);\n for (var k = 0; k < 3; k++) {\n if abs(d[k]) < 1e-20 {\n if o[k] < lo[k] || o[k] >= hi[k] {\n return vec2f(t0, t0);\n }\n } else {\n let p = (lo[k] - o[k]) / d[k];\n let q = (hi[k] - o[k]) / d[k];\n t = vec2f(max(t.x, min(p, q)), min(t.y, max(p, q)));\n }\n }\n return t;\n}`;\n\n/** Whether a tracking helper is listed: the iterator then keeps the index-space ray. */\nfunction tracks(o: ApiOptions): boolean {\n return o.helpers.includes(\"deltaTrack\") || o.helpers.includes(\"ratioTrack\");\n}\n\n/** The record's global bound and the sampler's support clip, as WGSL expressions of `g`, `o`, `d`, `tMin`, `tMax`. */\nfunction globalParts(o: ApiOptions): { vmax: string; support: string } {\n const pad = o.sampler === \"nearest\" ? \"0.5\" : \"1.0\";\n return {\n vmax: o.outside === \"zero\" ? \"max(bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX)), 0.0)\" : \"bitcast<f32>(vdb_rec(g, VDB_REC_VALUE_MAX))\",\n support: `vdb_maj_clip(vec3f(vdbIndexMin(g)) - vec3f(${pad}), vec3f(vdbIndexMax(g)) + vec3f(${pad}), o, d, tMin, tMax)`,\n };\n}\n\n/** The majorant layer for the normalized options (`o.majorant`, `o.minima`, `o.sampler`, `o.outside`). */\nexport function majorantWgsl(o: ApiOptions): string {\n const zero = o.outside === \"zero\";\n const { vmax, support } = globalParts(o);\n // EX1f-b: with a tracker the brick / global iterator keeps the ray (the nodeMax one always has it).\n const ray = tracks(o) ? \"\\n o: vec3f,\\n d: vec3f,\" : \"\";\n const setRay = tracks(o) ? \"\\n it.o = o;\\n it.d = d;\" : \"\";\n const parts = [\n CLIP,\n `fn vdbMajorantGlobal(g: u32) -> f32 {\n if !vdb_live(g) {\n return 0.0;\n }\n return ${vmax};\n}`,\n ];\n const lo = o.minima ? \"\\n lo: f32,\" : \"\";\n\n if (o.majorant === \"nodeMax\") {\n parts.push(\n `struct VdbMajorantIter {\n t: f32,\n te: f32,\n o: vec3f,\n d: vec3f,\n h: VdbHdda,\n acc: VdbAccessor,${lo}\n}`,\n `fn vdb_maj_bound(acc: ptr<function, VdbAccessor>, ijk: vec3i, dim: u32) -> f32 {\n var m = vdbNodeMax(acc, ijk, dim);\n for (var k = 1u; k < 8u; k++) {\n m = max(m, vdbNodeMax(acc, ijk + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, k >> 2u)) * i32(dim), dim));\n }\n return ${zero ? \"max(m, 0.0)\" : \"m\"};\n}`,\n `fn vdbMajorantInit(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {\n var it: VdbMajorantIter;\n it.t = tMin;\n it.te = tMin;\n if !vdb_live(g) {\n return it;\n }\n let c = ${support};\n if c.x < c.y {\n it.t = c.x;\n it.te = c.y;\n it.o = o;\n it.d = d;\n var a = vdbAccessorInit(g);\n var h: VdbHdda;\n vdbHddaInit(&h, o, c.x, d, c.y, max(vdbGetDim(&a, vec3i(floor(o + d * c.x))), 8u));\n it.h = h;\n it.acc = a;\n }\n return it;\n}`,\n `fn vdbMajorantNext(it: ptr<function, VdbMajorantIter>) -> vec3f {\n var h = (*it).h;\n var a = (*it).acc;\n var s = vec3f((*it).t, (*it).t, 0.0);\n for (var i = 0u; i < 16u; i++) {\n let t0 = (*it).t;\n if !(t0 < (*it).te) {\n break;\n }\n var u = 0u;\n loop {\n let w = max(vdbGetDim(&a, h.voxel), 8u);\n if w == u32(h.dim) || u >= 2u {\n break;\n }\n vdbHddaUpdate(&h, (*it).o, (*it).d, w);\n u++;\n }\n var t1 = min(min(min(h.next.x, h.next.y), min(h.next.z, h.tmax)), (*it).te);\n let v = h.voxel;\n let dim = u32(h.dim);\n if !vdbHddaStep(&h) {\n t1 = (*it).te;\n }\n if t1 > t0 {\n (*it).t = t1;\n s = vec3f(t0, t1, vdb_maj_bound(&a, v, dim));\n break;\n }\n }\n (*it).h = h;\n (*it).acc = a;${o.minima ? \"\\n (*it).lo = 0.0;\" : \"\"}\n return s;\n}`,\n );\n } else {\n const brick = o.majorant === \"brick\";\n const fields = brick\n ? `\n mode: u32,\n cell: vec3i,\n n: vec3i,\n sgn: vec3i,\n tn: vec3f,\n dt: vec3f,\n base: u32,${o.minima ? \"\\n mn: u32,\" : \"\"}`\n : \"\";\n parts.push(`struct VdbMajorantIter {\n t: f32,\n te: f32,\n vmax: f32,${fields}${ray}${lo}\n}`);\n const brickInit = brick\n ? `\n let f = vdb_rec(g, VDB_REC_FLAGS);\n let mb = vdb_rec(g, VDB_REC_MAJORANT_OFFSET) >> 2u;\n if (f & VDB_REC_FLAG_HAS_BRICK_MAJORANT) != 0u && vdb_load(mb + VDB_MAJ_MAGIC) == VDB_MAJORANT_MAGIC {\n let s = 1.0 / f32(1u << ((f >> VDB_REC_BRICK_LOG2_SHIFT) & VDB_REC_BYTE_FIELD_MASK));\n let n = bitcast<vec3i>(vec3u(vdb_rec(g, VDB_REC_MAJORANT_DIMS), vdb_rec(g, VDB_REC_MAJORANT_DIMS + 1u), vdb_rec(g, VDB_REC_MAJORANT_DIMS + 2u)));\n let u = (o - vec3f(bitcast<vec3i>(vec3u(vdb_load(mb + VDB_MAJ_ORIGIN), vdb_load(mb + VDB_MAJ_ORIGIN + 1u), vdb_load(mb + VDB_MAJ_ORIGIN + 2u))))) * s;\n let du = d * s;\n let c = vdb_maj_clip(vec3f(0.0), vec3f(n), u, du, tMin, tMax);\n if c.x < c.y {\n let par = abs(du) < vec3f(1e-20);\n let q = select(du, vec3f(1.0), par);\n it.mode = 2u;\n it.t = c.x;\n it.te = c.y;\n it.n = n;\n it.cell = clamp(vec3i(floor(u + du * c.x)), vec3i(0), n - vec3i(1));\n it.sgn = select(vec3i(-1), vec3i(1), du > vec3f(0.0));\n it.tn = select((vec3f(it.cell + max(it.sgn, vec3i(0))) - u) / q, vec3f(1e30), par);\n it.dt = select(abs(1.0 / q), vec3f(1e30), par);\n it.base = mb + VDB_MAJORANT_HEADER_WORDS;${\n o.minima\n ? `\n if (vdb_load(mb + VDB_MAJ_FLAGS) & VDB_MAJ_FLAG_MINIMA) != 0u {\n it.mn = it.base + u32(n.x * n.y * n.z);\n }`\n : \"\"\n }\n }\n return it;\n }`\n : \"\";\n parts.push(`fn vdbMajorantInit(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {\n var it: VdbMajorantIter;\n it.t = tMin;\n it.te = tMin;\n if !vdb_live(g) {\n return it;\n }\n it.vmax = ${vmax};${setRay}${brickInit}\n let c = ${support};${brick ? \"\\n it.mode = 1u;\" : \"\"}\n it.t = c.x;\n it.te = c.y;\n return it;\n}`);\n const global = `(*it).t = (*it).te;${o.minima ? \"\\n (*it).lo = 0.0;\" : \"\"}\n return vec3f(t0, (*it).te, (*it).vmax);`;\n parts.push(\n brick\n ? `fn vdbMajorantNext(it: ptr<function, VdbMajorantIter>) -> vec3f {\n for (var i = 0u; i < 4u; i++) {\n let t0 = (*it).t;\n if !(t0 < (*it).te) {\n break;\n }\n if (*it).mode == 1u {\n ${global.replace(/\\n {8}/g, \"\\n \")}\n }\n let tn = (*it).tn;\n var k = 0;\n if tn.y < tn[k] {\n k = 1;\n }\n if tn.z < tn[k] {\n k = 2;\n }\n let t1 = min(tn[k], (*it).te);\n let c = (*it).cell;\n let n = (*it).n;\n let w = u32(c.x + n.x * (c.y + n.y * c.z));\n (*it).cell[k] = c[k] + (*it).sgn[k];\n (*it).tn[k] = tn[k] + (*it).dt[k];\n if (*it).cell[k] < 0 || (*it).cell[k] >= n[k] {\n (*it).te = t1;\n }\n if t1 > t0 {\n (*it).t = t1;${\n o.minima\n ? `\n (*it).lo = 0.0;\n if (*it).mn != 0u {\n (*it).lo = bitcast<f32>(vdb_load((*it).mn + w));\n }`\n : \"\"\n }\n return vec3f(t0, t1, bitcast<f32>(vdb_load((*it).base + w)));\n }\n }\n return vec3f((*it).t, (*it).t, 0.0);\n}`\n : `fn vdbMajorantNext(it: ptr<function, VdbMajorantIter>) -> vec3f {\n let t0 = (*it).t;\n if !(t0 < (*it).te) {\n return vec3f(t0, t0, 0.0);\n }\n ${global.replace(/\\n {8}/g, \"\\n \")}\n}`,\n );\n }\n if (o.minima) {\n parts.push(`fn vdbMajorantMinimum(it: ptr<function, VdbMajorantIter>) -> f32 {\n return (*it).lo;\n}`);\n }\n return parts.join(\"\\n\");\n}\n\n/**\n * The `majorant` profile's opt-in helpers (EX1f-b), emitted after the layer in this order. None is emitted unless\n * listed, so a module without them keeps its bytes.\n *\n * - `'majorantWorld'`: `vdbMajorantInitWorld(g, o, d, tMin, tMax)`, `vdbMajorantInit` for a world-space ray (the\n * record's world-to-index affine; `d` is not renormalized, so `t` stays the caller's world parameter).\n * - `'majorantGlobal'` (`'brick'` and `'global'`): `vdbMajorantInitGlobal(g, o, d, tMin, tMax)`, the one-segment walk\n * on the grid's global bound whatever brick bounds it has: bricks or the global bound picked per ray at run time\n * in one module.\n * - `'deltaTrack'`: `vdbDeltaTrack(it, acc, sigma, maxLookups) -> VdbCollision`, delta (Woodcock) tracking over the\n * rest of the walk: the next real collision of the medium with extinction `sigma * vdbSample`.\n * - `'ratioTrack'`: `vdbRatioTrack(it, acc, sigma, cutoff, maxLookups) -> VdbTransmittance`, ratio tracking over the\n * rest of the walk: an unbiased transmittance per channel for the extinctions `sigma.rgb * vdbSample`, with the\n * majorant of the largest channel; below `cutoff` (its largest channel) the estimate plays Russian roulette: it\n * survives with probability `w / cutoff` and is scaled so that its largest channel is exactly `cutoff` (assigned,\n * not multiplied: a product one ulp under `cutoff` would play again at the next collision on some GPUs only).\n *\n * The trackers draw uniform numbers in [0, 1) from the host's function `o.random` (the module option `random`: the\n * name of a `fn name() -> f32` the host declares in the same shader), in this order: per tentative collision one for\n * the distance, then (delta) one for the accept test, or (ratio) one when the roulette plays. CPU twins: `tools`\n * `vdbDeltaTrack` / `vdbRatioTrack` (same draws, f32 in this evaluation order).\n */\nexport function majorantHelpersWgsl(o: ApiOptions): string[] {\n const out: string[] = [];\n const has = (h: ApiOptions[\"helpers\"][number]): boolean => o.helpers.includes(h);\n if (has(\"majorantWorld\")) {\n out.push(`fn vdbMajorantInitWorld(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {\n return vdbMajorantInit(g, vdbWorldToIndex(g, o), vdbWorldToIndexDir(g, d), tMin, tMax);\n}`);\n }\n if (has(\"majorantGlobal\")) {\n const { vmax, support } = globalParts(o);\n out.push(\n o.majorant === \"brick\"\n ? `fn vdbMajorantInitGlobal(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {\n var it: VdbMajorantIter;\n it.t = tMin;\n it.te = tMin;\n if !vdb_live(g) {\n return it;\n }\n it.vmax = ${vmax};${tracks(o) ? \"\\n it.o = o;\\n it.d = d;\" : \"\"}\n let c = ${support};\n it.mode = 1u;\n it.t = c.x;\n it.te = c.y;\n return it;\n}`\n : `fn vdbMajorantInitGlobal(g: u32, o: vec3f, d: vec3f, tMin: f32, tMax: f32) -> VdbMajorantIter {\n return vdbMajorantInit(g, o, d, tMin, tMax);\n}`,\n );\n }\n const rand = `${o.random ?? \"vdbRandomMissing\"}()`;\n if (has(\"deltaTrack\")) {\n out.push(\n `struct VdbCollision {\n t: f32,\n density: f32,\n hit: bool,\n truncated: bool,\n steps: u32,\n lookups: u32,\n}`,\n `fn vdbDeltaTrack(it: ptr<function, VdbMajorantIter>, acc: ptr<function, VdbAccessor>, sigma: f32, maxLookups: u32) -> VdbCollision {\n var r = VdbCollision((*it).t, 0.0, false, false, 0u, 0u);\n let o = (*it).o;\n let d = (*it).d;\n loop {\n let s = vdbMajorantNext(it);\n if s.y <= s.x {\n break;\n }\n r.steps += 1u;\n r.t = s.y;\n let m = s.z * sigma;\n if m <= 0.0 {\n continue;\n }\n var t = s.x;\n loop {\n t -= log(1.0 - ${rand}) / m;\n if t >= s.y {\n break;\n }\n if r.lookups >= maxLookups {\n r.t = t;\n r.truncated = true;\n return r;\n }\n r.lookups += 1u;\n let v = vdbSample(acc, o + d * t);\n if ${rand} * m < v * sigma {\n r.t = t;\n r.density = v;\n r.hit = true;\n return r;\n }\n }\n }\n return r;\n}`,\n );\n }\n if (has(\"ratioTrack\")) {\n out.push(\n `struct VdbTransmittance {\n value: vec3f,\n truncated: bool,\n steps: u32,\n lookups: u32,\n}`,\n `fn vdbRatioTrack(it: ptr<function, VdbMajorantIter>, acc: ptr<function, VdbAccessor>, sigma: vec3f, cutoff: f32, maxLookups: u32) -> VdbTransmittance {\n var r = VdbTransmittance(vec3f(1.0), false, 0u, 0u);\n let o = (*it).o;\n let d = (*it).d;\n let top = max(sigma.x, max(sigma.y, sigma.z));\n loop {\n let s = vdbMajorantNext(it);\n if s.y <= s.x {\n break;\n }\n r.steps += 1u;\n let m = s.z * top;\n if m <= 0.0 {\n continue;\n }\n var t = s.x;\n loop {\n t -= log(1.0 - ${rand}) / m;\n if t >= s.y {\n break;\n }\n if r.lookups >= maxLookups {\n r.truncated = true;\n return r;\n }\n r.lookups += 1u;\n let v = vdbSample(acc, o + d * t);\n r.value *= vec3f(1.0) - sigma * (v / m);\n let w = max(r.value.x, max(r.value.y, r.value.z));\n if w < cutoff || w <= 0.0 {\n if ${rand} * cutoff >= w {\n r.value = vec3f(0.0);\n return r;\n }\n r.value = select(r.value * (cutoff / w), vec3f(cutoff), r.value >= vec3f(w));\n }\n }\n }\n return r;\n}`,\n );\n }\n return out;\n}\n"]}
@@ -9,6 +9,6 @@ export interface PnanovdbChunk {
9
9
  readonly text: string;
10
10
  }
11
11
  /** SHA-256 of the vendored file this table was extracted from. */
12
- export declare const PNANOVDB_SOURCE_SHA256 = "f28fe6927ea1eead9e4d4d619c9b2e1fe365ac75514e1d19738354ecaf56b4ca";
13
- /** Every top-level declaration, in file order (296 declarations). */
12
+ export declare const PNANOVDB_SOURCE_SHA256 = "93bf47dea257f60b6f58f6f48ad3049a982c82c1984bdc6094f4c7af955f4a80";
13
+ /** Every top-level declaration, in file order (299 declarations). */
14
14
  export declare const PNANOVDB_CHUNKS: readonly PnanovdbChunk[];