@luma.gl/effects 7.4.0-alpha.2 → 9.1.0-beta.3

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 (306) hide show
  1. package/LICENSE +10 -1
  2. package/README.md +2 -2
  3. package/dist/dist.dev.js +3458 -0
  4. package/dist/dist.min.js +18 -30
  5. package/dist/index.cjs +1724 -0
  6. package/dist/index.cjs.map +7 -0
  7. package/dist/index.d.ts +40 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +26 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/passes/postprocessing/fxaa/fxaa.d.ts +15 -0
  12. package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
  13. package/{src/shader-modules → dist/passes/postprocessing}/fxaa/fxaa.js +18 -14
  14. package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -0
  15. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +43 -0
  16. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
  17. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +68 -0
  18. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -0
  19. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +43 -0
  20. package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
  21. package/dist/passes/postprocessing/image-adjust-filters/denoise.js +74 -0
  22. package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -0
  23. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +46 -0
  24. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
  25. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +101 -0
  26. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -0
  27. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +33 -0
  28. package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
  29. package/dist/passes/postprocessing/image-adjust-filters/noise.js +58 -0
  30. package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -0
  31. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +29 -0
  32. package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
  33. package/dist/passes/postprocessing/image-adjust-filters/sepia.js +44 -0
  34. package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -0
  35. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +29 -0
  36. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
  37. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +35 -0
  38. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -0
  39. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +44 -0
  40. package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
  41. package/dist/passes/postprocessing/image-adjust-filters/vignette.js +39 -0
  42. package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -0
  43. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +79 -0
  44. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
  45. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +111 -0
  46. package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -0
  47. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +56 -0
  48. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
  49. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +65 -0
  50. package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -0
  51. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +42 -0
  52. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
  53. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +59 -0
  54. package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -0
  55. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +52 -0
  56. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
  57. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +64 -0
  58. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -0
  59. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +50 -0
  60. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
  61. package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +50 -0
  62. package/dist/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -0
  63. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +54 -0
  64. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
  65. package/dist/passes/postprocessing/image-fun-filters/edgework.js +101 -0
  66. package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -0
  67. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +43 -0
  68. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
  69. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +68 -0
  70. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -0
  71. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +40 -0
  72. package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
  73. package/dist/passes/postprocessing/image-fun-filters/ink.js +52 -0
  74. package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -0
  75. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +45 -0
  76. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
  77. package/dist/passes/postprocessing/image-fun-filters/magnify.js +49 -0
  78. package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -0
  79. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +49 -0
  80. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
  81. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +56 -0
  82. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -0
  83. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +50 -0
  84. package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
  85. package/dist/passes/postprocessing/image-warp-filters/swirl.js +57 -0
  86. package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -0
  87. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +8 -0
  88. package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
  89. package/dist/passes/postprocessing/image-warp-filters/warp.js +21 -0
  90. package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -0
  91. package/package.json +37 -13
  92. package/src/index.ts +99 -0
  93. package/src/passes/postprocessing/fxaa/fxaa.ts +694 -0
  94. package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +81 -0
  95. package/src/passes/postprocessing/image-adjust-filters/denoise.ts +97 -0
  96. package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +120 -0
  97. package/src/passes/postprocessing/image-adjust-filters/noise.ts +73 -0
  98. package/src/passes/postprocessing/image-adjust-filters/sepia.ts +54 -0
  99. package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +48 -0
  100. package/src/passes/postprocessing/image-adjust-filters/vignette.ts +58 -0
  101. package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +135 -0
  102. package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +84 -0
  103. package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +75 -0
  104. package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +85 -0
  105. package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +70 -0
  106. package/src/passes/postprocessing/image-fun-filters/edgework.ts +120 -0
  107. package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +86 -0
  108. package/src/passes/postprocessing/image-fun-filters/ink.ts +73 -0
  109. package/src/passes/postprocessing/image-fun-filters/magnify.ts +70 -0
  110. package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +72 -0
  111. package/src/passes/postprocessing/image-warp-filters/swirl.ts +77 -0
  112. package/src/passes/postprocessing/image-warp-filters/warp.ts +28 -0
  113. package/dist/dist.js +0 -3621
  114. package/dist/es5/experimental/passes/outline-pass.js +0 -125
  115. package/dist/es5/experimental/passes/outline-pass.js.map +0 -1
  116. package/dist/es5/experimental/passes/ssao-pass.js +0 -133
  117. package/dist/es5/experimental/passes/ssao-pass.js.map +0 -1
  118. package/dist/es5/experimental/shader-modules/convolution.js +0 -46
  119. package/dist/es5/experimental/shader-modules/convolution.js.map +0 -1
  120. package/dist/es5/experimental/shader-modules/depth.js +0 -27
  121. package/dist/es5/experimental/shader-modules/depth.js.map +0 -1
  122. package/dist/es5/experimental/shader-modules/pack.js +0 -19
  123. package/dist/es5/experimental/shader-modules/pack.js.map +0 -1
  124. package/dist/es5/experimental/shader-modules/ssao.js +0 -32
  125. package/dist/es5/experimental/shader-modules/ssao.js.map +0 -1
  126. package/dist/es5/index.js +0 -184
  127. package/dist/es5/index.js.map +0 -1
  128. package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js +0 -29
  129. package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
  130. package/dist/es5/shader-modules/adjust-filters/denoise.js +0 -29
  131. package/dist/es5/shader-modules/adjust-filters/denoise.js.map +0 -1
  132. package/dist/es5/shader-modules/adjust-filters/huesaturation.js +0 -29
  133. package/dist/es5/shader-modules/adjust-filters/huesaturation.js.map +0 -1
  134. package/dist/es5/shader-modules/adjust-filters/noise.js +0 -24
  135. package/dist/es5/shader-modules/adjust-filters/noise.js.map +0 -1
  136. package/dist/es5/shader-modules/adjust-filters/sepia.js +0 -24
  137. package/dist/es5/shader-modules/adjust-filters/sepia.js.map +0 -1
  138. package/dist/es5/shader-modules/adjust-filters/vibrance.js +0 -24
  139. package/dist/es5/shader-modules/adjust-filters/vibrance.js.map +0 -1
  140. package/dist/es5/shader-modules/adjust-filters/vignette.js +0 -29
  141. package/dist/es5/shader-modules/adjust-filters/vignette.js.map +0 -1
  142. package/dist/es5/shader-modules/blur-filters/tiltshift.js +0 -49
  143. package/dist/es5/shader-modules/blur-filters/tiltshift.js.map +0 -1
  144. package/dist/es5/shader-modules/blur-filters/triangleblur.js +0 -42
  145. package/dist/es5/shader-modules/blur-filters/triangleblur.js.map +0 -1
  146. package/dist/es5/shader-modules/blur-filters/zoomblur.js +0 -31
  147. package/dist/es5/shader-modules/blur-filters/zoomblur.js.map +0 -1
  148. package/dist/es5/shader-modules/fun-filters/colorhalftone.js +0 -31
  149. package/dist/es5/shader-modules/fun-filters/colorhalftone.js.map +0 -1
  150. package/dist/es5/shader-modules/fun-filters/dotscreen.js +0 -31
  151. package/dist/es5/shader-modules/fun-filters/dotscreen.js.map +0 -1
  152. package/dist/es5/shader-modules/fun-filters/edgework.js +0 -42
  153. package/dist/es5/shader-modules/fun-filters/edgework.js.map +0 -1
  154. package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js +0 -29
  155. package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
  156. package/dist/es5/shader-modules/fun-filters/ink.js +0 -24
  157. package/dist/es5/shader-modules/fun-filters/ink.js.map +0 -1
  158. package/dist/es5/shader-modules/fxaa/fxaa.js +0 -47
  159. package/dist/es5/shader-modules/fxaa/fxaa.js.map +0 -1
  160. package/dist/es5/shader-modules/utils/random.js +0 -13
  161. package/dist/es5/shader-modules/utils/random.js.map +0 -1
  162. package/dist/es5/shader-modules/warp-filters/bulgepinch.js +0 -36
  163. package/dist/es5/shader-modules/warp-filters/bulgepinch.js.map +0 -1
  164. package/dist/es5/shader-modules/warp-filters/swirl.js +0 -36
  165. package/dist/es5/shader-modules/warp-filters/swirl.js.map +0 -1
  166. package/dist/es5/shader-modules/warp-filters/warp.js +0 -13
  167. package/dist/es5/shader-modules/warp-filters/warp.js.map +0 -1
  168. package/dist/es6/experimental/passes/outline-pass.js +0 -48
  169. package/dist/es6/experimental/passes/outline-pass.js.map +0 -1
  170. package/dist/es6/experimental/passes/ssao-pass.js +0 -76
  171. package/dist/es6/experimental/passes/ssao-pass.js.map +0 -1
  172. package/dist/es6/experimental/shader-modules/convolution.js +0 -37
  173. package/dist/es6/experimental/shader-modules/convolution.js.map +0 -1
  174. package/dist/es6/experimental/shader-modules/depth.js +0 -13
  175. package/dist/es6/experimental/shader-modules/depth.js.map +0 -1
  176. package/dist/es6/experimental/shader-modules/pack.js +0 -10
  177. package/dist/es6/experimental/shader-modules/pack.js.map +0 -1
  178. package/dist/es6/experimental/shader-modules/ssao.js +0 -21
  179. package/dist/es6/experimental/shader-modules/ssao.js.map +0 -1
  180. package/dist/es6/index.js +0 -23
  181. package/dist/es6/index.js.map +0 -1
  182. package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
  183. package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
  184. package/dist/es6/shader-modules/adjust-filters/denoise.js +0 -20
  185. package/dist/es6/shader-modules/adjust-filters/denoise.js.map +0 -1
  186. package/dist/es6/shader-modules/adjust-filters/huesaturation.js +0 -22
  187. package/dist/es6/shader-modules/adjust-filters/huesaturation.js.map +0 -1
  188. package/dist/es6/shader-modules/adjust-filters/noise.js +0 -17
  189. package/dist/es6/shader-modules/adjust-filters/noise.js.map +0 -1
  190. package/dist/es6/shader-modules/adjust-filters/sepia.js +0 -17
  191. package/dist/es6/shader-modules/adjust-filters/sepia.js.map +0 -1
  192. package/dist/es6/shader-modules/adjust-filters/vibrance.js +0 -17
  193. package/dist/es6/shader-modules/adjust-filters/vibrance.js.map +0 -1
  194. package/dist/es6/shader-modules/adjust-filters/vignette.js +0 -22
  195. package/dist/es6/shader-modules/adjust-filters/vignette.js.map +0 -1
  196. package/dist/es6/shader-modules/blur-filters/tiltshift.js +0 -38
  197. package/dist/es6/shader-modules/blur-filters/tiltshift.js.map +0 -1
  198. package/dist/es6/shader-modules/blur-filters/triangleblur.js +0 -31
  199. package/dist/es6/shader-modules/blur-filters/triangleblur.js.map +0 -1
  200. package/dist/es6/shader-modules/blur-filters/zoomblur.js +0 -20
  201. package/dist/es6/shader-modules/blur-filters/zoomblur.js.map +0 -1
  202. package/dist/es6/shader-modules/fun-filters/colorhalftone.js +0 -24
  203. package/dist/es6/shader-modules/fun-filters/colorhalftone.js.map +0 -1
  204. package/dist/es6/shader-modules/fun-filters/dotscreen.js +0 -24
  205. package/dist/es6/shader-modules/fun-filters/dotscreen.js.map +0 -1
  206. package/dist/es6/shader-modules/fun-filters/edgework.js +0 -31
  207. package/dist/es6/shader-modules/fun-filters/edgework.js.map +0 -1
  208. package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
  209. package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
  210. package/dist/es6/shader-modules/fun-filters/ink.js +0 -17
  211. package/dist/es6/shader-modules/fun-filters/ink.js.map +0 -1
  212. package/dist/es6/shader-modules/fxaa/fxaa.js +0 -39
  213. package/dist/es6/shader-modules/fxaa/fxaa.js.map +0 -1
  214. package/dist/es6/shader-modules/utils/random.js +0 -6
  215. package/dist/es6/shader-modules/utils/random.js.map +0 -1
  216. package/dist/es6/shader-modules/warp-filters/bulgepinch.js +0 -25
  217. package/dist/es6/shader-modules/warp-filters/bulgepinch.js.map +0 -1
  218. package/dist/es6/shader-modules/warp-filters/swirl.js +0 -25
  219. package/dist/es6/shader-modules/warp-filters/swirl.js.map +0 -1
  220. package/dist/es6/shader-modules/warp-filters/warp.js +0 -6
  221. package/dist/es6/shader-modules/warp-filters/warp.js.map +0 -1
  222. package/dist/esm/experimental/passes/outline-pass.js +0 -114
  223. package/dist/esm/experimental/passes/outline-pass.js.map +0 -1
  224. package/dist/esm/experimental/passes/ssao-pass.js +0 -120
  225. package/dist/esm/experimental/passes/ssao-pass.js.map +0 -1
  226. package/dist/esm/experimental/shader-modules/convolution.js +0 -39
  227. package/dist/esm/experimental/shader-modules/convolution.js.map +0 -1
  228. package/dist/esm/experimental/shader-modules/depth.js +0 -16
  229. package/dist/esm/experimental/shader-modules/depth.js.map +0 -1
  230. package/dist/esm/experimental/shader-modules/pack.js +0 -12
  231. package/dist/esm/experimental/shader-modules/pack.js.map +0 -1
  232. package/dist/esm/experimental/shader-modules/ssao.js +0 -21
  233. package/dist/esm/experimental/shader-modules/ssao.js.map +0 -1
  234. package/dist/esm/index.js +0 -23
  235. package/dist/esm/index.js.map +0 -1
  236. package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
  237. package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
  238. package/dist/esm/shader-modules/adjust-filters/denoise.js +0 -22
  239. package/dist/esm/shader-modules/adjust-filters/denoise.js.map +0 -1
  240. package/dist/esm/shader-modules/adjust-filters/huesaturation.js +0 -22
  241. package/dist/esm/shader-modules/adjust-filters/huesaturation.js.map +0 -1
  242. package/dist/esm/shader-modules/adjust-filters/noise.js +0 -17
  243. package/dist/esm/shader-modules/adjust-filters/noise.js.map +0 -1
  244. package/dist/esm/shader-modules/adjust-filters/sepia.js +0 -17
  245. package/dist/esm/shader-modules/adjust-filters/sepia.js.map +0 -1
  246. package/dist/esm/shader-modules/adjust-filters/vibrance.js +0 -17
  247. package/dist/esm/shader-modules/adjust-filters/vibrance.js.map +0 -1
  248. package/dist/esm/shader-modules/adjust-filters/vignette.js +0 -22
  249. package/dist/esm/shader-modules/adjust-filters/vignette.js.map +0 -1
  250. package/dist/esm/shader-modules/blur-filters/tiltshift.js +0 -38
  251. package/dist/esm/shader-modules/blur-filters/tiltshift.js.map +0 -1
  252. package/dist/esm/shader-modules/blur-filters/triangleblur.js +0 -31
  253. package/dist/esm/shader-modules/blur-filters/triangleblur.js.map +0 -1
  254. package/dist/esm/shader-modules/blur-filters/zoomblur.js +0 -20
  255. package/dist/esm/shader-modules/blur-filters/zoomblur.js.map +0 -1
  256. package/dist/esm/shader-modules/fun-filters/colorhalftone.js +0 -24
  257. package/dist/esm/shader-modules/fun-filters/colorhalftone.js.map +0 -1
  258. package/dist/esm/shader-modules/fun-filters/dotscreen.js +0 -24
  259. package/dist/esm/shader-modules/fun-filters/dotscreen.js.map +0 -1
  260. package/dist/esm/shader-modules/fun-filters/edgework.js +0 -31
  261. package/dist/esm/shader-modules/fun-filters/edgework.js.map +0 -1
  262. package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
  263. package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
  264. package/dist/esm/shader-modules/fun-filters/ink.js +0 -17
  265. package/dist/esm/shader-modules/fun-filters/ink.js.map +0 -1
  266. package/dist/esm/shader-modules/fxaa/fxaa.js +0 -39
  267. package/dist/esm/shader-modules/fxaa/fxaa.js.map +0 -1
  268. package/dist/esm/shader-modules/utils/random.js +0 -6
  269. package/dist/esm/shader-modules/utils/random.js.map +0 -1
  270. package/dist/esm/shader-modules/warp-filters/bulgepinch.js +0 -25
  271. package/dist/esm/shader-modules/warp-filters/bulgepinch.js.map +0 -1
  272. package/dist/esm/shader-modules/warp-filters/swirl.js +0 -25
  273. package/dist/esm/shader-modules/warp-filters/swirl.js.map +0 -1
  274. package/dist/esm/shader-modules/warp-filters/warp.js +0 -6
  275. package/dist/esm/shader-modules/warp-filters/warp.js.map +0 -1
  276. package/src/experimental/passes/outline-pass.js +0 -58
  277. package/src/experimental/passes/ssao-pass.js +0 -73
  278. package/src/experimental/passes/ssao-pass.md +0 -15
  279. package/src/experimental/shader-modules/convolution.js +0 -96
  280. package/src/experimental/shader-modules/convolution.md +0 -15
  281. package/src/experimental/shader-modules/depth.js +0 -84
  282. package/src/experimental/shader-modules/depth.md +0 -76
  283. package/src/experimental/shader-modules/pack.js +0 -32
  284. package/src/experimental/shader-modules/pack.md +0 -15
  285. package/src/experimental/shader-modules/ssao.js +0 -183
  286. package/src/experimental/shader-modules/ssao.md +0 -4
  287. package/src/index.js +0 -35
  288. package/src/shader-modules/adjust-filters/brightnesscontrast.js +0 -38
  289. package/src/shader-modules/adjust-filters/denoise.js +0 -49
  290. package/src/shader-modules/adjust-filters/huesaturation.js +0 -57
  291. package/src/shader-modules/adjust-filters/noise.js +0 -36
  292. package/src/shader-modules/adjust-filters/sepia.js +0 -37
  293. package/src/shader-modules/adjust-filters/vibrance.js +0 -32
  294. package/src/shader-modules/adjust-filters/vignette.js +0 -33
  295. package/src/shader-modules/blur-filters/tiltshift.js +0 -105
  296. package/src/shader-modules/blur-filters/triangleblur.js +0 -55
  297. package/src/shader-modules/blur-filters/zoomblur.js +0 -56
  298. package/src/shader-modules/fun-filters/colorhalftone.js +0 -60
  299. package/src/shader-modules/fun-filters/dotscreen.js +0 -45
  300. package/src/shader-modules/fun-filters/edgework.js +0 -84
  301. package/src/shader-modules/fun-filters/hexagonalpixelate.js +0 -63
  302. package/src/shader-modules/fun-filters/ink.js +0 -49
  303. package/src/shader-modules/utils/random.js +0 -12
  304. package/src/shader-modules/warp-filters/bulgepinch.js +0 -52
  305. package/src/shader-modules/warp-filters/swirl.js +0 -55
  306. package/src/shader-modules/warp-filters/warp.js +0 -19
