@luma.gl/engine 10.0.0-rc.1 → 10.0.0-rc.2

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 (437) hide show
  1. package/THIRD-PARTY-NOTICES.md +82 -0
  2. package/dist/animation/animation-track.d.ts +7 -0
  3. package/dist/animation/animation-track.d.ts.map +1 -1
  4. package/dist/animation/animation-track.js.map +1 -1
  5. package/dist/animation/node-animation-binding.cjs +1 -0
  6. package/dist/animation/node-animation-binding.d.ts +2 -1
  7. package/dist/animation/node-animation-binding.d.ts.map +1 -1
  8. package/dist/animation/node-animation-binding.js +6 -0
  9. package/dist/animation/node-animation-binding.js.map +1 -1
  10. package/dist/animation/scenegraph-gpu-animation-layout.cjs +99 -0
  11. package/dist/animation/scenegraph-gpu-animation-layout.d.ts +69 -0
  12. package/dist/animation/scenegraph-gpu-animation-layout.d.ts.map +1 -0
  13. package/dist/animation/scenegraph-gpu-animation-layout.js +90 -0
  14. package/dist/animation/scenegraph-gpu-animation-layout.js.map +1 -0
  15. package/dist/animation/scenegraph-gpu-animation.cjs +281 -0
  16. package/dist/animation/scenegraph-gpu-animation.d.ts +54 -0
  17. package/dist/animation/scenegraph-gpu-animation.d.ts.map +1 -0
  18. package/dist/animation/scenegraph-gpu-animation.js +274 -0
  19. package/dist/animation/scenegraph-gpu-animation.js.map +1 -0
  20. package/dist/arrow/arrow-picking.cjs +4 -3
  21. package/dist/arrow/arrow-picking.d.ts +15 -5
  22. package/dist/arrow/arrow-picking.d.ts.map +1 -1
  23. package/dist/arrow/arrow-picking.js +16 -5
  24. package/dist/arrow/arrow-picking.js.map +1 -1
  25. package/dist/arrow/index.cjs.map +1 -1
  26. package/dist/dist.dev.js +1671 -1105
  27. package/dist/dist.min.js +69 -70
  28. package/dist/effects/glfx-effects.cjs +261 -0
  29. package/dist/effects/glfx-effects.d.ts +959 -0
  30. package/dist/effects/glfx-effects.d.ts.map +1 -0
  31. package/dist/effects/glfx-effects.js +200 -0
  32. package/dist/effects/glfx-effects.js.map +1 -0
  33. package/dist/effects/graph/gpu-effect-operation.cjs +402 -0
  34. package/dist/effects/graph/gpu-effect-operation.d.ts +101 -0
  35. package/dist/effects/graph/gpu-effect-operation.d.ts.map +1 -0
  36. package/dist/effects/graph/gpu-effect-operation.js +410 -0
  37. package/dist/effects/graph/gpu-effect-operation.js.map +1 -0
  38. package/dist/effects/graph/temporal-graph-history.cjs +48 -0
  39. package/dist/effects/graph/temporal-graph-history.d.ts +17 -0
  40. package/dist/effects/graph/temporal-graph-history.d.ts.map +1 -0
  41. package/dist/effects/graph/temporal-graph-history.js +30 -0
  42. package/dist/effects/graph/temporal-graph-history.js.map +1 -0
  43. package/dist/effects/index.cjs +117 -30
  44. package/dist/effects/index.cjs.map +3 -3
  45. package/dist/effects/index.d.ts +34 -18
  46. package/dist/effects/index.d.ts.map +1 -1
  47. package/dist/effects/index.js +31 -18
  48. package/dist/effects/index.js.map +1 -1
  49. package/dist/effects/passes/postprocessing/fxaa/fxaa.cjs +9 -2
  50. package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts +19 -0
  51. package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
  52. package/dist/effects/passes/postprocessing/fxaa/fxaa.js +6 -0
  53. package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
  54. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.cjs +9 -2
  55. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts +41 -0
  56. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts.map +1 -1
  57. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js +6 -0
  58. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js.map +1 -1
  59. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.cjs +200 -13
  60. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts +992 -6
  61. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts.map +1 -1
  62. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js +199 -10
  63. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js.map +1 -1
  64. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts +3 -3
  65. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts.map +1 -1
  66. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.js.map +1 -1
  67. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.cjs +41 -40
  68. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +116 -8
  69. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
  70. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js +38 -37
  71. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js.map +1 -1
  72. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.cjs +83 -66
  73. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +470 -2
  74. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
  75. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js +80 -62
  76. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js.map +1 -1
  77. package/dist/effects/passes/screen-space/copy-pass.cjs +7 -0
  78. package/dist/effects/passes/screen-space/copy-pass.d.ts +1 -0
  79. package/dist/effects/passes/screen-space/copy-pass.d.ts.map +1 -1
  80. package/dist/effects/passes/screen-space/copy-pass.js +4 -0
  81. package/dist/effects/passes/screen-space/copy-pass.js.map +1 -1
  82. package/dist/effects/passes/screen-space/depth-aware-blur.cjs +14 -5
  83. package/dist/effects/passes/screen-space/depth-aware-blur.d.ts +125 -17
  84. package/dist/effects/passes/screen-space/depth-aware-blur.d.ts.map +1 -1
  85. package/dist/effects/passes/screen-space/depth-aware-blur.js +11 -3
  86. package/dist/effects/passes/screen-space/depth-aware-blur.js.map +1 -1
  87. package/dist/effects/passes/screen-space/dof.cjs +19 -3
  88. package/dist/effects/passes/screen-space/dof.d.ts +181 -0
  89. package/dist/effects/passes/screen-space/dof.d.ts.map +1 -1
  90. package/dist/effects/passes/screen-space/dof.js +17 -3
  91. package/dist/effects/passes/screen-space/dof.js.map +1 -1
  92. package/dist/effects/passes/screen-space/gtao.cjs +82 -62
  93. package/dist/effects/passes/screen-space/gtao.d.ts +608 -3
  94. package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
  95. package/dist/effects/passes/screen-space/gtao.js +83 -60
  96. package/dist/effects/passes/screen-space/gtao.js.map +1 -1
  97. package/dist/effects/passes/screen-space/hdr-auto-exposure.cjs +103 -79
  98. package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts +225 -3
  99. package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts.map +1 -1
  100. package/dist/effects/passes/screen-space/hdr-auto-exposure.js +102 -77
  101. package/dist/effects/passes/screen-space/hdr-auto-exposure.js.map +1 -1
  102. package/dist/effects/passes/screen-space/height-fog.cjs +14 -0
  103. package/dist/effects/passes/screen-space/height-fog.d.ts +71 -0
  104. package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
  105. package/dist/effects/passes/screen-space/height-fog.js +16 -3
  106. package/dist/effects/passes/screen-space/height-fog.js.map +1 -1
  107. package/dist/effects/passes/screen-space/motion-blur.cjs +7 -8
  108. package/dist/effects/passes/screen-space/motion-blur.d.ts +41 -2
  109. package/dist/effects/passes/screen-space/motion-blur.d.ts.map +1 -1
  110. package/dist/effects/passes/screen-space/motion-blur.js +6 -6
  111. package/dist/effects/passes/screen-space/motion-blur.js.map +1 -1
  112. package/dist/effects/passes/screen-space/outlines.cjs +143 -18
  113. package/dist/effects/passes/screen-space/outlines.d.ts +162 -3
  114. package/dist/effects/passes/screen-space/outlines.d.ts.map +1 -1
  115. package/dist/effects/passes/screen-space/outlines.js +137 -15
  116. package/dist/effects/passes/screen-space/outlines.js.map +1 -1
  117. package/dist/effects/passes/screen-space/screen-space-global-illumination.cjs +70 -61
  118. package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +309 -2
  119. package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
  120. package/dist/effects/passes/screen-space/screen-space-global-illumination.js +69 -59
  121. package/dist/effects/passes/screen-space/screen-space-global-illumination.js.map +1 -1
  122. package/dist/effects/passes/screen-space/screen-space-reflections.cjs +151 -83
  123. package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +778 -7
  124. package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
  125. package/dist/effects/passes/screen-space/screen-space-reflections.js +148 -79
  126. package/dist/effects/passes/screen-space/screen-space-reflections.js.map +1 -1
  127. package/dist/effects/passes/screen-space/selection-outline.cjs +12 -2
  128. package/dist/effects/passes/screen-space/selection-outline.d.ts +44 -0
  129. package/dist/effects/passes/screen-space/selection-outline.d.ts.map +1 -1
  130. package/dist/effects/passes/screen-space/selection-outline.js +9 -0
  131. package/dist/effects/passes/screen-space/selection-outline.js.map +1 -1
  132. package/dist/effects/passes/screen-space/ssao.cjs +66 -43
  133. package/dist/effects/passes/screen-space/ssao.d.ts +647 -2
  134. package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
  135. package/dist/effects/passes/screen-space/ssao.js +64 -41
  136. package/dist/effects/passes/screen-space/ssao.js.map +1 -1
  137. package/dist/effects/passes/screen-space/temporal-antialiasing.cjs +42 -30
  138. package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts +107 -6
  139. package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts.map +1 -1
  140. package/dist/effects/passes/screen-space/temporal-antialiasing.js +40 -27
  141. package/dist/effects/passes/screen-space/temporal-antialiasing.js.map +1 -1
  142. package/dist/effects/passes/screen-space/temporal-frame.cjs +34 -0
  143. package/dist/effects/passes/screen-space/temporal-frame.d.ts +23 -0
  144. package/dist/effects/passes/screen-space/temporal-frame.d.ts.map +1 -0
  145. package/dist/effects/passes/screen-space/temporal-frame.js +16 -0
  146. package/dist/effects/passes/screen-space/temporal-frame.js.map +1 -0
  147. package/dist/effects/passes/screen-space/volumetric-fog.cjs +25 -22
  148. package/dist/effects/passes/screen-space/volumetric-fog.d.ts +161 -2
  149. package/dist/effects/passes/screen-space/volumetric-fog.d.ts.map +1 -1
  150. package/dist/effects/passes/screen-space/volumetric-fog.js +27 -21
  151. package/dist/effects/passes/screen-space/volumetric-fog.js.map +1 -1
  152. package/dist/effects/temporal-upscale/index.cjs +40 -0
  153. package/dist/effects/temporal-upscale/index.d.ts +5 -0
  154. package/dist/effects/temporal-upscale/index.d.ts.map +1 -0
  155. package/dist/effects/temporal-upscale/index.js +6 -0
  156. package/dist/effects/temporal-upscale/index.js.map +1 -0
  157. package/dist/effects/temporal-upscale/temporal-math.cjs +202 -0
  158. package/dist/effects/temporal-upscale/temporal-math.d.ts +101 -0
  159. package/dist/effects/temporal-upscale/temporal-math.d.ts.map +1 -0
  160. package/dist/effects/temporal-upscale/temporal-math.js +202 -0
  161. package/dist/effects/temporal-upscale/temporal-math.js.map +1 -0
  162. package/dist/effects/temporal-upscale/temporal-upscale-shaders.cjs +353 -0
  163. package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts +7 -0
  164. package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts.map +1 -0
  165. package/dist/effects/temporal-upscale/temporal-upscale-shaders.js +321 -0
  166. package/dist/effects/temporal-upscale/temporal-upscale-shaders.js.map +1 -0
  167. package/dist/effects/temporal-upscale/temporal-upscaler.cjs +392 -0
  168. package/dist/effects/temporal-upscale/temporal-upscaler.d.ts +143 -0
  169. package/dist/effects/temporal-upscale/temporal-upscaler.d.ts.map +1 -0
  170. package/dist/effects/temporal-upscale/temporal-upscaler.js +385 -0
  171. package/dist/effects/temporal-upscale/temporal-upscaler.js.map +1 -0
  172. package/dist/gltf/gltf/create-gltf-model.cjs +34 -71
  173. package/dist/gltf/gltf/create-gltf-model.d.ts +3 -0
  174. package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
  175. package/dist/gltf/gltf/create-gltf-model.js +40 -74
  176. package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
  177. package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +46 -4
  178. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +9 -1
  179. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
  180. package/dist/gltf/gltf/create-scenegraph-from-gltf.js +54 -4
  181. package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
  182. package/dist/gltf/gltf/gltf-animated-crowd.cjs +25 -136
  183. package/dist/gltf/gltf/gltf-animated-crowd.d.ts +4 -8
  184. package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -1
  185. package/dist/gltf/gltf/gltf-animated-crowd.js +27 -139
  186. package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -1
  187. package/dist/gltf/gltf/gltf-animation-nodes.cjs +84 -0
  188. package/dist/gltf/gltf/gltf-animation-nodes.d.ts +11 -0
  189. package/dist/gltf/gltf/gltf-animation-nodes.d.ts.map +1 -0
  190. package/dist/gltf/gltf/gltf-animation-nodes.js +62 -0
  191. package/dist/gltf/gltf/gltf-animation-nodes.js.map +1 -0
  192. package/dist/gltf/gltf/gltf-animator.cjs +8 -2
  193. package/dist/gltf/gltf/gltf-animator.d.ts +6 -1
  194. package/dist/gltf/gltf/gltf-animator.d.ts.map +1 -1
  195. package/dist/gltf/gltf/gltf-animator.js +10 -2
  196. package/dist/gltf/gltf/gltf-animator.js.map +1 -1
  197. package/dist/gltf/gltf/gltf-gpu-animation-controller.cjs +81 -0
  198. package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts +9 -0
  199. package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts.map +1 -0
  200. package/dist/gltf/gltf/gltf-gpu-animation-controller.js +67 -0
  201. package/dist/gltf/gltf/gltf-gpu-animation-controller.js.map +1 -0
  202. package/dist/gltf/gltf/gltf-gpu-animation.cjs +33 -28
  203. package/dist/gltf/gltf/gltf-gpu-animation.d.ts +7 -26
  204. package/dist/gltf/gltf/gltf-gpu-animation.d.ts.map +1 -1
  205. package/dist/gltf/gltf/gltf-gpu-animation.js +29 -28
  206. package/dist/gltf/gltf/gltf-gpu-animation.js.map +1 -1
  207. package/dist/gltf/index.cjs.map +3 -3
  208. package/dist/gltf/index.d.ts +2 -2
  209. package/dist/gltf/index.d.ts.map +1 -1
  210. package/dist/gltf/index.js.map +1 -1
  211. package/dist/gltf/parsers/parse-gltf.cjs +4 -2
  212. package/dist/gltf/parsers/parse-gltf.d.ts +3 -0
  213. package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
  214. package/dist/gltf/parsers/parse-gltf.js +7 -2
  215. package/dist/gltf/parsers/parse-gltf.js.map +1 -1
  216. package/dist/graph/models/index.cjs.map +2 -2
  217. package/dist/graph/physics/index.cjs +5 -0
  218. package/dist/graph/physics/index.cjs.map +3 -3
  219. package/dist/graph/physics/index.d.ts +1 -0
  220. package/dist/graph/physics/index.d.ts.map +1 -1
  221. package/dist/graph/physics/index.js +1 -0
  222. package/dist/graph/physics/index.js.map +1 -1
  223. package/dist/graph/physics/physics-controller-geometry.cjs +21 -0
  224. package/dist/graph/physics/physics-controller-geometry.d.ts +8 -1
  225. package/dist/graph/physics/physics-controller-geometry.d.ts.map +1 -1
  226. package/dist/graph/physics/physics-controller-geometry.js +22 -0
  227. package/dist/graph/physics/physics-controller-geometry.js.map +1 -1
  228. package/dist/graph/physics/scenegraph-session.d.ts +1 -1
  229. package/dist/graph/physics/scenegraph-session.d.ts.map +1 -1
  230. package/dist/graph/tables/index.cjs.map +2 -2
  231. package/dist/index.cjs +16 -0
  232. package/dist/index.cjs.map +3 -3
  233. package/dist/index.d.ts +6 -0
  234. package/dist/index.d.ts.map +1 -1
  235. package/dist/index.js +4 -0
  236. package/dist/index.js.map +1 -1
  237. package/dist/lighting/ambient-occlusion-pass.cjs +47 -28
  238. package/dist/lighting/ambient-occlusion-pass.d.ts +12 -0
  239. package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -1
  240. package/dist/lighting/ambient-occlusion-pass.js +45 -26
  241. package/dist/lighting/ambient-occlusion-pass.js.map +1 -1
  242. package/dist/lighting/clustered-light-grid.cjs +71 -20
  243. package/dist/lighting/clustered-light-grid.d.ts +37 -0
  244. package/dist/lighting/clustered-light-grid.d.ts.map +1 -1
  245. package/dist/lighting/clustered-light-grid.js +68 -18
  246. package/dist/lighting/clustered-light-grid.js.map +1 -1
  247. package/dist/lighting/contact-shadow-composite.cjs +72 -51
  248. package/dist/lighting/contact-shadow-composite.d.ts +274 -3
  249. package/dist/lighting/contact-shadow-composite.d.ts.map +1 -1
  250. package/dist/lighting/contact-shadow-composite.js +72 -50
  251. package/dist/lighting/contact-shadow-composite.js.map +1 -1
  252. package/dist/lighting/contact-shadow-pass.cjs +50 -39
  253. package/dist/lighting/contact-shadow-pass.d.ts +8 -0
  254. package/dist/lighting/contact-shadow-pass.d.ts.map +1 -1
  255. package/dist/lighting/contact-shadow-pass.js +47 -37
  256. package/dist/lighting/contact-shadow-pass.js.map +1 -1
  257. package/dist/lighting/cortao/cortao-occluder-lookup-table.cjs +96 -0
  258. package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts +41 -0
  259. package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts.map +1 -0
  260. package/dist/lighting/cortao/cortao-occluder-lookup-table.js +94 -0
  261. package/dist/lighting/cortao/cortao-occluder-lookup-table.js.map +1 -0
  262. package/dist/lighting/cortao/cortao-parameters.cjs +127 -0
  263. package/dist/lighting/cortao/cortao-parameters.d.ts +95 -0
  264. package/dist/lighting/cortao/cortao-parameters.d.ts.map +1 -0
  265. package/dist/lighting/cortao/cortao-parameters.js +122 -0
  266. package/dist/lighting/cortao/cortao-parameters.js.map +1 -0
  267. package/dist/lighting/cortao/cortao-pass.cjs +100 -0
  268. package/dist/lighting/cortao/cortao-pass.d.ts +33 -0
  269. package/dist/lighting/cortao/cortao-pass.d.ts.map +1 -0
  270. package/dist/lighting/cortao/cortao-pass.js +84 -0
  271. package/dist/lighting/cortao/cortao-pass.js.map +1 -0
  272. package/dist/lighting/cortao/cortao-passes.cjs +42 -0
  273. package/dist/lighting/cortao/cortao-passes.d.ts +38 -0
  274. package/dist/lighting/cortao/cortao-passes.d.ts.map +1 -0
  275. package/dist/lighting/cortao/cortao-passes.js +19 -0
  276. package/dist/lighting/cortao/cortao-passes.js.map +1 -0
  277. package/dist/lighting/cortao/cortao-shaders-wgsl.cjs +606 -0
  278. package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts +49 -0
  279. package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts.map +1 -0
  280. package/dist/lighting/cortao/cortao-shaders-wgsl.js +610 -0
  281. package/dist/lighting/cortao/cortao-shaders-wgsl.js.map +1 -0
  282. package/dist/lighting/cortao/cortao-shaders.cjs +667 -0
  283. package/dist/lighting/cortao/cortao-shaders.d.ts +118 -0
  284. package/dist/lighting/cortao/cortao-shaders.d.ts.map +1 -0
  285. package/dist/lighting/cortao/cortao-shaders.js +657 -0
  286. package/dist/lighting/cortao/cortao-shaders.js.map +1 -0
  287. package/dist/lighting/cortao/cortao-upsample.cjs +191 -0
  288. package/dist/lighting/cortao/cortao-upsample.d.ts +16 -0
  289. package/dist/lighting/cortao/cortao-upsample.d.ts.map +1 -0
  290. package/dist/lighting/cortao/cortao-upsample.js +159 -0
  291. package/dist/lighting/cortao/cortao-upsample.js.map +1 -0
  292. package/dist/lighting/cortao/cortao-webgl-passes.cjs +229 -0
  293. package/dist/lighting/cortao/cortao-webgl-passes.d.ts +28 -0
  294. package/dist/lighting/cortao/cortao-webgl-passes.d.ts.map +1 -0
  295. package/dist/lighting/cortao/cortao-webgl-passes.js +212 -0
  296. package/dist/lighting/cortao/cortao-webgl-passes.js.map +1 -0
  297. package/dist/lighting/cortao/cortao-webgpu-passes.cjs +348 -0
  298. package/dist/lighting/cortao/cortao-webgpu-passes.d.ts +31 -0
  299. package/dist/lighting/cortao/cortao-webgpu-passes.d.ts.map +1 -0
  300. package/dist/lighting/cortao/cortao-webgpu-passes.js +335 -0
  301. package/dist/lighting/cortao/cortao-webgpu-passes.js.map +1 -0
  302. package/dist/lighting/index.cjs +13 -2
  303. package/dist/lighting/index.cjs.map +3 -3
  304. package/dist/lighting/index.d.ts +11 -6
  305. package/dist/lighting/index.d.ts.map +1 -1
  306. package/dist/lighting/index.js +6 -5
  307. package/dist/lighting/index.js.map +1 -1
  308. package/dist/lighting/shadow-map-renderer.cjs +40 -37
  309. package/dist/lighting/shadow-map-renderer.d.ts +15 -0
  310. package/dist/lighting/shadow-map-renderer.d.ts.map +1 -1
  311. package/dist/lighting/shadow-map-renderer.js +37 -35
  312. package/dist/lighting/shadow-map-renderer.js.map +1 -1
  313. package/dist/model/gpu-vector-model.cjs +39 -16
  314. package/dist/model/gpu-vector-model.d.ts +8 -0
  315. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  316. package/dist/model/gpu-vector-model.js +46 -18
  317. package/dist/model/gpu-vector-model.js.map +1 -1
  318. package/dist/passes/effect-renderer.cjs +155 -0
  319. package/dist/passes/effect-renderer.d.ts +158 -0
  320. package/dist/passes/effect-renderer.d.ts.map +1 -0
  321. package/dist/passes/effect-renderer.js +143 -0
  322. package/dist/passes/effect-renderer.js.map +1 -0
  323. package/dist/passes/scene-capture-pass.cjs +42 -0
  324. package/dist/passes/scene-capture-pass.d.ts +29 -0
  325. package/dist/passes/scene-capture-pass.d.ts.map +1 -0
  326. package/dist/passes/scene-capture-pass.js +21 -0
  327. package/dist/passes/scene-capture-pass.js.map +1 -0
  328. package/dist/passes/shader-pass-renderer.cjs +94 -68
  329. package/dist/passes/shader-pass-renderer.d.ts +32 -15
  330. package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
  331. package/dist/passes/shader-pass-renderer.js +104 -76
  332. package/dist/passes/shader-pass-renderer.js.map +1 -1
  333. package/dist/scenegraph/model-node.cjs +2 -0
  334. package/dist/scenegraph/model-node.d.ts +4 -0
  335. package/dist/scenegraph/model-node.d.ts.map +1 -1
  336. package/dist/scenegraph/model-node.js +2 -0
  337. package/dist/scenegraph/model-node.js.map +1 -1
  338. package/dist/splats/gpu-paged-splat-renderer.cjs +52 -8
  339. package/dist/splats/gpu-paged-splat-renderer.d.ts +16 -3
  340. package/dist/splats/gpu-paged-splat-renderer.d.ts.map +1 -1
  341. package/dist/splats/gpu-paged-splat-renderer.js +55 -9
  342. package/dist/splats/gpu-paged-splat-renderer.js.map +1 -1
  343. package/dist/splats/gpu-paged-splat-shaders.cjs +3 -1
  344. package/dist/splats/gpu-paged-splat-shaders.d.ts.map +1 -1
  345. package/dist/splats/gpu-paged-splat-shaders.js +3 -1
  346. package/dist/splats/gpu-paged-splat-shaders.js.map +1 -1
  347. package/dist/splats/index.cjs.map +2 -2
  348. package/dist/text/fonts/atlas/browser-font-atlas.cjs +10 -1
  349. package/dist/text/fonts/atlas/browser-font-atlas.d.ts +3 -1
  350. package/dist/text/fonts/atlas/browser-font-atlas.d.ts.map +1 -1
  351. package/dist/text/fonts/atlas/browser-font-atlas.js +10 -2
  352. package/dist/text/fonts/atlas/browser-font-atlas.js.map +1 -1
  353. package/dist/text/fonts/atlas/lru-cache.cjs +4 -0
  354. package/dist/text/fonts/atlas/lru-cache.d.ts +3 -1
  355. package/dist/text/fonts/atlas/lru-cache.d.ts.map +1 -1
  356. package/dist/text/fonts/atlas/lru-cache.js +4 -0
  357. package/dist/text/fonts/atlas/lru-cache.js.map +1 -1
  358. package/dist/text/fonts/index.cjs +2 -0
  359. package/dist/text/fonts/index.cjs.map +1 -1
  360. package/dist/text/fonts/index.d.ts +1 -1
  361. package/dist/text/fonts/index.d.ts.map +1 -1
  362. package/dist/text/fonts/index.js +1 -1
  363. package/dist/text/fonts/index.js.map +1 -1
  364. package/dist/text/index.cjs.map +1 -1
  365. package/package.json +8 -8
  366. package/src/animation/animation-track.ts +5 -0
  367. package/src/animation/node-animation-binding.ts +9 -8
  368. package/src/animation/scenegraph-gpu-animation-layout.ts +195 -0
  369. package/src/animation/scenegraph-gpu-animation.ts +340 -0
  370. package/src/arrow/arrow-picking.ts +23 -11
  371. package/src/effects/README.md +38 -14
  372. package/src/effects/glfx-effects.ts +227 -0
  373. package/src/effects/graph/gpu-effect-operation.ts +601 -0
  374. package/src/effects/graph/temporal-graph-history.ts +46 -0
  375. package/src/effects/index.ts +81 -19
  376. package/src/effects/passes/postprocessing/fxaa/fxaa.ts +8 -0
  377. package/src/effects/passes/postprocessing/image-adjust-filters/tone-mapping.ts +8 -0
  378. package/src/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.ts +219 -19
  379. package/src/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.ts +6 -6
  380. package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +45 -45
  381. package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +88 -68
  382. package/src/effects/passes/screen-space/copy-pass.ts +4 -0
  383. package/src/effects/passes/screen-space/depth-aware-blur.ts +13 -3
  384. package/src/effects/passes/screen-space/dof.ts +20 -3
  385. package/src/effects/passes/screen-space/gtao.ts +91 -65
  386. package/src/effects/passes/screen-space/hdr-auto-exposure.ts +109 -84
  387. package/src/effects/passes/screen-space/height-fog.ts +18 -3
  388. package/src/effects/passes/screen-space/motion-blur.ts +8 -7
  389. package/src/effects/passes/screen-space/outlines.ts +143 -17
  390. package/src/effects/passes/screen-space/screen-space-global-illumination.ts +75 -64
  391. package/src/effects/passes/screen-space/screen-space-reflections.ts +158 -95
  392. package/src/effects/passes/screen-space/selection-outline.ts +11 -0
  393. package/src/effects/passes/screen-space/ssao.ts +76 -45
  394. package/src/effects/passes/screen-space/temporal-antialiasing.ts +43 -33
  395. package/src/effects/passes/screen-space/temporal-frame.ts +33 -0
  396. package/src/effects/passes/screen-space/volumetric-fog.ts +30 -24
  397. package/src/effects/temporal-upscale/index.ts +20 -0
  398. package/src/effects/temporal-upscale/temporal-math.ts +308 -0
  399. package/src/effects/temporal-upscale/temporal-upscale-shaders.ts +326 -0
  400. package/src/effects/temporal-upscale/temporal-upscaler.ts +538 -0
  401. package/src/gltf/gltf/create-gltf-model.ts +59 -90
  402. package/src/gltf/gltf/create-scenegraph-from-gltf.ts +71 -5
  403. package/src/gltf/gltf/gltf-animated-crowd.ts +30 -177
  404. package/src/gltf/gltf/gltf-animation-nodes.ts +82 -0
  405. package/src/gltf/gltf/gltf-animator.ts +15 -4
  406. package/src/gltf/gltf/gltf-gpu-animation-controller.ts +88 -0
  407. package/src/gltf/gltf/gltf-gpu-animation.ts +53 -60
  408. package/src/gltf/index.ts +5 -0
  409. package/src/gltf/parsers/parse-gltf.ts +12 -2
  410. package/src/graph/physics/index.ts +4 -0
  411. package/src/graph/physics/physics-controller-geometry.ts +33 -1
  412. package/src/index.ts +25 -0
  413. package/src/lighting/ambient-occlusion-pass.ts +62 -28
  414. package/src/lighting/clustered-light-grid.ts +87 -30
  415. package/src/lighting/contact-shadow-composite.ts +80 -52
  416. package/src/lighting/contact-shadow-pass.ts +59 -39
  417. package/src/lighting/cortao/cortao-occluder-lookup-table.ts +138 -0
  418. package/src/lighting/cortao/cortao-parameters.ts +218 -0
  419. package/src/lighting/cortao/cortao-pass.ts +136 -0
  420. package/src/lighting/cortao/cortao-passes.ts +50 -0
  421. package/src/lighting/cortao/cortao-shaders-wgsl.ts +633 -0
  422. package/src/lighting/cortao/cortao-shaders.ts +674 -0
  423. package/src/lighting/cortao/cortao-upsample.ts +177 -0
  424. package/src/lighting/cortao/cortao-webgl-passes.ts +284 -0
  425. package/src/lighting/cortao/cortao-webgpu-passes.ts +430 -0
  426. package/src/lighting/index.ts +12 -3
  427. package/src/lighting/shadow-map-renderer.ts +57 -43
  428. package/src/model/gpu-vector-model.ts +47 -18
  429. package/src/passes/effect-renderer.ts +332 -0
  430. package/src/passes/scene-capture-pass.ts +51 -0
  431. package/src/passes/shader-pass-renderer.ts +164 -115
  432. package/src/scenegraph/model-node.ts +5 -0
  433. package/src/splats/gpu-paged-splat-renderer.ts +77 -9
  434. package/src/splats/gpu-paged-splat-shaders.ts +7 -1
  435. package/src/text/fonts/atlas/browser-font-atlas.ts +12 -2
  436. package/src/text/fonts/atlas/lru-cache.ts +6 -1
  437. package/src/text/fonts/index.ts +1 -0
