@luma.gl/effects 7.4.0-alpha.2 → 9.1.0-beta.1
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
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1724 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// dist/index.js
|
|
21
|
+
var dist_exports = {};
|
|
22
|
+
__export(dist_exports, {
|
|
23
|
+
_warp: () => warp,
|
|
24
|
+
brightnessContrast: () => brightnessContrast,
|
|
25
|
+
bulgePinch: () => bulgePinch,
|
|
26
|
+
colorHalftone: () => colorHalftone,
|
|
27
|
+
denoise: () => denoise,
|
|
28
|
+
dotScreen: () => dotScreen,
|
|
29
|
+
edgeWork: () => edgeWork,
|
|
30
|
+
fxaa: () => fxaa,
|
|
31
|
+
hexagonalPixelate: () => hexagonalPixelate,
|
|
32
|
+
hueSaturation: () => hueSaturation,
|
|
33
|
+
ink: () => ink,
|
|
34
|
+
magnify: () => magnify,
|
|
35
|
+
noise: () => noise,
|
|
36
|
+
sepia: () => sepia,
|
|
37
|
+
swirl: () => swirl,
|
|
38
|
+
tiltShift: () => tiltShift,
|
|
39
|
+
triangleBlur: () => triangleBlur,
|
|
40
|
+
vibrance: () => vibrance,
|
|
41
|
+
vignette: () => vignette,
|
|
42
|
+
zoomBlur: () => zoomBlur
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(dist_exports);
|
|
45
|
+
|
|
46
|
+
// dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js
|
|
47
|
+
var source = (
|
|
48
|
+
/* wgsl */
|
|
49
|
+
`struct brightnessContrastUniforms {
|
|
50
|
+
float brightness;
|
|
51
|
+
float contrast;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Binding 0:1 is reserved for shader passes
|
|
55
|
+
@binding(1) @group(0) var<uniform> brightnessContrast : brightnessContrastUniforms;
|
|
56
|
+
|
|
57
|
+
fn brightnessContrast_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4<f32> {
|
|
58
|
+
color.rgb += brightnessContrast.brightness;
|
|
59
|
+
if (brightnessContrast.contrast > 0.0) {
|
|
60
|
+
color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
|
|
61
|
+
} else {
|
|
62
|
+
color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
|
|
63
|
+
}
|
|
64
|
+
return color;
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
);
|
|
68
|
+
var fs = (
|
|
69
|
+
/* glsl */
|
|
70
|
+
`uniform brightnessContrastUniforms {
|
|
71
|
+
float brightness;
|
|
72
|
+
float contrast;
|
|
73
|
+
} brightnessContrast;
|
|
74
|
+
|
|
75
|
+
vec4 brightnessContrast_filterColor(vec4 color) {
|
|
76
|
+
color.rgb += brightnessContrast.brightness;
|
|
77
|
+
if (brightnessContrast.contrast > 0.0) {
|
|
78
|
+
color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
|
|
79
|
+
} else {
|
|
80
|
+
color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
|
|
81
|
+
}
|
|
82
|
+
return color;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
vec4 brightnessContrast_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
86
|
+
return brightnessContrast_filterColor(color);
|
|
87
|
+
}
|
|
88
|
+
`
|
|
89
|
+
);
|
|
90
|
+
var brightnessContrast = {
|
|
91
|
+
props: {},
|
|
92
|
+
name: "brightnessContrast",
|
|
93
|
+
uniformTypes: {
|
|
94
|
+
brightness: "f32",
|
|
95
|
+
contrast: "f32"
|
|
96
|
+
},
|
|
97
|
+
defaultUniforms: {
|
|
98
|
+
brightness: 0,
|
|
99
|
+
contrast: 0
|
|
100
|
+
},
|
|
101
|
+
propTypes: {
|
|
102
|
+
brightness: { format: "f32", value: 0, min: -1, max: 1 },
|
|
103
|
+
contrast: { format: "f32", value: 0, min: -1, max: 1 }
|
|
104
|
+
},
|
|
105
|
+
passes: [{ filter: true }],
|
|
106
|
+
source,
|
|
107
|
+
fs
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// dist/passes/postprocessing/image-adjust-filters/denoise.js
|
|
111
|
+
var source2 = (
|
|
112
|
+
/* wgsl */
|
|
113
|
+
`
|
|
114
|
+
@group(?), @binding(?) var<uniform> denoiseUniforms { strength: f32 } noise;
|
|
115
|
+
|
|
116
|
+
fn denoise_sampleColor(source: sampler2D, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {
|
|
117
|
+
let adjustedExponent: f32 = 3. + 200. * pow(1. - noise.strength, 4.);
|
|
118
|
+
let center: vec4<f32> = sample_texture(BUFFER_source, texCoord);
|
|
119
|
+
var color: vec4<f32> = vec4<f32>(0.);
|
|
120
|
+
var total: f32 = 0.;
|
|
121
|
+
|
|
122
|
+
for (var x: f32 = -4.; x <= 4.; x = x + (1.)) {
|
|
123
|
+
|
|
124
|
+
for (var y: f32 = -4.; y <= 4.; y = y + (1.)) {
|
|
125
|
+
let offsetColor: vec4<f32> = sample_texture(BUFFER_source, texCoord + vec2<f32>(x, y) / texSize);
|
|
126
|
+
var weight: f32 = 1. - abs(dot(offsetColor.rgb - center.rgb, vec3<f32>(0.25)));
|
|
127
|
+
weight = pow(weight, adjustedExponent);
|
|
128
|
+
color = color + (offsetColor * weight);
|
|
129
|
+
total = total + (weight);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return color / total;
|
|
135
|
+
}
|
|
136
|
+
`
|
|
137
|
+
);
|
|
138
|
+
var fs2 = (
|
|
139
|
+
/* glsl */
|
|
140
|
+
`uniform denoiseUniforms {
|
|
141
|
+
float strength;
|
|
142
|
+
} noise;
|
|
143
|
+
|
|
144
|
+
vec4 denoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
145
|
+
float adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);
|
|
146
|
+
|
|
147
|
+
vec4 center = texture(source, texCoord);
|
|
148
|
+
vec4 color = vec4(0.0);
|
|
149
|
+
float total = 0.0;
|
|
150
|
+
for (float x = -4.0; x <= 4.0; x += 1.0) {
|
|
151
|
+
for (float y = -4.0; y <= 4.0; y += 1.0) {
|
|
152
|
+
vec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);
|
|
153
|
+
float weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));
|
|
154
|
+
weight = pow(weight, adjustedExponent);
|
|
155
|
+
color += offsetColor * weight;
|
|
156
|
+
total += weight;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return color / total;
|
|
161
|
+
}
|
|
162
|
+
`
|
|
163
|
+
);
|
|
164
|
+
var denoise = {
|
|
165
|
+
props: {},
|
|
166
|
+
uniforms: {},
|
|
167
|
+
name: "denoise",
|
|
168
|
+
uniformTypes: {
|
|
169
|
+
strength: "f32"
|
|
170
|
+
},
|
|
171
|
+
propTypes: {
|
|
172
|
+
strength: { format: "f32", value: 0.5, min: 0, max: 1 }
|
|
173
|
+
// strength: {..., adjust: (strength: number): number => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing
|
|
174
|
+
},
|
|
175
|
+
source: source2,
|
|
176
|
+
fs: fs2,
|
|
177
|
+
passes: [{ sampler: true }, { sampler: true }]
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// dist/passes/postprocessing/image-adjust-filters/huesaturation.js
|
|
181
|
+
var source3 = (
|
|
182
|
+
/* wgsl */
|
|
183
|
+
`@group(?), @binding(?)
|
|
184
|
+
var<uniform> hueSaturationUniforms { hue: f32,
|
|
185
|
+
|
|
186
|
+
saturation: f32,
|
|
187
|
+
|
|
188
|
+
}hueSaturation;
|
|
189
|
+
|
|
190
|
+
fn hueSaturation_filterColor(color: vec4<f32>) -> vec4<f32> {
|
|
191
|
+
let angle: f32 = hueSaturation.hue * 3.1415927;
|
|
192
|
+
let s: f32 = sin(angle);
|
|
193
|
+
let c: f32 = cos(angle);
|
|
194
|
+
let weights: vec3<f32> = (vec3<f32>(2. * c, -sqrt(3.) * s - c, sqrt(3.) * s - c) + 1.) / 3.;
|
|
195
|
+
let len: f32 = length(color.rgb);
|
|
196
|
+
var colorrgb = color.rgb;
|
|
197
|
+
colorrgb = vec3<f32>(dot(color.rgb, weights.xyz), dot(color.rgb, weights.zxy), dot(color.rgb, weights.yzx));
|
|
198
|
+
color.r = colorrgb.x;
|
|
199
|
+
color.g = colorrgb.y;
|
|
200
|
+
color.b = colorrgb.z;
|
|
201
|
+
let average: f32 = (color.r + color.g + color.b) / 3.;
|
|
202
|
+
if (hueSaturation.saturation > 0.) {
|
|
203
|
+
var colorrgb = color.rgb;
|
|
204
|
+
colorrgb = color.rgb + ((average - color.rgb) * (1. - 1. / (1.001 - hueSaturation.saturation)));
|
|
205
|
+
color.r = colorrgb.x;
|
|
206
|
+
color.g = colorrgb.y;
|
|
207
|
+
color.b = colorrgb.z;
|
|
208
|
+
} else {
|
|
209
|
+
var colorrgb = color.rgb;
|
|
210
|
+
colorrgb = color.rgb + ((average - color.rgb) * -hueSaturation.saturation);
|
|
211
|
+
color.r = colorrgb.x;
|
|
212
|
+
color.g = colorrgb.y;
|
|
213
|
+
color.b = colorrgb.z;
|
|
214
|
+
}
|
|
215
|
+
return color;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
fn hueSaturation_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {
|
|
219
|
+
return hueSaturation_filterColor(color);
|
|
220
|
+
}
|
|
221
|
+
`
|
|
222
|
+
);
|
|
223
|
+
var fs3 = (
|
|
224
|
+
/* glsl */
|
|
225
|
+
`uniform hueSaturationUniforms {
|
|
226
|
+
float hue;
|
|
227
|
+
float saturation;
|
|
228
|
+
} hueSaturation;
|
|
229
|
+
|
|
230
|
+
vec4 hueSaturation_filterColor(vec4 color) {
|
|
231
|
+
// hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]
|
|
232
|
+
float angle = hueSaturation.hue * 3.14159265;
|
|
233
|
+
float s = sin(angle), c = cos(angle);
|
|
234
|
+
vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
|
|
235
|
+
float len = length(color.rgb);
|
|
236
|
+
color.rgb = vec3(
|
|
237
|
+
dot(color.rgb, weights.xyz),
|
|
238
|
+
dot(color.rgb, weights.zxy),
|
|
239
|
+
dot(color.rgb, weights.yzx)
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
// saturation adjustment
|
|
243
|
+
float average = (color.r + color.g + color.b) / 3.0;
|
|
244
|
+
if (hueSaturation.saturation > 0.0) {
|
|
245
|
+
color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));
|
|
246
|
+
} else {
|
|
247
|
+
color.rgb += (average - color.rgb) * (-hueSaturation.saturation);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return color;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
vec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
254
|
+
return hueSaturation_filterColor(color);
|
|
255
|
+
}
|
|
256
|
+
`
|
|
257
|
+
);
|
|
258
|
+
var hueSaturation = {
|
|
259
|
+
props: {},
|
|
260
|
+
name: "hueSaturation",
|
|
261
|
+
source: source3,
|
|
262
|
+
fs: fs3,
|
|
263
|
+
uniformTypes: {
|
|
264
|
+
hue: "f32",
|
|
265
|
+
saturation: "f32"
|
|
266
|
+
},
|
|
267
|
+
propTypes: {
|
|
268
|
+
hue: { value: 0, min: -1, max: 1 },
|
|
269
|
+
saturation: { value: 0, min: -1, max: 1 }
|
|
270
|
+
},
|
|
271
|
+
passes: [{ filter: true }]
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
// dist/passes/postprocessing/image-adjust-filters/noise.js
|
|
275
|
+
var source4 = (
|
|
276
|
+
/* wgsl */
|
|
277
|
+
`struct noiseUniforms {
|
|
278
|
+
amount: f32
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
@group(0), @binding(0) var<uniform> noise: NoiseUniforms;
|
|
282
|
+
|
|
283
|
+
fn rand(co: vec2<f32>) -> f32 {
|
|
284
|
+
return fract(sin(dot(co.xy, vec2<f32>(12.9898, 78.233))) * 43758.547);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
fn noise_filterColor_ext(color: vec4<f32>, texSize: vec2<f32>, texCoord: vec2<f32>) -> vec4<f32> {
|
|
288
|
+
let diff: f32 = (rand(texCoord) - 0.5) * noise.amount;
|
|
289
|
+
color.r = color.r + (diff);
|
|
290
|
+
color.g = color.g + (diff);
|
|
291
|
+
color.b = color.b + (diff);
|
|
292
|
+
return color;
|
|
293
|
+
}
|
|
294
|
+
`
|
|
295
|
+
);
|
|
296
|
+
var fs4 = (
|
|
297
|
+
/* glsl */
|
|
298
|
+
`uniform noiseUniforms {
|
|
299
|
+
float amount;
|
|
300
|
+
} noise;
|
|
301
|
+
|
|
302
|
+
float rand(vec2 co) {
|
|
303
|
+
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
vec4 noise_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
307
|
+
float diff = (rand(texCoord) - 0.5) * noise.amount;
|
|
308
|
+
color.r += diff;
|
|
309
|
+
color.g += diff;
|
|
310
|
+
color.b += diff;
|
|
311
|
+
return color;
|
|
312
|
+
}
|
|
313
|
+
`
|
|
314
|
+
);
|
|
315
|
+
var noise = {
|
|
316
|
+
props: {},
|
|
317
|
+
uniforms: {},
|
|
318
|
+
name: "noise",
|
|
319
|
+
uniformTypes: {
|
|
320
|
+
amount: "f32"
|
|
321
|
+
},
|
|
322
|
+
propTypes: {
|
|
323
|
+
amount: { value: 0.5, min: 0, max: 1 }
|
|
324
|
+
},
|
|
325
|
+
fs: fs4,
|
|
326
|
+
source: source4,
|
|
327
|
+
passes: [{ filter: true }]
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// dist/passes/postprocessing/image-adjust-filters/sepia.js
|
|
331
|
+
var fs5 = (
|
|
332
|
+
/* glsl */
|
|
333
|
+
`uniform sepiaUniforms {
|
|
334
|
+
float amount;
|
|
335
|
+
} sepia;
|
|
336
|
+
|
|
337
|
+
vec4 sepia_filterColor(vec4 color) {
|
|
338
|
+
float r = color.r;
|
|
339
|
+
float g = color.g;
|
|
340
|
+
float b = color.b;
|
|
341
|
+
|
|
342
|
+
color.r =
|
|
343
|
+
min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));
|
|
344
|
+
color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));
|
|
345
|
+
color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));
|
|
346
|
+
|
|
347
|
+
return color;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
vec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
351
|
+
return sepia_filterColor(color);
|
|
352
|
+
}
|
|
353
|
+
`
|
|
354
|
+
);
|
|
355
|
+
var sepia = {
|
|
356
|
+
props: {},
|
|
357
|
+
uniforms: {},
|
|
358
|
+
name: "sepia",
|
|
359
|
+
uniformTypes: {
|
|
360
|
+
amount: "f32"
|
|
361
|
+
},
|
|
362
|
+
propTypes: {
|
|
363
|
+
amount: { value: 0.5, min: 0, max: 1 }
|
|
364
|
+
},
|
|
365
|
+
fs: fs5,
|
|
366
|
+
passes: [{ filter: true }]
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// dist/passes/postprocessing/image-adjust-filters/vibrance.js
|
|
370
|
+
var fs6 = (
|
|
371
|
+
/* glsl */
|
|
372
|
+
`uniform vibranceUniforms {
|
|
373
|
+
float amount;
|
|
374
|
+
} vibrance;
|
|
375
|
+
|
|
376
|
+
vec4 vibrance_filterColor(vec4 color) {
|
|
377
|
+
float average = (color.r + color.g + color.b) / 3.0;
|
|
378
|
+
float mx = max(color.r, max(color.g, color.b));
|
|
379
|
+
float amt = (mx - average) * (-vibrance.amount * 3.0);
|
|
380
|
+
color.rgb = mix(color.rgb, vec3(mx), amt);
|
|
381
|
+
return color;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
vec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
385
|
+
return vibrance_filterColor(color);
|
|
386
|
+
}
|
|
387
|
+
`
|
|
388
|
+
);
|
|
389
|
+
var vibrance = {
|
|
390
|
+
props: {},
|
|
391
|
+
uniforms: {},
|
|
392
|
+
name: "vibrance",
|
|
393
|
+
uniformTypes: {
|
|
394
|
+
amount: "f32"
|
|
395
|
+
},
|
|
396
|
+
propTypes: {
|
|
397
|
+
amount: { value: 0, min: -1, max: 1 }
|
|
398
|
+
},
|
|
399
|
+
fs: fs6,
|
|
400
|
+
passes: [{ filter: true }]
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// dist/passes/postprocessing/image-adjust-filters/vignette.js
|
|
404
|
+
var fs7 = (
|
|
405
|
+
/* glsl */
|
|
406
|
+
`uniform vignetteUniforms {
|
|
407
|
+
float radius;
|
|
408
|
+
float amount;
|
|
409
|
+
} vignette;
|
|
410
|
+
|
|
411
|
+
vec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
412
|
+
float dist = distance(texCoord, vec2(0.5, 0.5));
|
|
413
|
+
float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));
|
|
414
|
+
return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);
|
|
415
|
+
}
|
|
416
|
+
`
|
|
417
|
+
);
|
|
418
|
+
var vignette = {
|
|
419
|
+
props: {},
|
|
420
|
+
uniforms: {},
|
|
421
|
+
name: "vignette",
|
|
422
|
+
uniformTypes: {
|
|
423
|
+
radius: "f32",
|
|
424
|
+
amount: "f32"
|
|
425
|
+
},
|
|
426
|
+
defaultUniforms: {
|
|
427
|
+
radius: 0.5,
|
|
428
|
+
amount: 0.5
|
|
429
|
+
},
|
|
430
|
+
propTypes: {
|
|
431
|
+
radius: { value: 0.5, min: 0, max: 1 },
|
|
432
|
+
amount: { value: 0.5, min: 0, max: 1 }
|
|
433
|
+
},
|
|
434
|
+
passes: [{ filter: true }],
|
|
435
|
+
fs: fs7
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// dist/passes/postprocessing/image-blur-filters/tiltshift.js
|
|
439
|
+
var import_shadertools = require("@luma.gl/shadertools");
|
|
440
|
+
var fs8 = (
|
|
441
|
+
/* glsl */
|
|
442
|
+
`uniform tiltShiftUniforms {
|
|
443
|
+
float blurRadius;
|
|
444
|
+
float gradientRadius;
|
|
445
|
+
vec2 start;
|
|
446
|
+
vec2 end;
|
|
447
|
+
bool invert;
|
|
448
|
+
} tiltShift;
|
|
449
|
+
|
|
450
|
+
vec2 tiltShift_getDelta(vec2 texSize) {
|
|
451
|
+
vec2 vector = normalize((tiltShift.end - tiltShift.start) * texSize);
|
|
452
|
+
return tiltShift.invert ? vec2(-vector.y, vector.x) : vector;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
vec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
456
|
+
vec4 color = vec4(0.0);
|
|
457
|
+
float total = 0.0;
|
|
458
|
+
|
|
459
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
460
|
+
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
461
|
+
|
|
462
|
+
vec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));
|
|
463
|
+
float radius = smoothstep(0.0, 1.0,
|
|
464
|
+
abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;
|
|
465
|
+
|
|
466
|
+
for (float t = -30.0; t <= 30.0; t++) {
|
|
467
|
+
float percent = (t + offset - 0.5) / 30.0;
|
|
468
|
+
float weight = 1.0 - abs(percent);
|
|
469
|
+
vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
|
|
470
|
+
|
|
471
|
+
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
472
|
+
offsetColor.rgb *= offsetColor.a;
|
|
473
|
+
|
|
474
|
+
color += offsetColor * weight;
|
|
475
|
+
total += weight;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
color = color / total;
|
|
479
|
+
|
|
480
|
+
/* switch back from pre-multiplied alpha */
|
|
481
|
+
color.rgb /= color.a + 0.00001;
|
|
482
|
+
|
|
483
|
+
return color;
|
|
484
|
+
}
|
|
485
|
+
`
|
|
486
|
+
);
|
|
487
|
+
var tiltShift = {
|
|
488
|
+
props: {},
|
|
489
|
+
uniforms: {},
|
|
490
|
+
name: "tiltShift",
|
|
491
|
+
dependencies: [import_shadertools.random],
|
|
492
|
+
uniformTypes: {
|
|
493
|
+
blurRadius: "f32",
|
|
494
|
+
gradientRadius: "f32",
|
|
495
|
+
start: "vec2<f32>",
|
|
496
|
+
end: "vec2<f32>",
|
|
497
|
+
invert: "i32"
|
|
498
|
+
},
|
|
499
|
+
propTypes: {
|
|
500
|
+
blurRadius: { value: 15, min: 0, max: 50 },
|
|
501
|
+
gradientRadius: { value: 200, min: 0, max: 400 },
|
|
502
|
+
start: { value: [0, 0] },
|
|
503
|
+
end: { value: [1, 1] },
|
|
504
|
+
invert: { value: 0, private: true }
|
|
505
|
+
},
|
|
506
|
+
passes: [
|
|
507
|
+
{ sampler: true, uniforms: { invert: 0 } },
|
|
508
|
+
{ sampler: true, uniforms: { invert: 1 } }
|
|
509
|
+
],
|
|
510
|
+
fs: fs8
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// dist/passes/postprocessing/image-blur-filters/triangleblur.js
|
|
514
|
+
var import_shadertools2 = require("@luma.gl/shadertools");
|
|
515
|
+
var fs9 = (
|
|
516
|
+
/* glsl */
|
|
517
|
+
`uniform triangleBlurUniforms {
|
|
518
|
+
float radius;
|
|
519
|
+
vec2 delta;
|
|
520
|
+
} triangleBlur;
|
|
521
|
+
|
|
522
|
+
vec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
523
|
+
vec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;
|
|
524
|
+
|
|
525
|
+
vec4 color = vec4(0.0);
|
|
526
|
+
float total = 0.0;
|
|
527
|
+
|
|
528
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
529
|
+
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
530
|
+
|
|
531
|
+
for (float t = -30.0; t <= 30.0; t++) {
|
|
532
|
+
float percent = (t + offset - 0.5) / 30.0;
|
|
533
|
+
float weight = 1.0 - abs(percent);
|
|
534
|
+
vec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);
|
|
535
|
+
|
|
536
|
+
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
537
|
+
offsetColor.rgb *= offsetColor.a;
|
|
538
|
+
|
|
539
|
+
color += offsetColor * weight;
|
|
540
|
+
total += weight;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
color = color / total;
|
|
544
|
+
|
|
545
|
+
/* switch back from pre-multiplied alpha */
|
|
546
|
+
color.rgb /= color.a + 0.00001;
|
|
547
|
+
|
|
548
|
+
return color;
|
|
549
|
+
}
|
|
550
|
+
`
|
|
551
|
+
);
|
|
552
|
+
var triangleBlur = {
|
|
553
|
+
props: {},
|
|
554
|
+
uniforms: {},
|
|
555
|
+
name: "triangleBlur",
|
|
556
|
+
uniformTypes: {
|
|
557
|
+
radius: "f32",
|
|
558
|
+
delta: "vec2<f32>"
|
|
559
|
+
},
|
|
560
|
+
propTypes: {
|
|
561
|
+
radius: { value: 20, min: 0, softMax: 100 },
|
|
562
|
+
delta: { value: [1, 0], private: true }
|
|
563
|
+
},
|
|
564
|
+
fs: fs9,
|
|
565
|
+
dependencies: [import_shadertools2.random],
|
|
566
|
+
passes: [
|
|
567
|
+
{ sampler: true, uniforms: { delta: [1, 0] } },
|
|
568
|
+
{ sampler: true, uniforms: { delta: [0, 1] } }
|
|
569
|
+
]
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
// dist/passes/postprocessing/image-blur-filters/zoomblur.js
|
|
573
|
+
var import_shadertools3 = require("@luma.gl/shadertools");
|
|
574
|
+
var fs10 = `
|
|
575
|
+
uniform zoomBlurUniforms {
|
|
576
|
+
vec2 center;
|
|
577
|
+
float strength;
|
|
578
|
+
} zoomBlur;
|
|
579
|
+
|
|
580
|
+
vec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
581
|
+
vec4 color = vec4(0.0);
|
|
582
|
+
float total = 0.0;
|
|
583
|
+
vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;
|
|
584
|
+
|
|
585
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
586
|
+
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
587
|
+
|
|
588
|
+
for (float t = 0.0; t <= 40.0; t++) {
|
|
589
|
+
float percent = (t + offset) / 40.0;
|
|
590
|
+
float weight = 4.0 * (percent - percent * percent);
|
|
591
|
+
vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);
|
|
592
|
+
|
|
593
|
+
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
594
|
+
offsetColor.rgb *= offsetColor.a;
|
|
595
|
+
|
|
596
|
+
color += offsetColor * weight;
|
|
597
|
+
total += weight;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
color = color / total;
|
|
601
|
+
|
|
602
|
+
/* switch back from pre-multiplied alpha */
|
|
603
|
+
color.rgb /= color.a + 0.00001;
|
|
604
|
+
|
|
605
|
+
return color;
|
|
606
|
+
}
|
|
607
|
+
`;
|
|
608
|
+
var zoomBlur = {
|
|
609
|
+
props: {},
|
|
610
|
+
uniforms: {},
|
|
611
|
+
name: "zoomBlur",
|
|
612
|
+
uniformTypes: {
|
|
613
|
+
center: "vec2<f32>",
|
|
614
|
+
strength: "f32"
|
|
615
|
+
},
|
|
616
|
+
propTypes: {
|
|
617
|
+
center: { value: [0.5, 0.5] },
|
|
618
|
+
strength: { value: 0.3, min: 0, softMax: 1 }
|
|
619
|
+
},
|
|
620
|
+
fs: fs10,
|
|
621
|
+
dependencies: [import_shadertools3.random],
|
|
622
|
+
passes: [{ sampler: true }]
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
// dist/passes/postprocessing/image-fun-filters/colorhalftone.js
|
|
626
|
+
var fs11 = (
|
|
627
|
+
/* glsl */
|
|
628
|
+
`uniform colorHalftoneUniforms {
|
|
629
|
+
vec2 center;
|
|
630
|
+
float angle;
|
|
631
|
+
float size;
|
|
632
|
+
} colorHalftone;
|
|
633
|
+
|
|
634
|
+
float pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {
|
|
635
|
+
float s = sin(angle), c = cos(angle);
|
|
636
|
+
vec2 tex = texCoord * texSize - colorHalftone.center * texSize;
|
|
637
|
+
vec2 point = vec2(
|
|
638
|
+
c * tex.x - s * tex.y,
|
|
639
|
+
s * tex.x + c * tex.y
|
|
640
|
+
) * scale;
|
|
641
|
+
return (sin(point.x) * sin(point.y)) * 4.0;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
vec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
645
|
+
float scale = 3.1514 / colorHalftone.size;
|
|
646
|
+
vec3 cmy = 1.0 - color.rgb;
|
|
647
|
+
float k = min(cmy.x, min(cmy.y, cmy.z));
|
|
648
|
+
|
|
649
|
+
cmy = (cmy - k) / (1.0 - k);
|
|
650
|
+
cmy = clamp(
|
|
651
|
+
cmy * 10.0 - 3.0 + vec3(
|
|
652
|
+
pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),
|
|
653
|
+
pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),
|
|
654
|
+
pattern(colorHalftone.angle, scale, texSize, texCoord)
|
|
655
|
+
),
|
|
656
|
+
0.0,
|
|
657
|
+
1.0
|
|
658
|
+
);
|
|
659
|
+
k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);
|
|
660
|
+
return vec4(1.0 - cmy - k, color.a);
|
|
661
|
+
}
|
|
662
|
+
`
|
|
663
|
+
);
|
|
664
|
+
var colorHalftone = {
|
|
665
|
+
props: {},
|
|
666
|
+
uniforms: {},
|
|
667
|
+
name: "colorHalftone",
|
|
668
|
+
uniformTypes: {
|
|
669
|
+
center: "vec2<f32>",
|
|
670
|
+
angle: "f32",
|
|
671
|
+
size: "f32"
|
|
672
|
+
},
|
|
673
|
+
propTypes: {
|
|
674
|
+
center: { value: [0.5, 0.5] },
|
|
675
|
+
angle: { value: 1.1, softMin: 0, softMax: Math.PI / 2 },
|
|
676
|
+
size: { value: 4, min: 1, softMin: 3, softMax: 20 }
|
|
677
|
+
},
|
|
678
|
+
fs: fs11,
|
|
679
|
+
passes: [{ filter: true }]
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
// dist/passes/postprocessing/image-fun-filters/dotscreen.js
|
|
683
|
+
var fs12 = (
|
|
684
|
+
/* glsl */
|
|
685
|
+
`uniform dotScreenUniforms {
|
|
686
|
+
vec2 center;
|
|
687
|
+
float angle;
|
|
688
|
+
float size;
|
|
689
|
+
} dotScreen;
|
|
690
|
+
|
|
691
|
+
float pattern(vec2 texSize, vec2 texCoord) {
|
|
692
|
+
float scale = 3.1415 / dotScreen.size;
|
|
693
|
+
|
|
694
|
+
float s = sin(dotScreen.angle), c = cos(dotScreen.angle);
|
|
695
|
+
vec2 tex = texCoord * texSize - dotScreen.center * texSize;
|
|
696
|
+
vec2 point = vec2(
|
|
697
|
+
c * tex.x - s * tex.y,
|
|
698
|
+
s * tex.x + c * tex.y
|
|
699
|
+
) * scale;
|
|
700
|
+
return (sin(point.x) * sin(point.y)) * 4.0;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
vec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
704
|
+
float average = (color.r + color.g + color.b) / 3.0;
|
|
705
|
+
return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
|
|
706
|
+
}
|
|
707
|
+
`
|
|
708
|
+
);
|
|
709
|
+
var dotScreen = {
|
|
710
|
+
props: {},
|
|
711
|
+
uniforms: {},
|
|
712
|
+
name: "dotScreen",
|
|
713
|
+
uniformTypes: {
|
|
714
|
+
center: "vec2<f32>",
|
|
715
|
+
angle: "f32",
|
|
716
|
+
size: "f32"
|
|
717
|
+
},
|
|
718
|
+
propTypes: {
|
|
719
|
+
center: { value: [0.5, 0.5] },
|
|
720
|
+
angle: { value: 1.1, softMin: 0, softMax: Math.PI / 2 },
|
|
721
|
+
size: { value: 3, min: 1, softMin: 3, softMax: 20 }
|
|
722
|
+
},
|
|
723
|
+
fs: fs12,
|
|
724
|
+
passes: [{ filter: true }]
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// dist/passes/postprocessing/image-fun-filters/edgework.js
|
|
728
|
+
var import_shadertools4 = require("@luma.gl/shadertools");
|
|
729
|
+
var fs13 = (
|
|
730
|
+
/* glsl */
|
|
731
|
+
`uniform edgeWorkUniforms {
|
|
732
|
+
float radius;
|
|
733
|
+
int mode;
|
|
734
|
+
} edgeWork;
|
|
735
|
+
|
|
736
|
+
vec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
|
|
737
|
+
vec2 relativeDelta = edgeWork.radius * delta / texSize;
|
|
738
|
+
|
|
739
|
+
vec2 color = vec2(0.0);
|
|
740
|
+
vec2 total = vec2(0.0);
|
|
741
|
+
|
|
742
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
743
|
+
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
744
|
+
|
|
745
|
+
for (float t = -30.0; t <= 30.0; t++) {
|
|
746
|
+
float percent = (t + offset - 0.5) / 30.0;
|
|
747
|
+
float weight = 1.0 - abs(percent);
|
|
748
|
+
vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;
|
|
749
|
+
float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
|
|
750
|
+
color.x += average * weight;
|
|
751
|
+
total.x += weight;
|
|
752
|
+
if (abs(t) < 15.0) {
|
|
753
|
+
weight = weight * 2.0 - 1.0;
|
|
754
|
+
color.y += average * weight;
|
|
755
|
+
total.y += weight;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return vec4(color / total, 0.0, 1.0);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
vec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
|
|
762
|
+
vec2 relativeDelta = edgeWork.radius * delta / texSize;
|
|
763
|
+
|
|
764
|
+
vec2 color = vec2(0.0);
|
|
765
|
+
vec2 total = vec2(0.0);
|
|
766
|
+
|
|
767
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
768
|
+
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
769
|
+
|
|
770
|
+
for (float t = -30.0; t <= 30.0; t++) {
|
|
771
|
+
float percent = (t + offset - 0.5) / 30.0;
|
|
772
|
+
float weight = 1.0 - abs(percent);
|
|
773
|
+
vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;
|
|
774
|
+
color.x += sampleColor.x * weight;
|
|
775
|
+
total.x += weight;
|
|
776
|
+
if (abs(t) < 15.0) {
|
|
777
|
+
weight = weight * 2.0 - 1.0;
|
|
778
|
+
color.y += sampleColor.y * weight;
|
|
779
|
+
total.y += weight;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
|
|
783
|
+
return vec4(c, c, c, 1.0);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
vec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
787
|
+
switch (edgeWork.mode) {
|
|
788
|
+
case 0:
|
|
789
|
+
return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));
|
|
790
|
+
case 1:
|
|
791
|
+
default:
|
|
792
|
+
return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
`
|
|
796
|
+
);
|
|
797
|
+
var edgeWork = {
|
|
798
|
+
props: {},
|
|
799
|
+
uniforms: {},
|
|
800
|
+
name: "edgeWork",
|
|
801
|
+
dependencies: [import_shadertools4.random],
|
|
802
|
+
fs: fs13,
|
|
803
|
+
uniformTypes: {
|
|
804
|
+
radius: "f32",
|
|
805
|
+
mode: "i32"
|
|
806
|
+
},
|
|
807
|
+
propTypes: {
|
|
808
|
+
radius: { value: 2, min: 1, softMax: 50 },
|
|
809
|
+
mode: { value: 0, private: true }
|
|
810
|
+
},
|
|
811
|
+
passes: [
|
|
812
|
+
{
|
|
813
|
+
sampler: true,
|
|
814
|
+
uniforms: { mode: 0 }
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
sampler: true,
|
|
818
|
+
uniforms: { mode: 1 }
|
|
819
|
+
}
|
|
820
|
+
]
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
// dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js
|
|
824
|
+
var fs14 = (
|
|
825
|
+
/* glsl */
|
|
826
|
+
`uniform hexagonalPixelateUniforms {
|
|
827
|
+
vec2 center;
|
|
828
|
+
float scale;
|
|
829
|
+
} hexagonalPixelate;
|
|
830
|
+
|
|
831
|
+
vec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
832
|
+
vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;
|
|
833
|
+
tex.y /= 0.866025404;
|
|
834
|
+
tex.x -= tex.y * 0.5;
|
|
835
|
+
|
|
836
|
+
vec2 a;
|
|
837
|
+
if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
|
|
838
|
+
a = vec2(floor(tex.x), floor(tex.y));
|
|
839
|
+
}
|
|
840
|
+
else a = vec2(ceil(tex.x), ceil(tex.y));
|
|
841
|
+
vec2 b = vec2(ceil(tex.x), floor(tex.y));
|
|
842
|
+
vec2 c = vec2(floor(tex.x), ceil(tex.y));
|
|
843
|
+
|
|
844
|
+
vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
|
|
845
|
+
vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
|
|
846
|
+
vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
|
|
847
|
+
vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
|
|
848
|
+
|
|
849
|
+
float alen = length(TEX - A);
|
|
850
|
+
float blen = length(TEX - B);
|
|
851
|
+
float clen = length(TEX - C);
|
|
852
|
+
|
|
853
|
+
vec2 choice;
|
|
854
|
+
if (alen < blen) {
|
|
855
|
+
if (alen < clen) choice = a;
|
|
856
|
+
else choice = c;
|
|
857
|
+
} else {
|
|
858
|
+
if (blen < clen) choice = b;
|
|
859
|
+
else choice = c;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
choice.x += choice.y * 0.5;
|
|
863
|
+
choice.y *= 0.866025404;
|
|
864
|
+
choice *= hexagonalPixelate.scale / texSize;
|
|
865
|
+
|
|
866
|
+
return texture(source, choice + hexagonalPixelate.center);
|
|
867
|
+
}
|
|
868
|
+
`
|
|
869
|
+
);
|
|
870
|
+
var hexagonalPixelate = {
|
|
871
|
+
props: {},
|
|
872
|
+
uniforms: {},
|
|
873
|
+
name: "hexagonalPixelate",
|
|
874
|
+
uniformTypes: {
|
|
875
|
+
center: "vec2<f32>",
|
|
876
|
+
scale: "f32"
|
|
877
|
+
},
|
|
878
|
+
propTypes: {
|
|
879
|
+
center: { value: [0.5, 0.5], hint: "screenspace" },
|
|
880
|
+
scale: { value: 10, min: 1, softMin: 5, softMax: 50 }
|
|
881
|
+
},
|
|
882
|
+
fs: fs14,
|
|
883
|
+
passes: [{ sampler: true }]
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// dist/passes/postprocessing/image-fun-filters/ink.js
|
|
887
|
+
var fs15 = (
|
|
888
|
+
/* glsl */
|
|
889
|
+
`uniform inkUniforms {
|
|
890
|
+
float strength;
|
|
891
|
+
} ink;
|
|
892
|
+
|
|
893
|
+
vec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
894
|
+
vec2 dx = vec2(1.0 / texSize.x, 0.0);
|
|
895
|
+
vec2 dy = vec2(0.0, 1.0 / texSize.y);
|
|
896
|
+
vec4 color = texture(source, texCoord);
|
|
897
|
+
float bigTotal = 0.0;
|
|
898
|
+
float smallTotal = 0.0;
|
|
899
|
+
vec3 bigAverage = vec3(0.0);
|
|
900
|
+
vec3 smallAverage = vec3(0.0);
|
|
901
|
+
for (float x = -2.0; x <= 2.0; x += 1.0) {
|
|
902
|
+
for (float y = -2.0; y <= 2.0; y += 1.0) {
|
|
903
|
+
vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;
|
|
904
|
+
bigAverage += offsetColor;
|
|
905
|
+
bigTotal += 1.0;
|
|
906
|
+
if (abs(x) + abs(y) < 2.0) {
|
|
907
|
+
smallAverage += offsetColor;
|
|
908
|
+
smallTotal += 1.0;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
|
|
913
|
+
float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;
|
|
914
|
+
return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
|
|
915
|
+
}
|
|
916
|
+
`
|
|
917
|
+
);
|
|
918
|
+
var ink = {
|
|
919
|
+
props: {},
|
|
920
|
+
uniforms: {},
|
|
921
|
+
name: "ink",
|
|
922
|
+
fs: fs15,
|
|
923
|
+
uniformTypes: {
|
|
924
|
+
strength: "f32"
|
|
925
|
+
},
|
|
926
|
+
propTypes: {
|
|
927
|
+
strength: { value: 0.25, min: 0, softMax: 1 }
|
|
928
|
+
},
|
|
929
|
+
passes: [{ sampler: true }]
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
// dist/passes/postprocessing/image-fun-filters/magnify.js
|
|
933
|
+
var fs16 = (
|
|
934
|
+
/* glsl */
|
|
935
|
+
`uniform magnifyUniforms {
|
|
936
|
+
vec2 screenXY;
|
|
937
|
+
float radiusPixels;
|
|
938
|
+
float zoom;
|
|
939
|
+
float borderWidthPixels;
|
|
940
|
+
vec4 borderColor;
|
|
941
|
+
} magnify;
|
|
942
|
+
|
|
943
|
+
vec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
944
|
+
vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);
|
|
945
|
+
float dist = distance(texCoord * texSize, pos * texSize);
|
|
946
|
+
if (dist < magnify.radiusPixels) {
|
|
947
|
+
return texture(source, (texCoord - pos) / magnify.zoom + pos);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {
|
|
951
|
+
return magnify.borderColor;
|
|
952
|
+
}
|
|
953
|
+
return texture(source, texCoord);
|
|
954
|
+
}
|
|
955
|
+
`
|
|
956
|
+
);
|
|
957
|
+
var magnify = {
|
|
958
|
+
name: "magnify",
|
|
959
|
+
uniformTypes: {
|
|
960
|
+
screenXY: "vec2<f32>",
|
|
961
|
+
radiusPixels: "f32",
|
|
962
|
+
zoom: "f32",
|
|
963
|
+
borderWidthPixels: "f32",
|
|
964
|
+
borderColor: "vec4<f32>"
|
|
965
|
+
},
|
|
966
|
+
propTypes: {
|
|
967
|
+
// range 0 to 1
|
|
968
|
+
screenXY: { value: [0, 0] },
|
|
969
|
+
radiusPixels: 200,
|
|
970
|
+
zoom: 2,
|
|
971
|
+
borderWidthPixels: 0,
|
|
972
|
+
borderColor: { value: [255, 255, 255, 255] }
|
|
973
|
+
},
|
|
974
|
+
fs: fs16,
|
|
975
|
+
passes: [{ sampler: true }]
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
// dist/passes/postprocessing/image-warp-filters/warp.js
|
|
979
|
+
var fs17 = (
|
|
980
|
+
/* glsl */
|
|
981
|
+
`vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {
|
|
982
|
+
vec4 color = texture(source, coord / texSize);
|
|
983
|
+
vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
|
|
984
|
+
if (coord != clampedCoord) {
|
|
985
|
+
/* fade to transparent if we are outside the image */
|
|
986
|
+
color.a *= max(0.0, 1.0 - length(coord - clampedCoord));
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
return color;
|
|
990
|
+
}
|
|
991
|
+
`
|
|
992
|
+
);
|
|
993
|
+
var warp = {
|
|
994
|
+
name: "warp",
|
|
995
|
+
passes: [],
|
|
996
|
+
fs: fs17
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
// dist/passes/postprocessing/image-warp-filters/bulgepinch.js
|
|
1000
|
+
var fs18 = (
|
|
1001
|
+
/* glsl */
|
|
1002
|
+
`uniform bulgePinchUniforms {
|
|
1003
|
+
float radius;
|
|
1004
|
+
float strength;
|
|
1005
|
+
vec2 center;
|
|
1006
|
+
} bulgePinch;
|
|
1007
|
+
|
|
1008
|
+
vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
|
|
1009
|
+
coord -= texCenter;
|
|
1010
|
+
float distance = length(coord);
|
|
1011
|
+
if (distance < bulgePinch.radius) {
|
|
1012
|
+
float percent = distance / bulgePinch.radius;
|
|
1013
|
+
if (bulgePinch.strength > 0.0) {
|
|
1014
|
+
coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);
|
|
1015
|
+
} else {
|
|
1016
|
+
coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
coord += texCenter;
|
|
1020
|
+
return coord;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
vec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
1024
|
+
vec2 coord = texCoord * texSize;
|
|
1025
|
+
coord = bulgePinch_warp(coord, bulgePinch.center * texSize);
|
|
1026
|
+
|
|
1027
|
+
return warp_sampleColor(source, texSize, coord);
|
|
1028
|
+
}
|
|
1029
|
+
`
|
|
1030
|
+
);
|
|
1031
|
+
var bulgePinch = {
|
|
1032
|
+
props: {},
|
|
1033
|
+
uniforms: {},
|
|
1034
|
+
name: "bulgePinch",
|
|
1035
|
+
dependencies: [warp],
|
|
1036
|
+
fs: fs18,
|
|
1037
|
+
uniformTypes: {
|
|
1038
|
+
center: "vec2<f32>",
|
|
1039
|
+
radius: "f32",
|
|
1040
|
+
strength: "f32"
|
|
1041
|
+
},
|
|
1042
|
+
propTypes: {
|
|
1043
|
+
center: { value: [0.5, 0.5] },
|
|
1044
|
+
radius: { value: 200, min: 1, softMax: 600 },
|
|
1045
|
+
strength: { value: 0.5, min: -1, max: 1 }
|
|
1046
|
+
},
|
|
1047
|
+
passes: [{ sampler: true }]
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
// dist/passes/postprocessing/image-warp-filters/swirl.js
|
|
1051
|
+
var fs19 = (
|
|
1052
|
+
/* glsl */
|
|
1053
|
+
`uniform swirlUniforms {
|
|
1054
|
+
float radius;
|
|
1055
|
+
float angle;
|
|
1056
|
+
vec2 center;
|
|
1057
|
+
} swirl;
|
|
1058
|
+
|
|
1059
|
+
vec2 swirl_warp(vec2 coord, vec2 texCenter) {
|
|
1060
|
+
coord -= texCenter;
|
|
1061
|
+
float distance = length(coord);
|
|
1062
|
+
if (distance < swirl.radius) {
|
|
1063
|
+
float percent = (swirl.radius - distance) / swirl.radius;
|
|
1064
|
+
float theta = percent * percent * swirl.angle;
|
|
1065
|
+
float s = sin(theta);
|
|
1066
|
+
float c = cos(theta);
|
|
1067
|
+
coord = vec2(
|
|
1068
|
+
coord.x * c - coord.y * s,
|
|
1069
|
+
coord.x * s + coord.y * c
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
coord += texCenter;
|
|
1073
|
+
return coord;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
vec4 swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
1077
|
+
vec2 coord = texCoord * texSize;
|
|
1078
|
+
coord = swirl_warp(coord, swirl.center * texSize);
|
|
1079
|
+
|
|
1080
|
+
return warp_sampleColor(source, texSize, coord);
|
|
1081
|
+
}
|
|
1082
|
+
`
|
|
1083
|
+
);
|
|
1084
|
+
var swirl = {
|
|
1085
|
+
props: {},
|
|
1086
|
+
uniforms: {},
|
|
1087
|
+
name: "swirl",
|
|
1088
|
+
dependencies: [warp],
|
|
1089
|
+
fs: fs19,
|
|
1090
|
+
uniformTypes: {
|
|
1091
|
+
center: "vec2<f32>",
|
|
1092
|
+
radius: "f32",
|
|
1093
|
+
angle: "f32"
|
|
1094
|
+
},
|
|
1095
|
+
propTypes: {
|
|
1096
|
+
center: { value: [0.5, 0.5] },
|
|
1097
|
+
radius: { value: 200, min: 1, softMax: 600 },
|
|
1098
|
+
angle: { value: 3, softMin: -25, softMax: 25 }
|
|
1099
|
+
},
|
|
1100
|
+
passes: [{ sampler: true }]
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
// dist/passes/postprocessing/fxaa/fxaa.js
|
|
1104
|
+
var fs20 = (
|
|
1105
|
+
/* glsl */
|
|
1106
|
+
`
|
|
1107
|
+
#define FXAA_QUALITY_PRESET 29
|
|
1108
|
+
|
|
1109
|
+
#if (FXAA_QUALITY_PRESET == 10)
|
|
1110
|
+
#define FXAA_QUALITY_PS 3
|
|
1111
|
+
#define FXAA_QUALITY_P0 1.5
|
|
1112
|
+
#define FXAA_QUALITY_P1 3.0
|
|
1113
|
+
#define FXAA_QUALITY_P2 12.0
|
|
1114
|
+
#endif
|
|
1115
|
+
#if (FXAA_QUALITY_PRESET == 11)
|
|
1116
|
+
#define FXAA_QUALITY_PS 4
|
|
1117
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1118
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1119
|
+
#define FXAA_QUALITY_P2 3.0
|
|
1120
|
+
#define FXAA_QUALITY_P3 12.0
|
|
1121
|
+
#endif
|
|
1122
|
+
#if (FXAA_QUALITY_PRESET == 12)
|
|
1123
|
+
#define FXAA_QUALITY_PS 5
|
|
1124
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1125
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1126
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1127
|
+
#define FXAA_QUALITY_P3 4.0
|
|
1128
|
+
#define FXAA_QUALITY_P4 12.0
|
|
1129
|
+
#endif
|
|
1130
|
+
#if (FXAA_QUALITY_PRESET == 13)
|
|
1131
|
+
#define FXAA_QUALITY_PS 6
|
|
1132
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1133
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1134
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1135
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1136
|
+
#define FXAA_QUALITY_P4 4.0
|
|
1137
|
+
#define FXAA_QUALITY_P5 12.0
|
|
1138
|
+
#endif
|
|
1139
|
+
#if (FXAA_QUALITY_PRESET == 14)
|
|
1140
|
+
#define FXAA_QUALITY_PS 7
|
|
1141
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1142
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1143
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1144
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1145
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1146
|
+
#define FXAA_QUALITY_P5 4.0
|
|
1147
|
+
#define FXAA_QUALITY_P6 12.0
|
|
1148
|
+
#endif
|
|
1149
|
+
#if (FXAA_QUALITY_PRESET == 15)
|
|
1150
|
+
#define FXAA_QUALITY_PS 8
|
|
1151
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1152
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1153
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1154
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1155
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1156
|
+
#define FXAA_QUALITY_P5 2.0
|
|
1157
|
+
#define FXAA_QUALITY_P6 4.0
|
|
1158
|
+
#define FXAA_QUALITY_P7 12.0
|
|
1159
|
+
#endif
|
|
1160
|
+
#if (FXAA_QUALITY_PRESET == 20)
|
|
1161
|
+
#define FXAA_QUALITY_PS 3
|
|
1162
|
+
#define FXAA_QUALITY_P0 1.5
|
|
1163
|
+
#define FXAA_QUALITY_P1 2.0
|
|
1164
|
+
#define FXAA_QUALITY_P2 8.0
|
|
1165
|
+
#endif
|
|
1166
|
+
#if (FXAA_QUALITY_PRESET == 21)
|
|
1167
|
+
#define FXAA_QUALITY_PS 4
|
|
1168
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1169
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1170
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1171
|
+
#define FXAA_QUALITY_P3 8.0
|
|
1172
|
+
#endif
|
|
1173
|
+
#if (FXAA_QUALITY_PRESET == 22)
|
|
1174
|
+
#define FXAA_QUALITY_PS 5
|
|
1175
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1176
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1177
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1178
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1179
|
+
#define FXAA_QUALITY_P4 8.0
|
|
1180
|
+
#endif
|
|
1181
|
+
#if (FXAA_QUALITY_PRESET == 23)
|
|
1182
|
+
#define FXAA_QUALITY_PS 6
|
|
1183
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1184
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1185
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1186
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1187
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1188
|
+
#define FXAA_QUALITY_P5 8.0
|
|
1189
|
+
#endif
|
|
1190
|
+
#if (FXAA_QUALITY_PRESET == 24)
|
|
1191
|
+
#define FXAA_QUALITY_PS 7
|
|
1192
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1193
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1194
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1195
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1196
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1197
|
+
#define FXAA_QUALITY_P5 3.0
|
|
1198
|
+
#define FXAA_QUALITY_P6 8.0
|
|
1199
|
+
#endif
|
|
1200
|
+
#if (FXAA_QUALITY_PRESET == 25)
|
|
1201
|
+
#define FXAA_QUALITY_PS 8
|
|
1202
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1203
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1204
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1205
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1206
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1207
|
+
#define FXAA_QUALITY_P5 2.0
|
|
1208
|
+
#define FXAA_QUALITY_P6 4.0
|
|
1209
|
+
#define FXAA_QUALITY_P7 8.0
|
|
1210
|
+
#endif
|
|
1211
|
+
#if (FXAA_QUALITY_PRESET == 26)
|
|
1212
|
+
#define FXAA_QUALITY_PS 9
|
|
1213
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1214
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1215
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1216
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1217
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1218
|
+
#define FXAA_QUALITY_P5 2.0
|
|
1219
|
+
#define FXAA_QUALITY_P6 2.0
|
|
1220
|
+
#define FXAA_QUALITY_P7 4.0
|
|
1221
|
+
#define FXAA_QUALITY_P8 8.0
|
|
1222
|
+
#endif
|
|
1223
|
+
#if (FXAA_QUALITY_PRESET == 27)
|
|
1224
|
+
#define FXAA_QUALITY_PS 10
|
|
1225
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1226
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1227
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1228
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1229
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1230
|
+
#define FXAA_QUALITY_P5 2.0
|
|
1231
|
+
#define FXAA_QUALITY_P6 2.0
|
|
1232
|
+
#define FXAA_QUALITY_P7 2.0
|
|
1233
|
+
#define FXAA_QUALITY_P8 4.0
|
|
1234
|
+
#define FXAA_QUALITY_P9 8.0
|
|
1235
|
+
#endif
|
|
1236
|
+
#if (FXAA_QUALITY_PRESET == 28)
|
|
1237
|
+
#define FXAA_QUALITY_PS 11
|
|
1238
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1239
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1240
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1241
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1242
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1243
|
+
#define FXAA_QUALITY_P5 2.0
|
|
1244
|
+
#define FXAA_QUALITY_P6 2.0
|
|
1245
|
+
#define FXAA_QUALITY_P7 2.0
|
|
1246
|
+
#define FXAA_QUALITY_P8 2.0
|
|
1247
|
+
#define FXAA_QUALITY_P9 4.0
|
|
1248
|
+
#define FXAA_QUALITY_P10 8.0
|
|
1249
|
+
#endif
|
|
1250
|
+
#if (FXAA_QUALITY_PRESET == 29)
|
|
1251
|
+
#define FXAA_QUALITY_PS 12
|
|
1252
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1253
|
+
#define FXAA_QUALITY_P1 1.5
|
|
1254
|
+
#define FXAA_QUALITY_P2 2.0
|
|
1255
|
+
#define FXAA_QUALITY_P3 2.0
|
|
1256
|
+
#define FXAA_QUALITY_P4 2.0
|
|
1257
|
+
#define FXAA_QUALITY_P5 2.0
|
|
1258
|
+
#define FXAA_QUALITY_P6 2.0
|
|
1259
|
+
#define FXAA_QUALITY_P7 2.0
|
|
1260
|
+
#define FXAA_QUALITY_P8 2.0
|
|
1261
|
+
#define FXAA_QUALITY_P9 2.0
|
|
1262
|
+
#define FXAA_QUALITY_P10 4.0
|
|
1263
|
+
#define FXAA_QUALITY_P11 8.0
|
|
1264
|
+
#endif
|
|
1265
|
+
#if (FXAA_QUALITY_PRESET == 39)
|
|
1266
|
+
#define FXAA_QUALITY_PS 12
|
|
1267
|
+
#define FXAA_QUALITY_P0 1.0
|
|
1268
|
+
#define FXAA_QUALITY_P1 1.0
|
|
1269
|
+
#define FXAA_QUALITY_P2 1.0
|
|
1270
|
+
#define FXAA_QUALITY_P3 1.0
|
|
1271
|
+
#define FXAA_QUALITY_P4 1.0
|
|
1272
|
+
#define FXAA_QUALITY_P5 1.5
|
|
1273
|
+
#define FXAA_QUALITY_P6 2.0
|
|
1274
|
+
#define FXAA_QUALITY_P7 2.0
|
|
1275
|
+
#define FXAA_QUALITY_P8 2.0
|
|
1276
|
+
#define FXAA_QUALITY_P9 2.0
|
|
1277
|
+
#define FXAA_QUALITY_P10 4.0
|
|
1278
|
+
#define FXAA_QUALITY_P11 8.0
|
|
1279
|
+
#endif
|
|
1280
|
+
|
|
1281
|
+
#define FxaaBool bool
|
|
1282
|
+
#define FxaaFloat float
|
|
1283
|
+
#define FxaaFloat2 vec2
|
|
1284
|
+
#define FxaaFloat3 vec3
|
|
1285
|
+
#define FxaaFloat4 vec4
|
|
1286
|
+
#define FxaaHalf float
|
|
1287
|
+
#define FxaaHalf2 vec2
|
|
1288
|
+
#define FxaaHalf3 vec3
|
|
1289
|
+
#define FxaaHalf4 vec4
|
|
1290
|
+
#define FxaaInt2 vec2
|
|
1291
|
+
#define FxaaTex sampler2D
|
|
1292
|
+
|
|
1293
|
+
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
|
1294
|
+
#define FxaaTexTop(t, p) texture(t, p)
|
|
1295
|
+
#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
|
|
1296
|
+
|
|
1297
|
+
FxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }
|
|
1298
|
+
|
|
1299
|
+
FxaaFloat4 FxaaPixelShader_(
|
|
1300
|
+
//
|
|
1301
|
+
// Use noperspective interpolation here (turn off perspective interpolation).
|
|
1302
|
+
// {xy} = center of pixel
|
|
1303
|
+
FxaaFloat2 pos,
|
|
1304
|
+
//
|
|
1305
|
+
// Input color texture.
|
|
1306
|
+
// {rgb_} = color in linear or perceptual color space
|
|
1307
|
+
// if (FXAA_GREEN_AS_LUMA == 0)
|
|
1308
|
+
// {___a} = luma in perceptual color space (not linear)
|
|
1309
|
+
FxaaTex tex,
|
|
1310
|
+
//
|
|
1311
|
+
// Only used on FXAA Quality.
|
|
1312
|
+
// This must be from a constant/uniform.
|
|
1313
|
+
// {x_} = 1.0/screenWidthInPixels
|
|
1314
|
+
// {_y} = 1.0/screenHeightInPixels
|
|
1315
|
+
FxaaFloat2 fxaaQualityRcpFrame,
|
|
1316
|
+
//
|
|
1317
|
+
// Only used on FXAA Quality.
|
|
1318
|
+
// This used to be the FXAA_QUALITY_SUBPIX define.
|
|
1319
|
+
// It is here now to allow easier tuning.
|
|
1320
|
+
// Choose the amount of sub-pixel aliasing removal.
|
|
1321
|
+
// This can effect sharpness.
|
|
1322
|
+
// 1.00 - upper limit (softer)
|
|
1323
|
+
// 0.75 - default amount of filtering
|
|
1324
|
+
// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
|
|
1325
|
+
// 0.25 - almost off
|
|
1326
|
+
// 0.00 - completely off
|
|
1327
|
+
FxaaFloat fxaaQualitySubpix,
|
|
1328
|
+
//
|
|
1329
|
+
// Only used on FXAA Quality.
|
|
1330
|
+
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
|
|
1331
|
+
// It is here now to allow easier tuning.
|
|
1332
|
+
// The minimum amount of local contrast required to apply algorithm.
|
|
1333
|
+
// 0.333 - too little (faster)
|
|
1334
|
+
// 0.250 - low quality
|
|
1335
|
+
// 0.166 - default
|
|
1336
|
+
// 0.125 - high quality
|
|
1337
|
+
// 0.063 - overkill (slower)
|
|
1338
|
+
FxaaFloat fxaaQualityEdgeThreshold,
|
|
1339
|
+
//
|
|
1340
|
+
// Only used on FXAA Quality.
|
|
1341
|
+
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
|
|
1342
|
+
// It is here now to allow easier tuning.
|
|
1343
|
+
// Trims the algorithm from processing darks.
|
|
1344
|
+
// 0.0833 - upper limit (default, the start of visible unfiltered edges)
|
|
1345
|
+
// 0.0625 - high quality (faster)
|
|
1346
|
+
// 0.0312 - visible limit (slower)
|
|
1347
|
+
// Special notes when using FXAA_GREEN_AS_LUMA,
|
|
1348
|
+
// Likely want to set this to zero.
|
|
1349
|
+
// As colors that are mostly not-green
|
|
1350
|
+
// will appear very dark in the green channel!
|
|
1351
|
+
// Tune by looking at mostly non-green content,
|
|
1352
|
+
// then start at zero and increase until aliasing is a problem.
|
|
1353
|
+
FxaaFloat fxaaQualityEdgeThresholdMin
|
|
1354
|
+
) {
|
|
1355
|
+
/*--------------------------------------------------------------------------*/
|
|
1356
|
+
FxaaFloat2 posM;
|
|
1357
|
+
posM.x = pos.x;
|
|
1358
|
+
posM.y = pos.y;
|
|
1359
|
+
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
|
|
1360
|
+
#define lumaM rgbyM.y
|
|
1361
|
+
FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
|
|
1362
|
+
FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
|
|
1363
|
+
FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
|
|
1364
|
+
FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
|
|
1365
|
+
/*--------------------------------------------------------------------------*/
|
|
1366
|
+
FxaaFloat maxSM = max(lumaS, lumaM);
|
|
1367
|
+
FxaaFloat minSM = min(lumaS, lumaM);
|
|
1368
|
+
FxaaFloat maxESM = max(lumaE, maxSM);
|
|
1369
|
+
FxaaFloat minESM = min(lumaE, minSM);
|
|
1370
|
+
FxaaFloat maxWN = max(lumaN, lumaW);
|
|
1371
|
+
FxaaFloat minWN = min(lumaN, lumaW);
|
|
1372
|
+
FxaaFloat rangeMax = max(maxWN, maxESM);
|
|
1373
|
+
FxaaFloat rangeMin = min(minWN, minESM);
|
|
1374
|
+
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
|
|
1375
|
+
FxaaFloat range = rangeMax - rangeMin;
|
|
1376
|
+
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
|
|
1377
|
+
FxaaBool earlyExit = range < rangeMaxClamped;
|
|
1378
|
+
/*--------------------------------------------------------------------------*/
|
|
1379
|
+
if(earlyExit)
|
|
1380
|
+
return rgbyM;
|
|
1381
|
+
/*--------------------------------------------------------------------------*/
|
|
1382
|
+
FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
|
|
1383
|
+
FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
|
|
1384
|
+
FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
|
|
1385
|
+
FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
|
|
1386
|
+
/*--------------------------------------------------------------------------*/
|
|
1387
|
+
FxaaFloat lumaNS = lumaN + lumaS;
|
|
1388
|
+
FxaaFloat lumaWE = lumaW + lumaE;
|
|
1389
|
+
FxaaFloat subpixRcpRange = 1.0/range;
|
|
1390
|
+
FxaaFloat subpixNSWE = lumaNS + lumaWE;
|
|
1391
|
+
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
|
|
1392
|
+
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
|
|
1393
|
+
/*--------------------------------------------------------------------------*/
|
|
1394
|
+
FxaaFloat lumaNESE = lumaNE + lumaSE;
|
|
1395
|
+
FxaaFloat lumaNWNE = lumaNW + lumaNE;
|
|
1396
|
+
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
|
|
1397
|
+
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
|
|
1398
|
+
/*--------------------------------------------------------------------------*/
|
|
1399
|
+
FxaaFloat lumaNWSW = lumaNW + lumaSW;
|
|
1400
|
+
FxaaFloat lumaSWSE = lumaSW + lumaSE;
|
|
1401
|
+
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
|
|
1402
|
+
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
|
|
1403
|
+
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
|
|
1404
|
+
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
|
|
1405
|
+
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
|
|
1406
|
+
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
|
|
1407
|
+
/*--------------------------------------------------------------------------*/
|
|
1408
|
+
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
|
|
1409
|
+
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
|
|
1410
|
+
FxaaBool horzSpan = edgeHorz >= edgeVert;
|
|
1411
|
+
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
|
|
1412
|
+
/*--------------------------------------------------------------------------*/
|
|
1413
|
+
if(!horzSpan) lumaN = lumaW;
|
|
1414
|
+
if(!horzSpan) lumaS = lumaE;
|
|
1415
|
+
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
|
|
1416
|
+
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
|
|
1417
|
+
/*--------------------------------------------------------------------------*/
|
|
1418
|
+
FxaaFloat gradientN = lumaN - lumaM;
|
|
1419
|
+
FxaaFloat gradientS = lumaS - lumaM;
|
|
1420
|
+
FxaaFloat lumaNN = lumaN + lumaM;
|
|
1421
|
+
FxaaFloat lumaSS = lumaS + lumaM;
|
|
1422
|
+
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
|
|
1423
|
+
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
|
|
1424
|
+
if(pairN) lengthSign = -lengthSign;
|
|
1425
|
+
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
|
|
1426
|
+
/*--------------------------------------------------------------------------*/
|
|
1427
|
+
FxaaFloat2 posB;
|
|
1428
|
+
posB.x = posM.x;
|
|
1429
|
+
posB.y = posM.y;
|
|
1430
|
+
FxaaFloat2 offNP;
|
|
1431
|
+
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
|
|
1432
|
+
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
|
|
1433
|
+
if(!horzSpan) posB.x += lengthSign * 0.5;
|
|
1434
|
+
if( horzSpan) posB.y += lengthSign * 0.5;
|
|
1435
|
+
/*--------------------------------------------------------------------------*/
|
|
1436
|
+
FxaaFloat2 posN;
|
|
1437
|
+
posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
|
|
1438
|
+
posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
|
|
1439
|
+
FxaaFloat2 posP;
|
|
1440
|
+
posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
|
|
1441
|
+
posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
|
|
1442
|
+
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
|
|
1443
|
+
FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));
|
|
1444
|
+
FxaaFloat subpixE = subpixC * subpixC;
|
|
1445
|
+
FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));
|
|
1446
|
+
/*--------------------------------------------------------------------------*/
|
|
1447
|
+
if(!pairN) lumaNN = lumaSS;
|
|
1448
|
+
FxaaFloat gradientScaled = gradient * 1.0/4.0;
|
|
1449
|
+
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
|
|
1450
|
+
FxaaFloat subpixF = subpixD * subpixE;
|
|
1451
|
+
FxaaBool lumaMLTZero = lumaMM < 0.0;
|
|
1452
|
+
/*--------------------------------------------------------------------------*/
|
|
1453
|
+
lumaEndN -= lumaNN * 0.5;
|
|
1454
|
+
lumaEndP -= lumaNN * 0.5;
|
|
1455
|
+
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
|
|
1456
|
+
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
|
|
1457
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
|
|
1458
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
|
|
1459
|
+
FxaaBool doneNP = (!doneN) || (!doneP);
|
|
1460
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
|
|
1461
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
|
|
1462
|
+
/*--------------------------------------------------------------------------*/
|
|
1463
|
+
if(doneNP) {
|
|
1464
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1465
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1466
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1467
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1468
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1469
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1470
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
|
|
1471
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
|
|
1472
|
+
doneNP = (!doneN) || (!doneP);
|
|
1473
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
|
|
1474
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
|
|
1475
|
+
/*--------------------------------------------------------------------------*/
|
|
1476
|
+
#if (FXAA_QUALITY_PS > 3)
|
|
1477
|
+
if(doneNP) {
|
|
1478
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1479
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1480
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1481
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1482
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1483
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1484
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
|
|
1485
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
|
|
1486
|
+
doneNP = (!doneN) || (!doneP);
|
|
1487
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
|
|
1488
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
|
|
1489
|
+
/*--------------------------------------------------------------------------*/
|
|
1490
|
+
#if (FXAA_QUALITY_PS > 4)
|
|
1491
|
+
if(doneNP) {
|
|
1492
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1493
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1494
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1495
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1496
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1497
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1498
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
|
|
1499
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
|
|
1500
|
+
doneNP = (!doneN) || (!doneP);
|
|
1501
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
|
|
1502
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
|
|
1503
|
+
/*--------------------------------------------------------------------------*/
|
|
1504
|
+
#if (FXAA_QUALITY_PS > 5)
|
|
1505
|
+
if(doneNP) {
|
|
1506
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1507
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1508
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1509
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1510
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1511
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1512
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
|
|
1513
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
|
|
1514
|
+
doneNP = (!doneN) || (!doneP);
|
|
1515
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
|
|
1516
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
|
|
1517
|
+
/*--------------------------------------------------------------------------*/
|
|
1518
|
+
#if (FXAA_QUALITY_PS > 6)
|
|
1519
|
+
if(doneNP) {
|
|
1520
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1521
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1522
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1523
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1524
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1525
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1526
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
|
|
1527
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
|
|
1528
|
+
doneNP = (!doneN) || (!doneP);
|
|
1529
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
|
|
1530
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
|
|
1531
|
+
/*--------------------------------------------------------------------------*/
|
|
1532
|
+
#if (FXAA_QUALITY_PS > 7)
|
|
1533
|
+
if(doneNP) {
|
|
1534
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1535
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1536
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1537
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1538
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1539
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1540
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
|
|
1541
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
|
|
1542
|
+
doneNP = (!doneN) || (!doneP);
|
|
1543
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
|
|
1544
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
|
|
1545
|
+
/*--------------------------------------------------------------------------*/
|
|
1546
|
+
#if (FXAA_QUALITY_PS > 8)
|
|
1547
|
+
if(doneNP) {
|
|
1548
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1549
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1550
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1551
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1552
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1553
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1554
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
|
|
1555
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
|
|
1556
|
+
doneNP = (!doneN) || (!doneP);
|
|
1557
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
|
|
1558
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
|
|
1559
|
+
/*--------------------------------------------------------------------------*/
|
|
1560
|
+
#if (FXAA_QUALITY_PS > 9)
|
|
1561
|
+
if(doneNP) {
|
|
1562
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1563
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1564
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1565
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1566
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1567
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1568
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
|
|
1569
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
|
|
1570
|
+
doneNP = (!doneN) || (!doneP);
|
|
1571
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
|
|
1572
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
|
|
1573
|
+
/*--------------------------------------------------------------------------*/
|
|
1574
|
+
#if (FXAA_QUALITY_PS > 10)
|
|
1575
|
+
if(doneNP) {
|
|
1576
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1577
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1578
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1579
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1580
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1581
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1582
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
|
|
1583
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
|
|
1584
|
+
doneNP = (!doneN) || (!doneP);
|
|
1585
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
|
|
1586
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
|
|
1587
|
+
/*--------------------------------------------------------------------------*/
|
|
1588
|
+
#if (FXAA_QUALITY_PS > 11)
|
|
1589
|
+
if(doneNP) {
|
|
1590
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1591
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1592
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1593
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1594
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1595
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1596
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
|
|
1597
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
|
|
1598
|
+
doneNP = (!doneN) || (!doneP);
|
|
1599
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
|
|
1600
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
|
|
1601
|
+
/*--------------------------------------------------------------------------*/
|
|
1602
|
+
#if (FXAA_QUALITY_PS > 12)
|
|
1603
|
+
if(doneNP) {
|
|
1604
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
1605
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
1606
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
1607
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
1608
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
1609
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
1610
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
|
|
1611
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
|
|
1612
|
+
doneNP = (!doneN) || (!doneP);
|
|
1613
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
|
|
1614
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
|
|
1615
|
+
/*--------------------------------------------------------------------------*/
|
|
1616
|
+
}
|
|
1617
|
+
#endif
|
|
1618
|
+
/*--------------------------------------------------------------------------*/
|
|
1619
|
+
}
|
|
1620
|
+
#endif
|
|
1621
|
+
/*--------------------------------------------------------------------------*/
|
|
1622
|
+
}
|
|
1623
|
+
#endif
|
|
1624
|
+
/*--------------------------------------------------------------------------*/
|
|
1625
|
+
}
|
|
1626
|
+
#endif
|
|
1627
|
+
/*--------------------------------------------------------------------------*/
|
|
1628
|
+
}
|
|
1629
|
+
#endif
|
|
1630
|
+
/*--------------------------------------------------------------------------*/
|
|
1631
|
+
}
|
|
1632
|
+
#endif
|
|
1633
|
+
/*--------------------------------------------------------------------------*/
|
|
1634
|
+
}
|
|
1635
|
+
#endif
|
|
1636
|
+
/*--------------------------------------------------------------------------*/
|
|
1637
|
+
}
|
|
1638
|
+
#endif
|
|
1639
|
+
/*--------------------------------------------------------------------------*/
|
|
1640
|
+
}
|
|
1641
|
+
#endif
|
|
1642
|
+
/*--------------------------------------------------------------------------*/
|
|
1643
|
+
}
|
|
1644
|
+
#endif
|
|
1645
|
+
/*--------------------------------------------------------------------------*/
|
|
1646
|
+
}
|
|
1647
|
+
/*--------------------------------------------------------------------------*/
|
|
1648
|
+
FxaaFloat dstN = posM.x - posN.x;
|
|
1649
|
+
FxaaFloat dstP = posP.x - posM.x;
|
|
1650
|
+
if(!horzSpan) dstN = posM.y - posN.y;
|
|
1651
|
+
if(!horzSpan) dstP = posP.y - posM.y;
|
|
1652
|
+
/*--------------------------------------------------------------------------*/
|
|
1653
|
+
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
|
|
1654
|
+
FxaaFloat spanLength = (dstP + dstN);
|
|
1655
|
+
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
|
|
1656
|
+
FxaaFloat spanLengthRcp = 1.0/spanLength;
|
|
1657
|
+
/*--------------------------------------------------------------------------*/
|
|
1658
|
+
FxaaBool directionN = dstN < dstP;
|
|
1659
|
+
FxaaFloat dst = min(dstN, dstP);
|
|
1660
|
+
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
|
|
1661
|
+
FxaaFloat subpixG = subpixF * subpixF;
|
|
1662
|
+
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
|
|
1663
|
+
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
|
|
1664
|
+
/*--------------------------------------------------------------------------*/
|
|
1665
|
+
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
|
|
1666
|
+
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
|
|
1667
|
+
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
|
|
1668
|
+
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
|
|
1669
|
+
return FxaaTexTop(tex, posM);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
vec4 fxaa_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
1673
|
+
const float fxaa_QualitySubpix = 0.5;
|
|
1674
|
+
const float fxaa_QualityEdgeThreshold = 0.125;
|
|
1675
|
+
const float fxaa_QualityEdgeThresholdMin = 0.0833;
|
|
1676
|
+
|
|
1677
|
+
return FxaaPixelShader_(
|
|
1678
|
+
texCoord,
|
|
1679
|
+
source,
|
|
1680
|
+
vec2(1.0) / texSize,
|
|
1681
|
+
fxaa_QualitySubpix,
|
|
1682
|
+
fxaa_QualityEdgeThreshold,
|
|
1683
|
+
fxaa_QualityEdgeThresholdMin
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
`
|
|
1687
|
+
);
|
|
1688
|
+
var fxaa = {
|
|
1689
|
+
name: "fxaa",
|
|
1690
|
+
propTypes: {},
|
|
1691
|
+
fs: fs20,
|
|
1692
|
+
passes: [{ sampler: true }],
|
|
1693
|
+
getUniforms: (props) => props
|
|
1694
|
+
};
|
|
1695
|
+
/**
|
|
1696
|
+
* ORIGINAL LICENCE
|
|
1697
|
+
* @license
|
|
1698
|
+
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
1699
|
+
*
|
|
1700
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1701
|
+
* modification, are permitted provided that the following conditions
|
|
1702
|
+
* are met:
|
|
1703
|
+
* * Redistributions of source code must retain the above copyright
|
|
1704
|
+
* notice, this list of conditions and the following disclaimer.
|
|
1705
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
1706
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
1707
|
+
* documentation and/or other materials provided with the distribution.
|
|
1708
|
+
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
1709
|
+
* contributors may be used to endorse or promote products derived
|
|
1710
|
+
* from this software without specific prior written permission.
|
|
1711
|
+
*
|
|
1712
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
|
1713
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
1714
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
1715
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
1716
|
+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
1717
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
1718
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
1719
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
1720
|
+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
1721
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1722
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1723
|
+
*/
|
|
1724
|
+
//# sourceMappingURL=index.cjs.map
|