@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.
- package/LICENSE +10 -1
- package/README.md +2 -2
- package/dist/dist.dev.js +3458 -0
- package/dist/dist.min.js +18 -30
- package/dist/index.cjs +1724 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts +15 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
- package/{src/shader-modules → dist/passes/postprocessing}/fxaa/fxaa.js +18 -14
- package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +43 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +68 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +43 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js +74 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +46 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +101 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +33 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.js +58 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +29 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js +44 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +29 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +35 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +44 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js +39 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +79 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +111 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +56 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +65 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +42 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +59 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +52 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +64 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +50 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +50 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +54 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.js +101 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +43 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +68 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +40 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.js +52 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +45 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.js +49 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +49 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +56 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +50 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.js +57 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +8 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.js +21 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -0
- package/package.json +37 -13
- package/src/index.ts +99 -0
- package/src/passes/postprocessing/fxaa/fxaa.ts +694 -0
- package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +81 -0
- package/src/passes/postprocessing/image-adjust-filters/denoise.ts +97 -0
- package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +120 -0
- package/src/passes/postprocessing/image-adjust-filters/noise.ts +73 -0
- package/src/passes/postprocessing/image-adjust-filters/sepia.ts +54 -0
- package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +48 -0
- package/src/passes/postprocessing/image-adjust-filters/vignette.ts +58 -0
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +135 -0
- package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +84 -0
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +75 -0
- package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +85 -0
- package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +70 -0
- package/src/passes/postprocessing/image-fun-filters/edgework.ts +120 -0
- package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +86 -0
- package/src/passes/postprocessing/image-fun-filters/ink.ts +73 -0
- package/src/passes/postprocessing/image-fun-filters/magnify.ts +70 -0
- package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +72 -0
- package/src/passes/postprocessing/image-warp-filters/swirl.ts +77 -0
- package/src/passes/postprocessing/image-warp-filters/warp.ts +28 -0
- package/dist/dist.js +0 -3621
- package/dist/es5/experimental/passes/outline-pass.js +0 -125
- package/dist/es5/experimental/passes/outline-pass.js.map +0 -1
- package/dist/es5/experimental/passes/ssao-pass.js +0 -133
- package/dist/es5/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/es5/experimental/shader-modules/convolution.js +0 -46
- package/dist/es5/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/es5/experimental/shader-modules/depth.js +0 -27
- package/dist/es5/experimental/shader-modules/depth.js.map +0 -1
- package/dist/es5/experimental/shader-modules/pack.js +0 -19
- package/dist/es5/experimental/shader-modules/pack.js.map +0 -1
- package/dist/es5/experimental/shader-modules/ssao.js +0 -32
- package/dist/es5/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/es5/index.js +0 -184
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/denoise.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/huesaturation.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/noise.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/sepia.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/vibrance.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/vignette.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/tiltshift.js +0 -49
- package/dist/es5/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/triangleblur.js +0 -42
- package/dist/es5/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/zoomblur.js +0 -31
- package/dist/es5/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/colorhalftone.js +0 -31
- package/dist/es5/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/dotscreen.js +0 -31
- package/dist/es5/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/edgework.js +0 -42
- package/dist/es5/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js +0 -29
- package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/ink.js +0 -24
- package/dist/es5/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/es5/shader-modules/fxaa/fxaa.js +0 -47
- package/dist/es5/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/es5/shader-modules/utils/random.js +0 -13
- package/dist/es5/shader-modules/utils/random.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/bulgepinch.js +0 -36
- package/dist/es5/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/swirl.js +0 -36
- package/dist/es5/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/warp.js +0 -13
- package/dist/es5/shader-modules/warp-filters/warp.js.map +0 -1
- package/dist/es6/experimental/passes/outline-pass.js +0 -48
- package/dist/es6/experimental/passes/outline-pass.js.map +0 -1
- package/dist/es6/experimental/passes/ssao-pass.js +0 -76
- package/dist/es6/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/es6/experimental/shader-modules/convolution.js +0 -37
- package/dist/es6/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/es6/experimental/shader-modules/depth.js +0 -13
- package/dist/es6/experimental/shader-modules/depth.js.map +0 -1
- package/dist/es6/experimental/shader-modules/pack.js +0 -10
- package/dist/es6/experimental/shader-modules/pack.js.map +0 -1
- package/dist/es6/experimental/shader-modules/ssao.js +0 -21
- package/dist/es6/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/es6/index.js +0 -23
- package/dist/es6/index.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/denoise.js +0 -20
- package/dist/es6/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/huesaturation.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/noise.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/sepia.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/vibrance.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/vignette.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/tiltshift.js +0 -38
- package/dist/es6/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/triangleblur.js +0 -31
- package/dist/es6/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/zoomblur.js +0 -20
- package/dist/es6/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/colorhalftone.js +0 -24
- package/dist/es6/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/dotscreen.js +0 -24
- package/dist/es6/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/edgework.js +0 -31
- package/dist/es6/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
- package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/ink.js +0 -17
- package/dist/es6/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/es6/shader-modules/fxaa/fxaa.js +0 -39
- package/dist/es6/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/es6/shader-modules/utils/random.js +0 -6
- package/dist/es6/shader-modules/utils/random.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/bulgepinch.js +0 -25
- package/dist/es6/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/swirl.js +0 -25
- package/dist/es6/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/warp.js +0 -6
- package/dist/es6/shader-modules/warp-filters/warp.js.map +0 -1
- package/dist/esm/experimental/passes/outline-pass.js +0 -114
- package/dist/esm/experimental/passes/outline-pass.js.map +0 -1
- package/dist/esm/experimental/passes/ssao-pass.js +0 -120
- package/dist/esm/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/esm/experimental/shader-modules/convolution.js +0 -39
- package/dist/esm/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/esm/experimental/shader-modules/depth.js +0 -16
- package/dist/esm/experimental/shader-modules/depth.js.map +0 -1
- package/dist/esm/experimental/shader-modules/pack.js +0 -12
- package/dist/esm/experimental/shader-modules/pack.js.map +0 -1
- package/dist/esm/experimental/shader-modules/ssao.js +0 -21
- package/dist/esm/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/esm/index.js +0 -23
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/denoise.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/huesaturation.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/noise.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/sepia.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/vibrance.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/vignette.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/tiltshift.js +0 -38
- package/dist/esm/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/triangleblur.js +0 -31
- package/dist/esm/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/zoomblur.js +0 -20
- package/dist/esm/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/colorhalftone.js +0 -24
- package/dist/esm/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/dotscreen.js +0 -24
- package/dist/esm/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/edgework.js +0 -31
- package/dist/esm/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
- package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/ink.js +0 -17
- package/dist/esm/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/esm/shader-modules/fxaa/fxaa.js +0 -39
- package/dist/esm/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/esm/shader-modules/utils/random.js +0 -6
- package/dist/esm/shader-modules/utils/random.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/bulgepinch.js +0 -25
- package/dist/esm/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/swirl.js +0 -25
- package/dist/esm/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/warp.js +0 -6
- package/dist/esm/shader-modules/warp-filters/warp.js.map +0 -1
- package/src/experimental/passes/outline-pass.js +0 -58
- package/src/experimental/passes/ssao-pass.js +0 -73
- package/src/experimental/passes/ssao-pass.md +0 -15
- package/src/experimental/shader-modules/convolution.js +0 -96
- package/src/experimental/shader-modules/convolution.md +0 -15
- package/src/experimental/shader-modules/depth.js +0 -84
- package/src/experimental/shader-modules/depth.md +0 -76
- package/src/experimental/shader-modules/pack.js +0 -32
- package/src/experimental/shader-modules/pack.md +0 -15
- package/src/experimental/shader-modules/ssao.js +0 -183
- package/src/experimental/shader-modules/ssao.md +0 -4
- package/src/index.js +0 -35
- package/src/shader-modules/adjust-filters/brightnesscontrast.js +0 -38
- package/src/shader-modules/adjust-filters/denoise.js +0 -49
- package/src/shader-modules/adjust-filters/huesaturation.js +0 -57
- package/src/shader-modules/adjust-filters/noise.js +0 -36
- package/src/shader-modules/adjust-filters/sepia.js +0 -37
- package/src/shader-modules/adjust-filters/vibrance.js +0 -32
- package/src/shader-modules/adjust-filters/vignette.js +0 -33
- package/src/shader-modules/blur-filters/tiltshift.js +0 -105
- package/src/shader-modules/blur-filters/triangleblur.js +0 -55
- package/src/shader-modules/blur-filters/zoomblur.js +0 -56
- package/src/shader-modules/fun-filters/colorhalftone.js +0 -60
- package/src/shader-modules/fun-filters/dotscreen.js +0 -45
- package/src/shader-modules/fun-filters/edgework.js +0 -84
- package/src/shader-modules/fun-filters/hexagonalpixelate.js +0 -63
- package/src/shader-modules/fun-filters/ink.js +0 -49
- package/src/shader-modules/utils/random.js +0 -12
- package/src/shader-modules/warp-filters/bulgepinch.js +0 -52
- package/src/shader-modules/warp-filters/swirl.js +0 -55
- package/src/shader-modules/warp-filters/warp.js +0 -19
|
@@ -0,0 +1,81 @@
|
|
|
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 source = /* wgsl */ `\
|
|
8
|
+
struct brightnessContrastUniforms {
|
|
9
|
+
float brightness;
|
|
10
|
+
float contrast;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Binding 0:1 is reserved for shader passes
|
|
14
|
+
@binding(1) @group(0) var<uniform> brightnessContrast : brightnessContrastUniforms;
|
|
15
|
+
|
|
16
|
+
fn brightnessContrast_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4<f32> {
|
|
17
|
+
color.rgb += brightnessContrast.brightness;
|
|
18
|
+
if (brightnessContrast.contrast > 0.0) {
|
|
19
|
+
color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
|
|
20
|
+
} else {
|
|
21
|
+
color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
|
|
22
|
+
}
|
|
23
|
+
return color;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const fs = /* glsl */ `\
|
|
28
|
+
uniform brightnessContrastUniforms {
|
|
29
|
+
float brightness;
|
|
30
|
+
float contrast;
|
|
31
|
+
} brightnessContrast;
|
|
32
|
+
|
|
33
|
+
vec4 brightnessContrast_filterColor(vec4 color) {
|
|
34
|
+
color.rgb += brightnessContrast.brightness;
|
|
35
|
+
if (brightnessContrast.contrast > 0.0) {
|
|
36
|
+
color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
|
|
37
|
+
} else {
|
|
38
|
+
color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
|
|
39
|
+
}
|
|
40
|
+
return color;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vec4 brightnessContrast_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
44
|
+
return brightnessContrast_filterColor(color);
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
export type BrightnessContrastProps = {
|
|
49
|
+
brightness?: number;
|
|
50
|
+
contrast?: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type BrightnessContrastUniforms = BrightnessContrastProps;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Brightness / Contrast -
|
|
57
|
+
* Provides additive brightness and multiplicative contrast control.
|
|
58
|
+
* @param brightness -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
|
|
59
|
+
* @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
|
|
60
|
+
*/
|
|
61
|
+
export const brightnessContrast = {
|
|
62
|
+
props: {} as BrightnessContrastProps,
|
|
63
|
+
|
|
64
|
+
name: 'brightnessContrast',
|
|
65
|
+
uniformTypes: {
|
|
66
|
+
brightness: 'f32',
|
|
67
|
+
contrast: 'f32'
|
|
68
|
+
},
|
|
69
|
+
defaultUniforms: {
|
|
70
|
+
brightness: 0,
|
|
71
|
+
contrast: 0
|
|
72
|
+
},
|
|
73
|
+
propTypes: {
|
|
74
|
+
brightness: {format: 'f32', value: 0, min: -1, max: 1},
|
|
75
|
+
contrast: {format: 'f32', value: 0, min: -1, max: 1}
|
|
76
|
+
},
|
|
77
|
+
passes: [{filter: true}],
|
|
78
|
+
|
|
79
|
+
source,
|
|
80
|
+
fs
|
|
81
|
+
} as const satisfies ShaderPass<BrightnessContrastProps>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
// Do a 9x9 bilateral box filter
|
|
8
|
+
const source = /* wgsl */ `\
|
|
9
|
+
|
|
10
|
+
@group(?), @binding(?) var<uniform> denoiseUniforms { strength: f32 } noise;
|
|
11
|
+
|
|
12
|
+
fn denoise_sampleColor(source: sampler2D, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {
|
|
13
|
+
let adjustedExponent: f32 = 3. + 200. * pow(1. - noise.strength, 4.);
|
|
14
|
+
let center: vec4<f32> = sample_texture(BUFFER_source, texCoord);
|
|
15
|
+
var color: vec4<f32> = vec4<f32>(0.);
|
|
16
|
+
var total: f32 = 0.;
|
|
17
|
+
|
|
18
|
+
for (var x: f32 = -4.; x <= 4.; x = x + (1.)) {
|
|
19
|
+
|
|
20
|
+
for (var y: f32 = -4.; y <= 4.; y = y + (1.)) {
|
|
21
|
+
let offsetColor: vec4<f32> = sample_texture(BUFFER_source, texCoord + vec2<f32>(x, y) / texSize);
|
|
22
|
+
var weight: f32 = 1. - abs(dot(offsetColor.rgb - center.rgb, vec3<f32>(0.25)));
|
|
23
|
+
weight = pow(weight, adjustedExponent);
|
|
24
|
+
color = color + (offsetColor * weight);
|
|
25
|
+
total = total + (weight);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return color / total;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const fs = /* glsl */ `\
|
|
35
|
+
uniform denoiseUniforms {
|
|
36
|
+
float strength;
|
|
37
|
+
} noise;
|
|
38
|
+
|
|
39
|
+
vec4 denoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
40
|
+
float adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);
|
|
41
|
+
|
|
42
|
+
vec4 center = texture(source, texCoord);
|
|
43
|
+
vec4 color = vec4(0.0);
|
|
44
|
+
float total = 0.0;
|
|
45
|
+
for (float x = -4.0; x <= 4.0; x += 1.0) {
|
|
46
|
+
for (float y = -4.0; y <= 4.0; y += 1.0) {
|
|
47
|
+
vec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);
|
|
48
|
+
float weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));
|
|
49
|
+
weight = pow(weight, adjustedExponent);
|
|
50
|
+
color += offsetColor * weight;
|
|
51
|
+
total += weight;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return color / total;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Denoise -
|
|
61
|
+
* Smooths over grainy noise in dark images using an 9x9 box filter
|
|
62
|
+
* weighted by color intensity, similar to a bilateral filter.
|
|
63
|
+
*/
|
|
64
|
+
export type DenoiseProps = {
|
|
65
|
+
/**
|
|
66
|
+
* The exponent of the color intensity difference, should be greater
|
|
67
|
+
* than zero. A value of zero just gives an 9x9 box blur and high values
|
|
68
|
+
* give the original image, but ideal values are usually around 10-20.
|
|
69
|
+
*/
|
|
70
|
+
strength?: number;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type DenoiseUniforms = DenoiseProps;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Denoise -
|
|
77
|
+
* Smooths over grainy noise in dark images using an 9x9 box filter
|
|
78
|
+
* weighted by color intensity, similar to a bilateral filter.
|
|
79
|
+
*/
|
|
80
|
+
export const denoise = {
|
|
81
|
+
props: {} as DenoiseProps,
|
|
82
|
+
uniforms: {} as DenoiseUniforms,
|
|
83
|
+
|
|
84
|
+
name: 'denoise',
|
|
85
|
+
uniformTypes: {
|
|
86
|
+
strength: 'f32'
|
|
87
|
+
},
|
|
88
|
+
propTypes: {
|
|
89
|
+
strength: {format: 'f32', value: 0.5, min: 0, max: 1}
|
|
90
|
+
// strength: {..., adjust: (strength: number): number => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
source,
|
|
94
|
+
fs,
|
|
95
|
+
|
|
96
|
+
passes: [{sampler: true}, {sampler: true}]
|
|
97
|
+
} as const satisfies ShaderPass<DenoiseProps, DenoiseUniforms>;
|
|
@@ -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
|
+
|
|
7
|
+
const source = /* wgsl */ `\
|
|
8
|
+
@group(?), @binding(?)
|
|
9
|
+
var<uniform> hueSaturationUniforms { hue: f32,
|
|
10
|
+
|
|
11
|
+
saturation: f32,
|
|
12
|
+
|
|
13
|
+
}hueSaturation;
|
|
14
|
+
|
|
15
|
+
fn hueSaturation_filterColor(color: vec4<f32>) -> vec4<f32> {
|
|
16
|
+
let angle: f32 = hueSaturation.hue * 3.1415927;
|
|
17
|
+
let s: f32 = sin(angle);
|
|
18
|
+
let c: f32 = cos(angle);
|
|
19
|
+
let weights: vec3<f32> = (vec3<f32>(2. * c, -sqrt(3.) * s - c, sqrt(3.) * s - c) + 1.) / 3.;
|
|
20
|
+
let len: f32 = length(color.rgb);
|
|
21
|
+
var colorrgb = color.rgb;
|
|
22
|
+
colorrgb = vec3<f32>(dot(color.rgb, weights.xyz), dot(color.rgb, weights.zxy), dot(color.rgb, weights.yzx));
|
|
23
|
+
color.r = colorrgb.x;
|
|
24
|
+
color.g = colorrgb.y;
|
|
25
|
+
color.b = colorrgb.z;
|
|
26
|
+
let average: f32 = (color.r + color.g + color.b) / 3.;
|
|
27
|
+
if (hueSaturation.saturation > 0.) {
|
|
28
|
+
var colorrgb = color.rgb;
|
|
29
|
+
colorrgb = color.rgb + ((average - color.rgb) * (1. - 1. / (1.001 - hueSaturation.saturation)));
|
|
30
|
+
color.r = colorrgb.x;
|
|
31
|
+
color.g = colorrgb.y;
|
|
32
|
+
color.b = colorrgb.z;
|
|
33
|
+
} else {
|
|
34
|
+
var colorrgb = color.rgb;
|
|
35
|
+
colorrgb = color.rgb + ((average - color.rgb) * -hueSaturation.saturation);
|
|
36
|
+
color.r = colorrgb.x;
|
|
37
|
+
color.g = colorrgb.y;
|
|
38
|
+
color.b = colorrgb.z;
|
|
39
|
+
}
|
|
40
|
+
return color;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fn hueSaturation_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {
|
|
44
|
+
return hueSaturation_filterColor(color);
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const fs = /* glsl */ `\
|
|
49
|
+
uniform hueSaturationUniforms {
|
|
50
|
+
float hue;
|
|
51
|
+
float saturation;
|
|
52
|
+
} hueSaturation;
|
|
53
|
+
|
|
54
|
+
vec4 hueSaturation_filterColor(vec4 color) {
|
|
55
|
+
// hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]
|
|
56
|
+
float angle = hueSaturation.hue * 3.14159265;
|
|
57
|
+
float s = sin(angle), c = cos(angle);
|
|
58
|
+
vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
|
|
59
|
+
float len = length(color.rgb);
|
|
60
|
+
color.rgb = vec3(
|
|
61
|
+
dot(color.rgb, weights.xyz),
|
|
62
|
+
dot(color.rgb, weights.zxy),
|
|
63
|
+
dot(color.rgb, weights.yzx)
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// saturation adjustment
|
|
67
|
+
float average = (color.r + color.g + color.b) / 3.0;
|
|
68
|
+
if (hueSaturation.saturation > 0.0) {
|
|
69
|
+
color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));
|
|
70
|
+
} else {
|
|
71
|
+
color.rgb += (average - color.rgb) * (-hueSaturation.saturation);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return color;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
vec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
78
|
+
return hueSaturation_filterColor(color);
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Hue / Saturation
|
|
84
|
+
*/
|
|
85
|
+
export type HueSaturationProps = {
|
|
86
|
+
/** -1 to 1 (-1 is 180 degree rotation in the negative direction, 0 is no change,
|
|
87
|
+
* and 1 is 180 degree rotation in the positive direction) */
|
|
88
|
+
hue?: number;
|
|
89
|
+
/** -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) */
|
|
90
|
+
saturation?: number;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type HueSaturationUniforms = HueSaturationProps;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Hue / Saturation
|
|
97
|
+
* Provides rotational hue and multiplicative saturation control. RGB color space
|
|
98
|
+
* can be imagined as a cube where the axes are the red, green, and blue color
|
|
99
|
+
* values. Hue changing works by rotating the color vector around the grayscale
|
|
100
|
+
* line, which is the straight line from black (0, 0, 0) to white (1, 1, 1).
|
|
101
|
+
* Saturation is implemented by scaling all color channel values either toward
|
|
102
|
+
* or away from the average color channel value.
|
|
103
|
+
*/
|
|
104
|
+
export const hueSaturation = {
|
|
105
|
+
props: {} as HueSaturationProps,
|
|
106
|
+
|
|
107
|
+
name: 'hueSaturation',
|
|
108
|
+
source,
|
|
109
|
+
fs,
|
|
110
|
+
|
|
111
|
+
uniformTypes: {
|
|
112
|
+
hue: 'f32',
|
|
113
|
+
saturation: 'f32'
|
|
114
|
+
},
|
|
115
|
+
propTypes: {
|
|
116
|
+
hue: {value: 0, min: -1, max: 1},
|
|
117
|
+
saturation: {value: 0, min: -1, max: 1}
|
|
118
|
+
},
|
|
119
|
+
passes: [{filter: true}]
|
|
120
|
+
} as const satisfies ShaderPass<HueSaturationProps>;
|
|
@@ -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 source = /* wgsl */ `\
|
|
8
|
+
struct noiseUniforms {
|
|
9
|
+
amount: f32
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
@group(0), @binding(0) var<uniform> noise: NoiseUniforms;
|
|
13
|
+
|
|
14
|
+
fn rand(co: vec2<f32>) -> f32 {
|
|
15
|
+
return fract(sin(dot(co.xy, vec2<f32>(12.9898, 78.233))) * 43758.547);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fn noise_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {
|
|
19
|
+
let diff: f32 = (rand(texCoord) - 0.5) * noise.amount;
|
|
20
|
+
color.r = color.r + (diff);
|
|
21
|
+
color.g = color.g + (diff);
|
|
22
|
+
color.b = color.b + (diff);
|
|
23
|
+
return color;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const fs = /* glsl */ `\
|
|
28
|
+
uniform noiseUniforms {
|
|
29
|
+
float amount;
|
|
30
|
+
} noise;
|
|
31
|
+
|
|
32
|
+
float rand(vec2 co) {
|
|
33
|
+
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
vec4 noise_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
37
|
+
float diff = (rand(texCoord) - 0.5) * noise.amount;
|
|
38
|
+
color.r += diff;
|
|
39
|
+
color.g += diff;
|
|
40
|
+
color.b += diff;
|
|
41
|
+
return color;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Noise - Adds black and white noise to the image.
|
|
47
|
+
*/
|
|
48
|
+
export type NoiseProps = {
|
|
49
|
+
/** 0 to 1 (0 for no effect, 1 for maximum noise) */
|
|
50
|
+
amount?: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type NoiseUniforms = NoiseProps;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Noise
|
|
57
|
+
* Adds black and white noise to the image.
|
|
58
|
+
*/
|
|
59
|
+
export const noise = {
|
|
60
|
+
props: {} as NoiseProps,
|
|
61
|
+
uniforms: {} as NoiseUniforms,
|
|
62
|
+
|
|
63
|
+
name: 'noise',
|
|
64
|
+
uniformTypes: {
|
|
65
|
+
amount: 'f32'
|
|
66
|
+
},
|
|
67
|
+
propTypes: {
|
|
68
|
+
amount: {value: 0.5, min: 0, max: 1}
|
|
69
|
+
},
|
|
70
|
+
fs,
|
|
71
|
+
source,
|
|
72
|
+
passes: [{filter: true}]
|
|
73
|
+
} as const satisfies ShaderPass<NoiseProps, NoiseProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 sepiaUniforms {
|
|
9
|
+
float amount;
|
|
10
|
+
} sepia;
|
|
11
|
+
|
|
12
|
+
vec4 sepia_filterColor(vec4 color) {
|
|
13
|
+
float r = color.r;
|
|
14
|
+
float g = color.g;
|
|
15
|
+
float b = color.b;
|
|
16
|
+
|
|
17
|
+
color.r =
|
|
18
|
+
min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));
|
|
19
|
+
color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));
|
|
20
|
+
color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));
|
|
21
|
+
|
|
22
|
+
return color;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
26
|
+
return sepia_filterColor(color);
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export type SepiaProps = {
|
|
31
|
+
amount?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type SepiaUniforms = SepiaProps;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @filter Sepia
|
|
38
|
+
* @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.
|
|
39
|
+
* @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)
|
|
40
|
+
*/
|
|
41
|
+
export const sepia = {
|
|
42
|
+
props: {} as SepiaProps,
|
|
43
|
+
uniforms: {} as SepiaUniforms,
|
|
44
|
+
|
|
45
|
+
name: 'sepia',
|
|
46
|
+
uniformTypes: {
|
|
47
|
+
amount: 'f32'
|
|
48
|
+
},
|
|
49
|
+
propTypes: {
|
|
50
|
+
amount: {value: 0.5, min: 0, max: 1}
|
|
51
|
+
},
|
|
52
|
+
fs,
|
|
53
|
+
passes: [{filter: true}]
|
|
54
|
+
} as const satisfies ShaderPass<SepiaProps, SepiaProps>;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 vibranceUniforms {
|
|
9
|
+
float amount;
|
|
10
|
+
} vibrance;
|
|
11
|
+
|
|
12
|
+
vec4 vibrance_filterColor(vec4 color) {
|
|
13
|
+
float average = (color.r + color.g + color.b) / 3.0;
|
|
14
|
+
float mx = max(color.r, max(color.g, color.b));
|
|
15
|
+
float amt = (mx - average) * (-vibrance.amount * 3.0);
|
|
16
|
+
color.rgb = mix(color.rgb, vec3(mx), amt);
|
|
17
|
+
return color;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
vec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
21
|
+
return vibrance_filterColor(color);
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified.
|
|
27
|
+
*/
|
|
28
|
+
export type VibranceProps = {
|
|
29
|
+
/** -1 to 1 (-1 is minimum vibrance, 0 is no change, and 1 is maximum vibrance) */
|
|
30
|
+
amount?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type VibranceUniforms = VibranceProps;
|
|
34
|
+
|
|
35
|
+
/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */
|
|
36
|
+
export const vibrance = {
|
|
37
|
+
props: {} as VibranceProps,
|
|
38
|
+
uniforms: {} as VibranceUniforms,
|
|
39
|
+
name: 'vibrance',
|
|
40
|
+
uniformTypes: {
|
|
41
|
+
amount: 'f32'
|
|
42
|
+
},
|
|
43
|
+
propTypes: {
|
|
44
|
+
amount: {value: 0, min: -1, max: 1}
|
|
45
|
+
},
|
|
46
|
+
fs,
|
|
47
|
+
passes: [{filter: true}]
|
|
48
|
+
} as const satisfies ShaderPass<VibranceProps, VibranceProps>;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 vignetteUniforms {
|
|
9
|
+
float radius;
|
|
10
|
+
float amount;
|
|
11
|
+
} vignette;
|
|
12
|
+
|
|
13
|
+
vec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
14
|
+
float dist = distance(texCoord, vec2(0.5, 0.5));
|
|
15
|
+
float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));
|
|
16
|
+
return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Vignette - Adds a simulated lens edge darkening effect.
|
|
22
|
+
*/
|
|
23
|
+
export type VignetteProps = {
|
|
24
|
+
/** 0 to 1 (0 for center of frame, 1 for edge of frame) */
|
|
25
|
+
radius?: number;
|
|
26
|
+
/** 0 to 1 (0 for no effect, 1 for maximum lens darkening) */
|
|
27
|
+
amount?: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type VignetteUniforms = VignetteProps;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Vignette -
|
|
34
|
+
* Adds a simulated lens edge darkening effect.
|
|
35
|
+
*/
|
|
36
|
+
export const vignette = {
|
|
37
|
+
props: {} as VignetteProps,
|
|
38
|
+
uniforms: {} as VignetteUniforms,
|
|
39
|
+
|
|
40
|
+
name: 'vignette',
|
|
41
|
+
|
|
42
|
+
uniformTypes: {
|
|
43
|
+
radius: 'f32',
|
|
44
|
+
amount: 'f32'
|
|
45
|
+
},
|
|
46
|
+
defaultUniforms: {
|
|
47
|
+
radius: 0.5,
|
|
48
|
+
amount: 0.5
|
|
49
|
+
},
|
|
50
|
+
propTypes: {
|
|
51
|
+
radius: {value: 0.5, min: 0, max: 1},
|
|
52
|
+
amount: {value: 0.5, min: 0, max: 1}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
passes: [{filter: true}],
|
|
56
|
+
|
|
57
|
+
fs
|
|
58
|
+
} as const satisfies ShaderPass<VignetteProps, VignetteProps>;
|
|
@@ -0,0 +1,135 @@
|
|
|
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 tiltShiftUniforms {
|
|
10
|
+
float blurRadius;
|
|
11
|
+
float gradientRadius;
|
|
12
|
+
vec2 start;
|
|
13
|
+
vec2 end;
|
|
14
|
+
bool invert;
|
|
15
|
+
} tiltShift;
|
|
16
|
+
|
|
17
|
+
vec2 tiltShift_getDelta(vec2 texSize) {
|
|
18
|
+
vec2 vector = normalize((tiltShift.end - tiltShift.start) * texSize);
|
|
19
|
+
return tiltShift.invert ? vec2(-vector.y, vector.x) : vector;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
vec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
23
|
+
vec4 color = vec4(0.0);
|
|
24
|
+
float total = 0.0;
|
|
25
|
+
|
|
26
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
27
|
+
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
28
|
+
|
|
29
|
+
vec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));
|
|
30
|
+
float radius = smoothstep(0.0, 1.0,
|
|
31
|
+
abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;
|
|
32
|
+
|
|
33
|
+
for (float t = -30.0; t <= 30.0; t++) {
|
|
34
|
+
float percent = (t + offset - 0.5) / 30.0;
|
|
35
|
+
float weight = 1.0 - abs(percent);
|
|
36
|
+
vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
|
|
37
|
+
|
|
38
|
+
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
39
|
+
offsetColor.rgb *= offsetColor.a;
|
|
40
|
+
|
|
41
|
+
color += offsetColor * weight;
|
|
42
|
+
total += weight;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
color = color / total;
|
|
46
|
+
|
|
47
|
+
/* switch back from pre-multiplied alpha */
|
|
48
|
+
color.rgb /= color.a + 0.00001;
|
|
49
|
+
|
|
50
|
+
return color;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Tilt Shift
|
|
56
|
+
* Simulates the shallow depth of field normally encountered in close-up photography
|
|
57
|
+
*/
|
|
58
|
+
export type TiltShiftProps = {
|
|
59
|
+
/** The x,y coordinate of the start of the line segment. */
|
|
60
|
+
start?: [number, number];
|
|
61
|
+
/** The xm y coordinate of the end of the line segment. */
|
|
62
|
+
end?: [number, number];
|
|
63
|
+
/** The maximum radius of the pyramid blur. */
|
|
64
|
+
blurRadius?: number;
|
|
65
|
+
/** The distance from the line at which the maximum blur radius is reached. */
|
|
66
|
+
gradientRadius?: number;
|
|
67
|
+
/** @deprecated internal shaderpass use */
|
|
68
|
+
invert?: number;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type TiltShiftUniforms = TiltShiftProps;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Tilt Shift
|
|
75
|
+
* Simulates the shallow depth of field normally encountered in close-up
|
|
76
|
+
* photography, which makes the scene seem much smaller than it actually
|
|
77
|
+
* is. This filter assumes the scene is relatively planar, in which case
|
|
78
|
+
* the part of the scene that is completely in focus can be described by
|
|
79
|
+
* a line (the intersection of the focal plane and the scene). An example
|
|
80
|
+
* of a planar scene might be looking at a road from above at a downward
|
|
81
|
+
* angle. The image is then blurred with a blur radius that starts at zero
|
|
82
|
+
* on the line and increases further from the line.
|
|
83
|
+
*/
|
|
84
|
+
export const tiltShift = {
|
|
85
|
+
props: {} as TiltShiftProps,
|
|
86
|
+
uniforms: {} as TiltShiftUniforms,
|
|
87
|
+
|
|
88
|
+
name: 'tiltShift',
|
|
89
|
+
dependencies: [random],
|
|
90
|
+
uniformTypes: {
|
|
91
|
+
blurRadius: 'f32',
|
|
92
|
+
gradientRadius: 'f32',
|
|
93
|
+
start: 'vec2<f32>',
|
|
94
|
+
end: 'vec2<f32>',
|
|
95
|
+
invert: 'i32'
|
|
96
|
+
},
|
|
97
|
+
propTypes: {
|
|
98
|
+
blurRadius: {value: 15, min: 0, max: 50},
|
|
99
|
+
gradientRadius: {value: 200, min: 0, max: 400},
|
|
100
|
+
start: {value: [0, 0]},
|
|
101
|
+
end: {value: [1, 1]},
|
|
102
|
+
invert: {value: 0, private: true}
|
|
103
|
+
},
|
|
104
|
+
passes: [
|
|
105
|
+
{sampler: true, uniforms: {invert: 0}},
|
|
106
|
+
{sampler: true, uniforms: {invert: 1}}
|
|
107
|
+
],
|
|
108
|
+
fs
|
|
109
|
+
} as const satisfies ShaderPass<TiltShiftProps, TiltShiftProps>;
|
|
110
|
+
|
|
111
|
+
/*
|
|
112
|
+
function tiltShift(startX, startY, endX, endY, blurRadius, gradientRadius) {
|
|
113
|
+
var dx = endX - startX;
|
|
114
|
+
var dy = endY - startY;
|
|
115
|
+
var d = Math.sqrt(dx * dx + dy * dy);
|
|
116
|
+
simpleShader.call(this, gl.tiltShift, {
|
|
117
|
+
blurRadius: blurRadius,
|
|
118
|
+
gradientRadius: gradientRadius,
|
|
119
|
+
start: [startX, startY],
|
|
120
|
+
end: [endX, endY],
|
|
121
|
+
delta: [dx / d, dy / d],
|
|
122
|
+
texSize: [this.width, this.height]
|
|
123
|
+
});
|
|
124
|
+
simpleShader.call(this, gl.tiltShift, {
|
|
125
|
+
blurRadius: blurRadius,
|
|
126
|
+
gradientRadius: gradientRadius,
|
|
127
|
+
start: [startX, startY],
|
|
128
|
+
end: [endX, endY],
|
|
129
|
+
delta: [-dy / d, dx / d],
|
|
130
|
+
texSize: [this.width, this.height]
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
*/
|