@@ -0,0 +1,84 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+ import {random} from '@luma.gl/shadertools';
7
+
8
+ const fs = /* glsl */ `\
9
+ uniform triangleBlurUniforms {
10
+ float radius;
11
+ vec2 delta;
12
+ } triangleBlur;
13
+
14
+ vec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
15
+ vec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;
16
+
17
+ vec4 color = vec4(0.0);
18
+ float total = 0.0;
19
+
20
+ /* randomize the lookup values to hide the fixed number of samples */
21
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
22
+
23
+ for (float t = -30.0; t <= 30.0; t++) {
24
+ float percent = (t + offset - 0.5) / 30.0;
25
+ float weight = 1.0 - abs(percent);
26
+ vec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);
27
+
28
+ /* switch to pre-multiplied alpha to correctly blur transparent images */
29
+ offsetColor.rgb *= offsetColor.a;
30
+
31
+ color += offsetColor * weight;
32
+ total += weight;
33
+ }
34
+
35
+ color = color / total;
36
+
37
+ /* switch back from pre-multiplied alpha */
38
+ color.rgb /= color.a + 0.00001;
39
+
40
+ return color;
41
+ }
42
+ `;
43
+
44
+ /**
45
+ * @filter Triangle Blur
46
+ * @description This is the most basic blur filter, which convolves the image with a
47
+ * pyramid filter. The pyramid filter is separable and is applied as two
48
+ * perpendicular triangle filters.
49
+ */
50
+ export type TriangleBlurProps = {
51
+ /** The radius of the pyramid convolved with the image. */
52
+ radius?: number;
53
+ /** @deprecated internal property */
54
+ delta?: [number, number];
55
+ };
56
+
57
+ export type TriangleBlurUniforms = TriangleBlurProps;
58
+
59
+ /**
60
+ * @filter Triangle Blur
61
+ * @description This is the most basic blur filter, which convolves the image with a
62
+ * pyramid filter. The pyramid filter is separable and is applied as two
63
+ * perpendicular triangle filters.
64
+ */
65
+ export const triangleBlur = {
66
+ props: {} as TriangleBlurProps,
67
+ uniforms: {} as TriangleBlurUniforms,
68
+
69
+ name: 'triangleBlur',
70
+ uniformTypes: {
71
+ radius: 'f32',
72
+ delta: 'vec2<f32>'
73
+ },
74
+ propTypes: {
75
+ radius: {value: 20, min: 0, softMax: 100},
76
+ delta: {value: [1, 0], private: true}
77
+ },
78
+ fs,
79
+ dependencies: [random],
80
+ passes: [
81
+ {sampler: true, uniforms: {delta: [1, 0]}},
82
+ {sampler: true, uniforms: {delta: [0, 1]}}
83
+ ]
84
+ } as const satisfies ShaderPass<TriangleBlurProps, TriangleBlurProps>;
@@ -0,0 +1,75 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+ import {random} from '@luma.gl/shadertools';
7
+
8
+ const fs = `
9
+ uniform zoomBlurUniforms {
10
+ vec2 center;
11
+ float strength;
12
+ } zoomBlur;
13
+
14
+ vec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
15
+ vec4 color = vec4(0.0);
16
+ float total = 0.0;
17
+ vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;
18
+
19
+ /* randomize the lookup values to hide the fixed number of samples */
20
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
21
+
22
+ for (float t = 0.0; t <= 40.0; t++) {
23
+ float percent = (t + offset) / 40.0;
24
+ float weight = 4.0 * (percent - percent * percent);
25
+ vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);
26
+
27
+ /* switch to pre-multiplied alpha to correctly blur transparent images */
28
+ offsetColor.rgb *= offsetColor.a;
29
+
30
+ color += offsetColor * weight;
31
+ total += weight;
32
+ }
33
+
34
+ color = color / total;
35
+
36
+ /* switch back from pre-multiplied alpha */
37
+ color.rgb /= color.a + 0.00001;
38
+
39
+ return color;
40
+ }
41
+ `;
42
+
43
+ /**
44
+ * Zoom Blur - Blurs the image away from a certain point, which looks like radial motion blur.
45
+ */
46
+ export type ZoomBlurProps = {
47
+ /** - The x, y coordinate of the blur origin. */
48
+ center?: [number, number];
49
+ /** - The strength of the blur. Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 creates a highly blurred image. */
50
+ strength?: number;
51
+ };
52
+
53
+ export type ZoomBlurUniforms = ZoomBlurProps;
54
+
55
+ /**
56
+ * Zoom Blur
57
+ * Blurs the image away from a certain point, which looks like radial motion blur.
58
+ */
59
+ export const zoomBlur = {
60
+ props: {} as ZoomBlurProps,
61
+ uniforms: {} as ZoomBlurUniforms,
62
+
63
+ name: 'zoomBlur',
64
+ uniformTypes: {
65
+ center: 'vec2<f32>',
66
+ strength: 'f32'
67
+ },
68
+ propTypes: {
69
+ center: {value: [0.5, 0.5]},
70
+ strength: {value: 0.3, min: 0, softMax: 1}
71
+ },
72
+ fs,
73
+ dependencies: [random],
74
+ passes: [{sampler: true}]
75
+ } as const satisfies ShaderPass<ZoomBlurProps, ZoomBlurProps>;
@@ -0,0 +1,85 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+
7
+ // TODO pass texCoord to angle
8
+ const fs = /* glsl */ `\
9
+ uniform colorHalftoneUniforms {
10
+ vec2 center;
11
+ float angle;
12
+ float size;
13
+ } colorHalftone;
14
+
15
+ float pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {
16
+ float s = sin(angle), c = cos(angle);
17
+ vec2 tex = texCoord * texSize - colorHalftone.center * texSize;
18
+ vec2 point = vec2(
19
+ c * tex.x - s * tex.y,
20
+ s * tex.x + c * tex.y
21
+ ) * scale;
22
+ return (sin(point.x) * sin(point.y)) * 4.0;
23
+ }
24
+
25
+ vec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
26
+ float scale = 3.1514 / colorHalftone.size;
27
+ vec3 cmy = 1.0 - color.rgb;
28
+ float k = min(cmy.x, min(cmy.y, cmy.z));
29
+
30
+ cmy = (cmy - k) / (1.0 - k);
31
+ cmy = clamp(
32
+ cmy * 10.0 - 3.0 + vec3(
33
+ pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),
34
+ pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),
35
+ pattern(colorHalftone.angle, scale, texSize, texCoord)
36
+ ),
37
+ 0.0,
38
+ 1.0
39
+ );
40
+ k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);
41
+ return vec4(1.0 - cmy - k, color.a);
42
+ }
43
+ `;
44
+
45
+ /**
46
+ * Color Halftone -
47
+ * Simulates a CMYK halftone rendering of the image by multiplying pixel values
48
+ * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,
49
+ * and black.
50
+ */
51
+ export type ColorHalftoneProps = {
52
+ /** The x,y coordinate of the pattern origin. */
53
+ center?: [number, number];
54
+ /** The rotation of the pattern in radians. */
55
+ angle?: number;
56
+ /** The diameter of a dot in pixels. */
57
+ size?: number;
58
+ };
59
+
60
+ export type ColorHalftoneUniforms = ColorHalftoneProps;
61
+
62
+ /**
63
+ * Color Halftone -
64
+ * Simulates a CMYK halftone rendering of the image by multiplying pixel values
65
+ * with a four rotated 2D sine wave patterns, one each for cyan, magenta, yellow,
66
+ * and black.
67
+ */
68
+ export const colorHalftone = {
69
+ props: {} as ColorHalftoneProps,
70
+ uniforms: {} as ColorHalftoneUniforms,
71
+
72
+ name: 'colorHalftone',
73
+ uniformTypes: {
74
+ center: 'vec2<f32>',
75
+ angle: 'f32',
76
+ size: 'f32'
77
+ },
78
+ propTypes: {
79
+ center: {value: [0.5, 0.5]},
80
+ angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},
81
+ size: {value: 4, min: 1, softMin: 3, softMax: 20}
82
+ },
83
+ fs,
84
+ passes: [{filter: true}]
85
+ } as const satisfies ShaderPass<ColorHalftoneProps, ColorHalftoneProps>;
@@ -0,0 +1,70 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+
7
+ const fs = /* glsl */ `\
8
+ uniform dotScreenUniforms {
9
+ vec2 center;
10
+ float angle;
11
+ float size;
12
+ } dotScreen;
13
+
14
+ float pattern(vec2 texSize, vec2 texCoord) {
15
+ float scale = 3.1415 / dotScreen.size;
16
+
17
+ float s = sin(dotScreen.angle), c = cos(dotScreen.angle);
18
+ vec2 tex = texCoord * texSize - dotScreen.center * texSize;
19
+ vec2 point = vec2(
20
+ c * tex.x - s * tex.y,
21
+ s * tex.x + c * tex.y
22
+ ) * scale;
23
+ return (sin(point.x) * sin(point.y)) * 4.0;
24
+ }
25
+
26
+ vec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
27
+ float average = (color.r + color.g + color.b) / 3.0;
28
+ return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
29
+ }
30
+ `;
31
+
32
+ /**
33
+ * Dot Screen -
34
+ * Simulates a black and white halftone rendering of the image by multiplying
35
+ * pixel values with a rotated 2D sine wave pattern.
36
+ */
37
+ export type DotScreenProps = {
38
+ /** The x, y coordinate of the pattern origin. */
39
+ center?: [number, number];
40
+ /** The rotation of the pattern in radians. */
41
+ angle?: number;
42
+ /** The diameter of a dot in pixels. */
43
+ size?: number;
44
+ };
45
+
46
+ export type DotScreenUniforms = DotScreenProps;
47
+
48
+ /**
49
+ * Dot Screen -
50
+ * Simulates a black and white halftone rendering of the image by multiplying
51
+ * pixel values with a rotated 2D sine wave pattern.
52
+ */
53
+ export const dotScreen = {
54
+ props: {} as DotScreenProps,
55
+ uniforms: {} as DotScreenUniforms,
56
+
57
+ name: 'dotScreen',
58
+ uniformTypes: {
59
+ center: 'vec2<f32>',
60
+ angle: 'f32',
61
+ size: 'f32'
62
+ },
63
+ propTypes: {
64
+ center: {value: [0.5, 0.5]},
65
+ angle: {value: 1.1, softMin: 0, softMax: Math.PI / 2},
66
+ size: {value: 3, min: 1, softMin: 3, softMax: 20}
67
+ },
68
+ fs,
69
+ passes: [{filter: true}]
70
+ } as const satisfies ShaderPass<DotScreenProps, DotScreenProps>;
@@ -0,0 +1,120 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+ import {random} from '@luma.gl/shadertools';
7
+
8
+ const fs = /* glsl */ `\
9
+ uniform edgeWorkUniforms {
10
+ float radius;
11
+ int mode;
12
+ } edgeWork;
13
+
14
+ vec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
15
+ vec2 relativeDelta = edgeWork.radius * delta / texSize;
16
+
17
+ vec2 color = vec2(0.0);
18
+ vec2 total = vec2(0.0);
19
+
20
+ /* randomize the lookup values to hide the fixed number of samples */
21
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
22
+
23
+ for (float t = -30.0; t <= 30.0; t++) {
24
+ float percent = (t + offset - 0.5) / 30.0;
25
+ float weight = 1.0 - abs(percent);
26
+ vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;
27
+ float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
28
+ color.x += average * weight;
29
+ total.x += weight;
30
+ if (abs(t) < 15.0) {
31
+ weight = weight * 2.0 - 1.0;
32
+ color.y += average * weight;
33
+ total.y += weight;
34
+ }
35
+ }
36
+ return vec4(color / total, 0.0, 1.0);
37
+ }
38
+
39
+ vec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
40
+ vec2 relativeDelta = edgeWork.radius * delta / texSize;
41
+
42
+ vec2 color = vec2(0.0);
43
+ vec2 total = vec2(0.0);
44
+
45
+ /* randomize the lookup values to hide the fixed number of samples */
46
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
47
+
48
+ for (float t = -30.0; t <= 30.0; t++) {
49
+ float percent = (t + offset - 0.5) / 30.0;
50
+ float weight = 1.0 - abs(percent);
51
+ vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;
52
+ color.x += sampleColor.x * weight;
53
+ total.x += weight;
54
+ if (abs(t) < 15.0) {
55
+ weight = weight * 2.0 - 1.0;
56
+ color.y += sampleColor.y * weight;
57
+ total.y += weight;
58
+ }
59
+ }
60
+ float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
61
+ return vec4(c, c, c, 1.0);
62
+ }
63
+
64
+ vec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
65
+ switch (edgeWork.mode) {
66
+ case 0:
67
+ return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));
68
+ case 1:
69
+ default:
70
+ return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));
71
+ }
72
+ }
73
+ `;
74
+
75
+ /**
76
+ * Edge Work -
77
+ * Picks out different frequencies in the image by subtracting two
78
+ * copies of the image blurred with different radii.
79
+ */
80
+ export type EdgeWorkProps = {
81
+ /** radius The radius of the effect in pixels. */
82
+ radius?: number;
83
+ /** @deprecated xy or RGB */
84
+ mode?: 0 | 1;
85
+ };
86
+
87
+ export type EdgeWorkUniforms = EdgeWorkProps;
88
+
89
+ /**
90
+ * Edge Work -
91
+ * Picks out different frequencies in the image by subtracting two
92
+ * copies of the image blurred with different radii.
93
+ */
94
+ export const edgeWork = {
95
+ props: {} as EdgeWorkProps,
96
+ uniforms: {} as EdgeWorkProps,
97
+
98
+ name: 'edgeWork',
99
+ dependencies: [random],
100
+ fs,
101
+ uniformTypes: {
102
+ radius: 'f32',
103
+ mode: 'i32'
104
+ },
105
+ propTypes: {
106
+ radius: {value: 2, min: 1, softMax: 50},
107
+ mode: {value: 0, private: true}
108
+ },
109
+
110
+ passes: [
111
+ {
112
+ sampler: true,
113
+ uniforms: {mode: 0}
114
+ },
115
+ {
116
+ sampler: true,
117
+ uniforms: {mode: 1}
118
+ }
119
+ ]
120
+ } as const satisfies ShaderPass<EdgeWorkProps, EdgeWorkProps>;
@@ -0,0 +1,86 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+
7
+ const fs = /* glsl */ `\
8
+ uniform hexagonalPixelateUniforms {
9
+ vec2 center;
10
+ float scale;
11
+ } hexagonalPixelate;
12
+
13
+ vec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
14
+ vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;
15
+ tex.y /= 0.866025404;
16
+ tex.x -= tex.y * 0.5;
17
+
18
+ vec2 a;
19
+ if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
20
+ a = vec2(floor(tex.x), floor(tex.y));
21
+ }
22
+ else a = vec2(ceil(tex.x), ceil(tex.y));
23
+ vec2 b = vec2(ceil(tex.x), floor(tex.y));
24
+ vec2 c = vec2(floor(tex.x), ceil(tex.y));
25
+
26
+ vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
27
+ vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
28
+ vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
29
+ vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
30
+
31
+ float alen = length(TEX - A);
32
+ float blen = length(TEX - B);
33
+ float clen = length(TEX - C);
34
+
35
+ vec2 choice;
36
+ if (alen < blen) {
37
+ if (alen < clen) choice = a;
38
+ else choice = c;
39
+ } else {
40
+ if (blen < clen) choice = b;
41
+ else choice = c;
42
+ }
43
+
44
+ choice.x += choice.y * 0.5;
45
+ choice.y *= 0.866025404;
46
+ choice *= hexagonalPixelate.scale / texSize;
47
+
48
+ return texture(source, choice + hexagonalPixelate.center);
49
+ }
50
+ `;
51
+
52
+ /**
53
+ * Hexagonal Pixelate
54
+ * Renders the image using a pattern of hexagonal tiles.
55
+ * Tile colors are nearest-neighbor sampled from the centers of the tiles.
56
+ */
57
+ export type HexagonalPixelateProps = {
58
+ /** The [x, y] coordinates of the pattern center. */
59
+ center?: [number, number];
60
+ /** The width of an individual tile, in pixels. */
61
+ scale?: number;
62
+ };
63
+
64
+ export type HexagonalPixelateUniforms = HexagonalPixelateProps;
65
+
66
+ /**
67
+ * Hexagonal Pixelate
68
+ * Renders the image using a pattern of hexagonal tiles. Tile colors
69
+ * are nearest-neighbor sampled from the centers of the tiles.
70
+ */
71
+ export const hexagonalPixelate = {
72
+ props: {} as HexagonalPixelateProps,
73
+ uniforms: {} as HexagonalPixelateUniforms,
74
+
75
+ name: 'hexagonalPixelate',
76
+ uniformTypes: {
77
+ center: 'vec2<f32>',
78
+ scale: 'f32'
79
+ },
80
+ propTypes: {
81
+ center: {value: [0.5, 0.5], hint: 'screenspace'},
82
+ scale: {value: 10, min: 1, softMin: 5, softMax: 50}
83
+ },
84
+ fs,
85
+ passes: [{sampler: true}]
86
+ } as const satisfies ShaderPass<HexagonalPixelateProps, HexagonalPixelateProps>;
@@ -0,0 +1,73 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+
7
+ const fs = /* glsl */ `\
8
+ uniform inkUniforms {
9
+ float strength;
10
+ } ink;
11
+
12
+ vec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
13
+ vec2 dx = vec2(1.0 / texSize.x, 0.0);
14
+ vec2 dy = vec2(0.0, 1.0 / texSize.y);
15
+ vec4 color = texture(source, texCoord);
16
+ float bigTotal = 0.0;
17
+ float smallTotal = 0.0;
18
+ vec3 bigAverage = vec3(0.0);
19
+ vec3 smallAverage = vec3(0.0);
20
+ for (float x = -2.0; x <= 2.0; x += 1.0) {
21
+ for (float y = -2.0; y <= 2.0; y += 1.0) {
22
+ vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;
23
+ bigAverage += offsetColor;
24
+ bigTotal += 1.0;
25
+ if (abs(x) + abs(y) < 2.0) {
26
+ smallAverage += offsetColor;
27
+ smallTotal += 1.0;
28
+ }
29
+ }
30
+ }
31
+ vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
32
+ float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;
33
+ return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
34
+ }
35
+ `;
36
+
37
+ /**
38
+ * Ink -
39
+ * Simulates outlining the image in ink by darkening edges stronger than a
40
+ * certain threshold. The edge detection value is the difference of two
41
+ * copies of the image, each blurred using a blur of a different radius.
42
+ */
43
+ export type InkProps = {
44
+ /** The multiplicative scale of the ink edges.
45
+ * Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 adds lots of black edges.
46
+ * Negative strength values will create white ink edges instead of black ones.
47
+ */
48
+ strength?: number;
49
+ };
50
+
51
+ export type InkUniforms = InkProps;
52
+
53
+ /**
54
+ * Ink -
55
+ * Simulates outlining the image in ink by darkening edges stronger than a
56
+ * certain threshold. The edge detection value is the difference of two
57
+ * copies of the image, each blurred using a blur of a different radius.
58
+ */
59
+ export const ink = {
60
+ props: {} as InkProps,
61
+ uniforms: {} as InkUniforms,
62
+
63
+ name: 'ink',
64
+ fs,
65
+
66
+ uniformTypes: {
67
+ strength: 'f32'
68
+ },
69
+ propTypes: {
70
+ strength: {value: 0.25, min: 0, softMax: 1}
71
+ },
72
+ passes: [{sampler: true}]
73
+ } as const satisfies ShaderPass<InkProps, InkProps>;
@@ -0,0 +1,70 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderPass} from '@luma.gl/shadertools';
6
+
7
+ const fs = /* glsl */ `\
8
+ uniform magnifyUniforms {
9
+ vec2 screenXY;
10
+ float radiusPixels;
11
+ float zoom;
12
+ float borderWidthPixels;
13
+ vec4 borderColor;
14
+ } magnify;
15
+
16
+ vec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
17
+ vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);
18
+ float dist = distance(texCoord * texSize, pos * texSize);
19
+ if (dist < magnify.radiusPixels) {
20
+ return texture(source, (texCoord - pos) / magnify.zoom + pos);
21
+ }
22
+
23
+ if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {
24
+ return magnify.borderColor;
25
+ }
26
+ return texture(source, texCoord);
27
+ }
28
+ `;
29
+
30
+ /**
31
+ * Magnify - display a circle with magnify effect applied to surrounding the pixels given position
32
+ */
33
+ export type MagnifyProps = {
34
+ /** x, y position in screen coords, both x and y is normalized and in range `[0, 1]`. `[0, 0]` is the up left corner, `[1, 1]` is the bottom right corner. Default value is `[0, 0]`. */
35
+ screenXY?: [number, number];
36
+ /** effect radius in pixels. Default value is `100`. */
37
+ radiusPixels?: number;
38
+ /** magnify level. Default value is `2`. */
39
+ zoom?: number;
40
+ /** border width of the effect circle, will not show border if value <= 0.0. Default value is `0`. */
41
+ borderWidthPixels?: number;
42
+ /** border color of the effect circle. Default value is `[255, 255, 255, 255]`. */
43
+ borderColor?: [number, number, number, number];
44
+ };
45
+
46
+ export type MagnifyUniforms = MagnifyProps;
47
+
48
+ /**
49
+ * Magnify - display a circle with magnify effect applied to surrounding the pixels given position
50
+ */
51
+ export const magnify = {
52
+ name: 'magnify',
53
+ uniformTypes: {
54
+ screenXY: 'vec2<f32>',
55
+ radiusPixels: 'f32',
56
+ zoom: 'f32',
57
+ borderWidthPixels: 'f32',
58
+ borderColor: 'vec4<f32>'
59
+ },
60
+ propTypes: {
61
+ // range 0 to 1
62
+ screenXY: {value: [0, 0]},
63
+ radiusPixels: 200,
64
+ zoom: 2.0,
65
+ borderWidthPixels: 0.0,
66
+ borderColor: {value: [255, 255, 255, 255]}
67
+ },
68
+ fs,
69
+ passes: [{sampler: true}]
70
+ } as const satisfies ShaderPass<MagnifyProps, MagnifyProps>;