@@ -0,0 +1,667 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var cortao_shaders_exports = {};
19
+ __export(cortao_shaders_exports, {
20
+ CORTAO_FILTER_PASS_FS: () => CORTAO_FILTER_PASS_FS,
21
+ CORTAO_MAIN_PASS_FS: () => CORTAO_MAIN_PASS_FS,
22
+ CORTAO_MIPMAP_FS: () => CORTAO_MIPMAP_FS,
23
+ CORTAO_PACKED_NORMAL_BITS: () => CORTAO_PACKED_NORMAL_BITS,
24
+ CORTAO_PREPASS_FS: () => CORTAO_PREPASS_FS,
25
+ cortaoBase: () => cortaoBase,
26
+ cortaoFilter: () => cortaoFilter,
27
+ cortaoMain: () => cortaoMain,
28
+ cortaoMipmap: () => cortaoMipmap,
29
+ cortaoPrepass: () => cortaoPrepass
30
+ });
31
+ module.exports = __toCommonJS(cortao_shaders_exports);
32
+ const CORTAO_PACKED_NORMAL_BITS = 10;
33
+ const cortaoBase = {
34
+ name: "cortaoBase",
35
+ fs: (
36
+ /* glsl */
37
+ `precision highp int;
38
+ precision highp usampler2D;
39
+ precision highp usampler3D;
40
+ precision highp sampler2D;
41
+
42
+ #define CORTAO_PACKED_NORMAL_BITS ${CORTAO_PACKED_NORMAL_BITS}
43
+
44
+ const float CORTAO_PI2 = 6.283185307179586;
45
+ const float CORTAO_GOLDEN_ANGLE = 2.3999632297286535;
46
+
47
+ uint cortao_seed(uvec2 coords) {
48
+ // 1719413 * 929 and 140473 * 2467 * 11.
49
+ uvec2 q = coords * uvec2(1597334677u, 3812015801u);
50
+ return q.x ^ q.y;
51
+ }
52
+
53
+ uint cortao_hash(uint n) {
54
+ return n * (n ^ (n >> 15u));
55
+ }
56
+
57
+ uvec2 cortao_hash(uvec2 n) {
58
+ return n * (n ^ (n >> 15u));
59
+ }
60
+
61
+ uvec2 cortao_unpack16(uint x) {
62
+ return uvec2(x & 0xFFFFu, x >> 16u);
63
+ }
64
+
65
+ uint cortao_bitCount(uint value) {
66
+ value = value - ((value >> 1u) & 0x55555555u);
67
+ value = (value & 0x33333333u) + ((value >> 2u) & 0x33333333u);
68
+ return (((value + (value >> 4u)) & 0x0F0F0F0Fu) * 0x01010101u) >> 24u;
69
+ }
70
+
71
+ uint cortao_encodeNormal(vec3 normal, vec2 dither) {
72
+ uint bitsPerComponent = uint(CORTAO_PACKED_NORMAL_BITS / 2);
73
+ uint componentMask = (1u << bitsPerComponent) - 1u;
74
+ uint componentMax = componentMask >> 1u;
75
+ vec2 encodedNormal = normal.xy * inversesqrt(normal.z * 2.0 + 2.0);
76
+ ivec2 values = ivec2(floor(encodedNormal * float(componentMax) + dither));
77
+ return (uint(values.x) & componentMask) | ((uint(values.y) & componentMask) << bitsPerComponent);
78
+ }
79
+
80
+ vec3 cortao_decodeNormal(uint packedData) {
81
+ int bitsPerComponent = CORTAO_PACKED_NORMAL_BITS / 2;
82
+ int componentMax = ((1 << bitsPerComponent) - 1) >> 1;
83
+ ivec2 leftShift = ivec2(32 - bitsPerComponent, 32 - bitsPerComponent * 2);
84
+ ivec2 values = (ivec2(int(packedData)) << leftShift) >> ivec2(32 - bitsPerComponent);
85
+ vec2 e = vec2(values) * (1.0 / float(componentMax));
86
+ float z = max(1.0 - e.x * e.x - e.y * e.y, 0.0);
87
+ return vec3(e * (2.0 * sqrt(z)), z * 2.0 - 1.0);
88
+ }
89
+
90
+ float cortao_unpackDepth(uint packedData) {
91
+ return uintBitsToFloat(packedData);
92
+ }
93
+
94
+ vec3 cortao_unprojectWithOffset(vec4 unprojectParameters, vec2 texCoords, float linearDepth, vec3 offset) {
95
+ vec2 direction = texCoords * unprojectParameters.xy + unprojectParameters.zw;
96
+ return vec3(direction, -1.0) * linearDepth + offset;
97
+ }
98
+
99
+ vec3 cortao_unproject(vec4 unprojectParameters, vec2 texCoords, float linearDepth) {
100
+ return cortao_unprojectWithOffset(unprojectParameters, texCoords, linearDepth, vec3(0.0));
101
+ }
102
+ `
103
+ )
104
+ };
105
+ const cortaoPrepass = {
106
+ name: "cortaoPrepass",
107
+ dependencies: [cortaoBase],
108
+ fs: (
109
+ /* glsl */
110
+ `layout(std140) uniform cortaoPrepassUniforms {
111
+ vec4 unprojectParams;
112
+ vec2 resolution;
113
+ float depthScale;
114
+ float depthOffset;
115
+ uint randomSeed;
116
+ } cortaoPrepass;
117
+ `
118
+ ),
119
+ uniformTypes: {
120
+ unprojectParams: "vec4<f32>",
121
+ resolution: "vec2<f32>",
122
+ depthScale: "f32",
123
+ depthOffset: "f32",
124
+ randomSeed: "u32"
125
+ }
126
+ };
127
+ const CORTAO_PREPASS_FS = (
128
+ /* glsl */
129
+ `#version 300 es
130
+ uniform highp sampler2D depthTexture;
131
+
132
+ layout(location = 0) out uvec4 packedOutput;
133
+ layout(location = 1) out vec4 normalOutput;
134
+
135
+ float cortao_skyDepth() {
136
+ // Handles both standard and reverse depth.
137
+ return cortaoPrepass.depthScale < 0.0 ? 1.0 : 0.0;
138
+ }
139
+
140
+ bool cortao_loadPosition(ivec2 pixel, out vec3 position) {
141
+ ivec2 size = ivec2(cortaoPrepass.resolution);
142
+ if (any(lessThan(pixel, ivec2(0))) || any(greaterThanEqual(pixel, size))) {
143
+ return false;
144
+ }
145
+ #if CORTAO_SCALED_DEPTH
146
+ ivec2 depthSize = textureSize(depthTexture, 0);
147
+ ivec2 depthPixel = ivec2((vec2(pixel) + 0.5) * (vec2(depthSize) / vec2(size)));
148
+ #else
149
+ ivec2 depthSize = size;
150
+ ivec2 depthPixel = pixel;
151
+ #endif
152
+ float depth = texelFetch(depthTexture, depthPixel, 0).r;
153
+ if (depth == cortao_skyDepth()) {
154
+ return false;
155
+ }
156
+ float linearDepth = 1.0 / (depth * cortaoPrepass.depthScale + cortaoPrepass.depthOffset);
157
+ vec2 texCoords = (vec2(depthPixel) + 0.5) / vec2(depthSize);
158
+ position = cortao_unproject(cortaoPrepass.unprojectParams, texCoords, linearDepth);
159
+ return true;
160
+ }
161
+
162
+ // Picks the neighbor difference along one axis with the smaller depth step. This keeps the
163
+ // normal of a surface intact at the silhouette of a nearer or farther surface.
164
+ bool cortao_getTangent(ivec2 pixel, ivec2 axis, vec3 position, out vec3 tangent) {
165
+ vec3 forwardPosition;
166
+ vec3 backwardPosition;
167
+ bool hasForward = cortao_loadPosition(pixel + axis, forwardPosition);
168
+ bool hasBackward = cortao_loadPosition(pixel - axis, backwardPosition);
169
+ vec3 forward = forwardPosition - position;
170
+ vec3 backward = position - backwardPosition;
171
+ if (hasForward && hasBackward) {
172
+ tangent = abs(forward.z) < abs(backward.z) ? forward : backward;
173
+ return true;
174
+ }
175
+ if (hasForward) {
176
+ tangent = forward;
177
+ return true;
178
+ }
179
+ if (hasBackward) {
180
+ tangent = backward;
181
+ return true;
182
+ }
183
+ return false;
184
+ }
185
+
186
+ void main(void) {
187
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
188
+ vec3 position;
189
+ if (!cortao_loadPosition(pixel, position)) {
190
+ packedOutput = uvec4(0u);
191
+ normalOutput = vec4(0.5, 0.5, 1.0, 1.0);
192
+ return;
193
+ }
194
+ float linearDepth = -position.z;
195
+
196
+ vec3 normal = normalize(-position);
197
+ vec3 tangentX;
198
+ vec3 tangentY;
199
+ if (cortao_getTangent(pixel, ivec2(1, 0), position, tangentX) &&
200
+ cortao_getTangent(pixel, ivec2(0, 1), position, tangentY)) {
201
+ vec3 crossProduct = cross(tangentX, tangentY);
202
+ if (dot(crossProduct, crossProduct) > 0.0) {
203
+ normal = normalize(crossProduct);
204
+ }
205
+ }
206
+ // A visible surface faces the camera.
207
+ if (dot(normal, position) > 0.0) {
208
+ normal = -normal;
209
+ }
210
+
211
+ // Pack a sphere-map encoded normal into the low bits of the linear depth.
212
+ uint seed = cortao_hash(cortao_seed(uvec2(pixel)) + cortaoPrepass.randomSeed);
213
+ vec2 dither = vec2(cortao_unpack16(seed)) * (1.0 / 65535.0);
214
+ uint mask = (1u << uint(CORTAO_PACKED_NORMAL_BITS)) - 1u;
215
+ uint packedNormal = cortao_encodeNormal(normal, dither);
216
+ packedOutput = uvec4((floatBitsToUint(linearDepth) & ~mask) | (packedNormal & mask), 0u, 0u, 0u);
217
+ normalOutput = vec4(normal * 0.5 + 0.5, 1.0);
218
+ }
219
+ `
220
+ );
221
+ const cortaoMipmap = {
222
+ name: "cortaoMipmap",
223
+ dependencies: [cortaoBase],
224
+ fs: (
225
+ /* glsl */
226
+ `layout(std140) uniform cortaoMipmapUniforms {
227
+ vec2 resolution;
228
+ int mipCount;
229
+ uint randomSeed;
230
+ } cortaoMipmap;
231
+ `
232
+ ),
233
+ uniformTypes: {
234
+ resolution: "vec2<f32>",
235
+ mipCount: "i32",
236
+ randomSeed: "u32"
237
+ }
238
+ };
239
+ const CORTAO_MIPMAP_FS = (
240
+ /* glsl */
241
+ `#version 300 es
242
+ uniform highp usampler2D packedLevel0Texture;
243
+
244
+ layout(location = 0) out uvec4 packedOutput;
245
+
246
+ void main(void) {
247
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
248
+ ivec2 size = ivec2(cortaoMipmap.resolution);
249
+ int level = -1;
250
+ ivec2 local = ivec2(0);
251
+ if (pixel.x < size.x) {
252
+ level = 0;
253
+ local = pixel;
254
+ } else {
255
+ int x = pixel.x - size.x;
256
+ for (int k = 1; k < 8; k++) {
257
+ if (k >= cortaoMipmap.mipCount) {
258
+ break;
259
+ }
260
+ ivec2 levelSize = max(size >> k, ivec2(1));
261
+ int yOffset = size.y - (size.y >> (k - 1));
262
+ if (x < levelSize.x && pixel.y >= yOffset && pixel.y < yOffset + levelSize.y) {
263
+ level = k;
264
+ local = ivec2(x, pixel.y - yOffset);
265
+ break;
266
+ }
267
+ }
268
+ }
269
+ if (level < 0) {
270
+ packedOutput = uvec4(0u);
271
+ return;
272
+ }
273
+
274
+ uvec2 coords = uvec2(local);
275
+ for (int k = 7; k >= 1; k--) {
276
+ if (k > level) {
277
+ continue;
278
+ }
279
+ // The child that cortao_prepass() does not reject as "wrongPixel" at this level.
280
+ uvec2 dither = uvec2(cortaoMipmap.randomSeed) >> uvec2(uint(k * 2), uint(k * 2 + 1));
281
+ coords = coords * 2u + uvec2((coords.y ^ dither.x) & 1u, (coords.x ^ dither.y) & 1u);
282
+ coords = min(coords, uvec2(max(size >> (k - 1), ivec2(1)) - 1));
283
+ }
284
+ packedOutput = uvec4(texelFetch(packedLevel0Texture, ivec2(coords), 0).r, 0u, 0u, 0u);
285
+ }
286
+ `
287
+ );
288
+ const cortaoMain = {
289
+ name: "cortaoMain",
290
+ dependencies: [cortaoBase],
291
+ fs: (
292
+ /* glsl */
293
+ `layout(std140) uniform cortaoMainUniforms {
294
+ vec4 unprojectParams;
295
+ vec4 projectionParams;
296
+ vec2 resolution;
297
+ float normalBias;
298
+ float radius;
299
+ float maxApparentCircleRadiusCoefficient;
300
+ float mipBias;
301
+ float inverseMaxSlopeCompensation;
302
+ float backfaceThreshold;
303
+ float backfaceBoost;
304
+ float intensity;
305
+ int mipCount;
306
+ uint randomSeed;
307
+ } cortaoMain;
308
+ `
309
+ ),
310
+ uniformTypes: {
311
+ unprojectParams: "vec4<f32>",
312
+ projectionParams: "vec4<f32>",
313
+ resolution: "vec2<f32>",
314
+ normalBias: "f32",
315
+ radius: "f32",
316
+ maxApparentCircleRadiusCoefficient: "f32",
317
+ mipBias: "f32",
318
+ inverseMaxSlopeCompensation: "f32",
319
+ backfaceThreshold: "f32",
320
+ backfaceBoost: "f32",
321
+ intensity: "f32",
322
+ mipCount: "i32",
323
+ randomSeed: "u32"
324
+ }
325
+ };
326
+ const CORTAO_MAIN_PASS_FS = (
327
+ /* glsl */
328
+ `#version 300 es
329
+ uniform highp usampler2D packedDataTexture;
330
+ uniform highp sampler2D normalTexture;
331
+ uniform highp usampler3D occluderLookupTable;
332
+
333
+ layout(location = 0) out vec4 occlusionOutput;
334
+
335
+ // Nearest-mip sample of the packed data with a border value of 0.
336
+ uint cortao_samplePackedData(vec2 texCoords, float mipmap) {
337
+ if (any(lessThan(texCoords, vec2(0.0))) || any(greaterThanEqual(texCoords, vec2(1.0)))) {
338
+ return 0u;
339
+ }
340
+ int level = clamp(int(floor(mipmap + 0.5)), 0, cortaoMain.mipCount - 1);
341
+ ivec2 size = ivec2(cortaoMain.resolution);
342
+ ivec2 levelSize = max(size >> level, ivec2(1));
343
+ ivec2 texel = min(ivec2(texCoords * vec2(levelSize)), levelSize - 1);
344
+ ivec2 offset = level == 0 ? ivec2(0) : ivec2(size.x, size.y - (size.y >> (level - 1)));
345
+ return texelFetch(packedDataTexture, offset + texel, 0).r;
346
+ }
347
+
348
+ vec3 cortao_loadNormal(ivec2 pixelCoords) {
349
+ return normalize(texelFetch(normalTexture, pixelCoords, 0).xyz * 2.0 - 1.0);
350
+ }
351
+
352
+ // Nearest sample with clamp-to-edge.
353
+ uint cortao_sampleOccluderLookupTable(vec3 texCoords) {
354
+ ivec3 size = ivec3(
355
+ CORTAO_LOOKUP_DIRECTION_RESOLUTION, CORTAO_LOOKUP_DIRECTION_RESOLUTION, CORTAO_LOOKUP_RADIUS_RESOLUTION
356
+ );
357
+ ivec3 texel = clamp(ivec3(floor(texCoords * vec3(size))), ivec3(0), size - 1);
358
+ return texelFetch(occluderLookupTable, texel, 0).r;
359
+ }
360
+
361
+ uint cortao_computeRayOcclusion(
362
+ float offsetDither,
363
+ mat3 offsetTransform,
364
+ mat3 tangentSpaceTransform,
365
+ float mipBias,
366
+ vec3 viewPosition,
367
+ vec3 normal,
368
+ vec3 viewDirection,
369
+ float maxRadius
370
+ ) {
371
+ uint rayBits = 0u;
372
+ for (int i = 0; i < CORTAO_SAMPLE_COUNT; i++) {
373
+ // Golden-angle spiral direction.
374
+ float a = float(i) * CORTAO_GOLDEN_ANGLE;
375
+ vec2 spiral = vec2(cos(a), sin(a));
376
+ float inverseSampleCount = 1.0 / float(CORTAO_SAMPLE_COUNT);
377
+
378
+ // The skew pulls the sample distribution toward the center.
379
+ float skew = 3.5;
380
+ float innerRadius = pow(float(i) * inverseSampleCount, skew * 0.5);
381
+ float outerRadius = pow((float(i) + 1.0) * inverseSampleCount, skew * 0.5);
382
+ vec2 innerSpiral = spiral * innerRadius;
383
+ vec2 outerSpiral = spiral * outerRadius;
384
+
385
+ // The weight is the square root of the area of the strip that the sample can move over.
386
+ float sampleArea = outerRadius * outerRadius - innerRadius * innerRadius;
387
+ float sampleWeight = sqrt(sampleArea);
388
+ float sampleMipmap = log2(outerRadius);
389
+
390
+ vec2 sampleOffset = (outerSpiral - innerSpiral) * offsetDither + innerSpiral;
391
+ vec3 projectedCoords = offsetTransform * vec3(sampleOffset, 1.0);
392
+ vec2 sampleCoords = projectedCoords.xy / projectedCoords.z;
393
+
394
+ float mipmap = mipBias + sampleMipmap;
395
+ uint packedData = cortao_samplePackedData(sampleCoords, mipmap);
396
+ float sampleDepth = cortao_unpackDepth(packedData);
397
+
398
+ vec3 dPos = cortao_unprojectWithOffset(cortaoMain.unprojectParams, sampleCoords, sampleDepth, -viewPosition);
399
+
400
+ // Sky samples and samples outside the screen have a depth of 0, which is outside the hemisphere.
401
+ float lengthSquared = dot(dPos, dPos);
402
+ if (lengthSquared < maxRadius * maxRadius && dot(dPos, normal) > 0.0) {
403
+ float inverseLength = inversesqrt(lengthSquared);
404
+ vec3 direction = dPos * inverseLength;
405
+ vec3 sampleNormal = cortao_decodeNormal(packedData);
406
+
407
+ float slopeCompensation = inversesqrt(max(dot(sampleNormal, viewDirection), cortaoMain.inverseMaxSlopeCompensation));
408
+ float occluderRadius = (maxRadius * sampleWeight) * (slopeCompensation * inverseLength);
409
+
410
+ float sampleDot = dot(sampleNormal, direction);
411
+ if (sampleDot < cortaoMain.backfaceThreshold) {
412
+ // Front face: move the occluder by one radius into the object to prevent self-occlusion.
413
+ float adjustedOffset = -occluderRadius / max(1.0 - occluderRadius * occluderRadius * 0.5, 0.000001);
414
+ direction = normalize(sampleNormal * adjustedOffset + direction);
415
+ } else {
416
+ // Back face: optionally enlarge the occluder to prevent light leaks.
417
+ occluderRadius *= mix(1.0, slopeCompensation, cortaoMain.backfaceBoost);
418
+ }
419
+
420
+ vec3 hemisphereDirection = direction * tangentSpaceTransform;
421
+
422
+ // Sphere-map encode the direction to get the lookup coordinates.
423
+ float scale = inversesqrt(hemisphereDirection.z * 8.0 + 8.0);
424
+ vec2 sphereMapCoordinates = hemisphereDirection.xy * scale + 0.5;
425
+ vec3 lookupCoords = vec3(sphereMapCoordinates, occluderRadius * sqrt(0.5));
426
+ // The sphere-map projection fails for (0, 0, -1). Ignore that sample.
427
+ uint occluderRayBits = hemisphereDirection.z > -0.99 ? cortao_sampleOccluderLookupTable(lookupCoords) : 0u;
428
+ rayBits |= occluderRayBits;
429
+ }
430
+ }
431
+ return rayBits;
432
+ }
433
+
434
+ // Frisvad's orthonormal basis.
435
+ void cortao_constructBasis(vec3 normal, out vec3 tangent, out vec3 bitangent) {
436
+ float a = 1.0 / max(1.0 + normal.z, 0.000001);
437
+ float b = normal.x * normal.y * a;
438
+ tangent = vec3(normal.x * normal.x * a - 1.0, b, normal.x);
439
+ bitangent = vec3(b, normal.y * normal.y * a - 1.0, normal.y);
440
+ }
441
+
442
+ void main(void) {
443
+ ivec2 pixelCoords = ivec2(gl_FragCoord.xy);
444
+ vec2 texCoords = (vec2(pixelCoords) + 0.5) / cortaoMain.resolution;
445
+
446
+ float linearDepth = cortao_unpackDepth(texelFetch(packedDataTexture, pixelCoords, 0).r);
447
+ if (linearDepth == 0.0) {
448
+ // Sky pixel.
449
+ occlusionOutput = vec4(1.0);
450
+ return;
451
+ }
452
+
453
+ vec3 normal = cortao_loadNormal(pixelCoords);
454
+ vec3 viewPosition = cortao_unproject(cortaoMain.unprojectParams, texCoords, linearDepth);
455
+
456
+ uvec2 random = cortao_hash(cortao_seed(uvec2(pixelCoords)) + cortao_unpack16(cortaoMain.randomSeed));
457
+ float randomSampleRotation = float(random.x) * (CORTAO_PI2 / 4294967295.0);
458
+ float offsetDither = float(random.y) * (1.0 / 4294967295.0);
459
+ float randomTangentRotation = float(random.x ^ random.y ^ cortaoMain.randomSeed) * (CORTAO_PI2 / 4294967295.0);
460
+ vec2 sampleRotation = vec2(sin(randomSampleRotation), cos(randomSampleRotation));
461
+
462
+ // The radius is the world-space radius, clamped by the maximum screen-space radius.
463
+ float clampedRadius = min(cortaoMain.radius, linearDepth * cortaoMain.maxApparentCircleRadiusCoefficient);
464
+
465
+ // Near the sampling sphere, the sphere looks larger due to the horizon. Expand the circle.
466
+ float inverseCircleDistance = inversesqrt(linearDepth * linearDepth - clampedRadius * clampedRadius);
467
+ float apparentCircleRadius = clampedRadius * inverseCircleDistance;
468
+ float circleRadius = apparentCircleRadius * linearDepth;
469
+
470
+ vec3 viewDirection = -normalize(viewPosition);
471
+
472
+ // The sample pattern stretches near the screen edge. Increase the mip bias to compensate.
473
+ float stretchMultiplier = inversesqrt(viewDirection.z);
474
+ float baseMipBias = log2(apparentCircleRadius * stretchMultiplier) + cortaoMain.mipBias;
475
+
476
+ // Push the center out along the normal to prevent self-shadowing.
477
+ float pixelSize = cortaoMain.normalBias * linearDepth;
478
+ viewPosition = normal * pixelSize + viewPosition;
479
+
480
+ vec2 scaledRotation = sampleRotation * circleRadius;
481
+ mat3 rotationScaleMatrix = mat3(
482
+ scaledRotation.x, -scaledRotation.y, 0.0,
483
+ scaledRotation.y, scaledRotation.x, 0.0,
484
+ 0.0, 0.0, 1.0
485
+ );
486
+
487
+ vec3 right;
488
+ vec3 up;
489
+ cortao_constructBasis(viewDirection, right, up);
490
+ // Randomly switch between a clockwise and a counter-clockwise spiral.
491
+ if ((random.x & 1u) == 0u) {
492
+ right = -right;
493
+ }
494
+ mat3 circleMatrix = mat3(right, up, viewPosition);
495
+
496
+ // Truncated projection: field of view and off-center offset, with the NDC to texture transform.
497
+ mat3 projectionMatrix = mat3(
498
+ cortaoMain.projectionParams.x, 0.0, 0.0,
499
+ 0.0, cortaoMain.projectionParams.y, 0.0,
500
+ cortaoMain.projectionParams.zw, -1.0
501
+ );
502
+ mat3 offsetTransform = projectionMatrix * (circleMatrix * rotationScaleMatrix);
503
+
504
+ vec3 t;
505
+ vec3 bt;
506
+ cortao_constructBasis(normal, t, bt);
507
+ float s = sin(randomTangentRotation);
508
+ float c = cos(randomTangentRotation);
509
+ vec3 tangent = c * t + s * bt;
510
+ vec3 bitangent = c * bt - s * t;
511
+ mat3 tangentSpaceTransform = mat3(tangent, bitangent, normal);
512
+
513
+ uint rayBits = cortao_computeRayOcclusion(
514
+ offsetDither, offsetTransform, tangentSpaceTransform, baseMipBias, viewPosition, normal, viewDirection, clampedRadius
515
+ );
516
+
517
+ float occlusion = 1.0 - float(cortao_bitCount(rayBits)) / float(CORTAO_RAY_COUNT);
518
+ // Non-photorealistic intensity, as the CORTAO documentation recommends.
519
+ occlusion = pow(occlusion, cortaoMain.intensity);
520
+ occlusionOutput = vec4(occlusion, 0.0, 0.0, 1.0);
521
+ }
522
+ `
523
+ );
524
+ const cortaoFilter = {
525
+ name: "cortaoFilter",
526
+ dependencies: [cortaoBase],
527
+ fs: (
528
+ /* glsl */
529
+ `layout(std140) uniform cortaoFilterUniforms {
530
+ vec2 resolution;
531
+ float depthSensitivity;
532
+ float normalSensitivity;
533
+ } cortaoFilter;
534
+ `
535
+ ),
536
+ uniformTypes: {
537
+ resolution: "vec2<f32>",
538
+ depthSensitivity: "f32",
539
+ normalSensitivity: "f32"
540
+ }
541
+ };
542
+ const CORTAO_FILTER_PASS_FS = (
543
+ /* glsl */
544
+ `#version 300 es
545
+ uniform highp usampler2D packedDataTexture;
546
+ uniform highp sampler2D occlusionTexture;
547
+
548
+ layout(location = 0) out vec4 occlusionOutput;
549
+
550
+ uint cortao_fetchPackedData(ivec2 pixel) {
551
+ ivec2 size = ivec2(cortaoFilter.resolution);
552
+ if (any(lessThan(pixel, ivec2(0))) || any(greaterThanEqual(pixel, size))) {
553
+ return 0u;
554
+ }
555
+ return texelFetch(packedDataTexture, pixel, 0).r;
556
+ }
557
+
558
+ float cortao_fetchOcclusion(ivec2 pixel) {
559
+ ivec2 size = ivec2(cortaoFilter.resolution);
560
+ if (any(lessThan(pixel, ivec2(0))) || any(greaterThanEqual(pixel, size))) {
561
+ return 0.0;
562
+ }
563
+ return texelFetch(occlusionTexture, pixel, 0).r;
564
+ }
565
+
566
+ int cortao_unpackNormalX(uint packedData) {
567
+ int normalBits = CORTAO_PACKED_NORMAL_BITS / 2;
568
+ return (int(packedData) << (32 - normalBits)) >> (32 - normalBits);
569
+ }
570
+
571
+ int cortao_unpackNormalY(uint packedData) {
572
+ int normalBits = CORTAO_PACKED_NORMAL_BITS / 2;
573
+ return (int(packedData) << (32 - normalBits * 2)) >> (32 - normalBits);
574
+ }
575
+
576
+ float cortao_calculateWeight(
577
+ ivec2 pixel, ivec2 offset, float depthMultiplier, float depthOffset, float deltaX, float deltaY,
578
+ int centerNormalX, int centerNormalY, float normalErrorMultiplier
579
+ ) {
580
+ uint packedData = cortao_fetchPackedData(pixel + offset);
581
+ float sampleDepth = cortao_unpackDepth(packedData) * depthMultiplier + depthOffset;
582
+ float error = abs(deltaX * float(offset.x) + deltaY * float(offset.y) + sampleDepth);
583
+ int normalX = cortao_unpackNormalX(packedData) - centerNormalX;
584
+ int normalY = cortao_unpackNormalY(packedData) - centerNormalY;
585
+ error += float(normalX * normalX + normalY * normalY) * normalErrorMultiplier;
586
+ return exp2(-error);
587
+ }
588
+
589
+ void main(void) {
590
+ ivec2 pixel = ivec2(gl_FragCoord.xy);
591
+ uint centerPackedData = cortao_fetchPackedData(pixel);
592
+ if (centerPackedData == 0u) {
593
+ occlusionOutput = vec4(1.0);
594
+ return;
595
+ }
596
+
597
+ // The depth slope comes from the 2x2 block of this pixel, as in the gather-based reference.
598
+ ivec2 blockOrigin = (pixel >> 1) << 1;
599
+ ivec2 blockOffset = pixel - blockOrigin;
600
+ float depth00 = cortao_unpackDepth(cortao_fetchPackedData(blockOrigin));
601
+ float depth10 = cortao_unpackDepth(cortao_fetchPackedData(blockOrigin + ivec2(1, 0)));
602
+ float depth01 = cortao_unpackDepth(cortao_fetchPackedData(blockOrigin + ivec2(0, 1)));
603
+ float depth11 = cortao_unpackDepth(cortao_fetchPackedData(blockOrigin + ivec2(1, 1)));
604
+ float leftDepth = blockOffset.y == 0 ? depth00 : depth01;
605
+ float rightDepth = blockOffset.y == 0 ? depth10 : depth11;
606
+ float bottomDepth = blockOffset.x == 0 ? depth00 : depth10;
607
+ float topDepth = blockOffset.x == 0 ? depth01 : depth11;
608
+
609
+ float centerDepth = cortao_unpackDepth(centerPackedData);
610
+ float inverseCenterDepth = 1.0 / centerDepth;
611
+ float sensitivity = cortaoFilter.depthSensitivity;
612
+ float deltaX = (leftDepth - rightDepth) * inverseCenterDepth * sensitivity;
613
+ float deltaY = (bottomDepth - topDepth) * inverseCenterDepth * sensitivity;
614
+ float depthMultiplier = sensitivity * inverseCenterDepth;
615
+ float depthOffset = -sensitivity;
616
+ int centerNormalX = cortao_unpackNormalX(centerPackedData);
617
+ int centerNormalY = cortao_unpackNormalY(centerPackedData);
618
+ float normalErrorMultiplier = cortaoFilter.normalSensitivity / float(1 << (CORTAO_PACKED_NORMAL_BITS / 2));
619
+
620
+ float occlusionSum = cortao_fetchOcclusion(pixel);
621
+ float weightSum = 1.0;
622
+
623
+ #if CORTAO_LARGE_FILTER
624
+ const int SAMPLE_COUNT = 6;
625
+ const ivec2 OFFSETS[6] = ivec2[6](
626
+ ivec2(3, 0), ivec2(6, 0), ivec2(3, 3), ivec2(0, 3), ivec2(0, 6), ivec2(3, -3)
627
+ );
628
+ #else
629
+ const int SAMPLE_COUNT = 2;
630
+ const ivec2 OFFSETS[2] = ivec2[2](ivec2(3, 0), ivec2(0, 3));
631
+ #endif
632
+
633
+ for (int i = 0; i < SAMPLE_COUNT; i++) {
634
+ ivec2 offset = OFFSETS[i];
635
+ float weightA = cortao_calculateWeight(
636
+ pixel, -offset, depthMultiplier, depthOffset, deltaX, deltaY, centerNormalX, centerNormalY, normalErrorMultiplier
637
+ );
638
+ float weightB = cortao_calculateWeight(
639
+ pixel, offset, depthMultiplier, depthOffset, deltaX, deltaY, centerNormalX, centerNormalY, normalErrorMultiplier
640
+ );
641
+ #if CORTAO_FILTER_SYMMETRY
642
+ float minWeight = min(weightA, weightB);
643
+ weightA = minWeight;
644
+ weightB = minWeight;
645
+ #endif
646
+ weightSum += weightA + weightB;
647
+ occlusionSum += cortao_fetchOcclusion(pixel - offset) * weightA;
648
+ occlusionSum += cortao_fetchOcclusion(pixel + offset) * weightB;
649
+ }
650
+
651
+ occlusionOutput = vec4(occlusionSum / weightSum, 0.0, 0.0, 1.0);
652
+ }
653
+ `
654
+ );
655
+ // Annotate the CommonJS export names for ESM import in node:
656
+ 0 && (module.exports = {
657
+ CORTAO_FILTER_PASS_FS,
658
+ CORTAO_MAIN_PASS_FS,
659
+ CORTAO_MIPMAP_FS,
660
+ CORTAO_PACKED_NORMAL_BITS,
661
+ CORTAO_PREPASS_FS,
662
+ cortaoBase,
663
+ cortaoFilter,
664
+ cortaoMain,
665
+ cortaoMipmap,
666
+ cortaoPrepass
667
+ });