@luma.gl/effects 7.4.0-alpha.2 → 9.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -1
- package/README.md +2 -2
- package/dist/dist.dev.js +3458 -0
- package/dist/dist.min.js +18 -30
- package/dist/index.cjs +1724 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts +15 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
- package/{src/shader-modules → dist/passes/postprocessing}/fxaa/fxaa.js +18 -14
- package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +43 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +68 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +43 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js +74 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +46 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +101 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +33 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.js +58 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +29 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js +44 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +29 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +35 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +44 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js +39 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +79 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +111 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +56 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +65 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +42 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +59 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +52 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +64 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +50 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +50 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +54 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.js +101 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +43 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +68 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +40 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.js +52 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +45 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.js +49 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +49 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +56 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +50 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.js +57 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +8 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.js +21 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -0
- package/package.json +37 -13
- package/src/index.ts +99 -0
- package/src/passes/postprocessing/fxaa/fxaa.ts +694 -0
- package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +81 -0
- package/src/passes/postprocessing/image-adjust-filters/denoise.ts +97 -0
- package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +120 -0
- package/src/passes/postprocessing/image-adjust-filters/noise.ts +73 -0
- package/src/passes/postprocessing/image-adjust-filters/sepia.ts +54 -0
- package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +48 -0
- package/src/passes/postprocessing/image-adjust-filters/vignette.ts +58 -0
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +135 -0
- package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +84 -0
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +75 -0
- package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +85 -0
- package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +70 -0
- package/src/passes/postprocessing/image-fun-filters/edgework.ts +120 -0
- package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +86 -0
- package/src/passes/postprocessing/image-fun-filters/ink.ts +73 -0
- package/src/passes/postprocessing/image-fun-filters/magnify.ts +70 -0
- package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +72 -0
- package/src/passes/postprocessing/image-warp-filters/swirl.ts +77 -0
- package/src/passes/postprocessing/image-warp-filters/warp.ts +28 -0
- package/dist/dist.js +0 -3621
- package/dist/es5/experimental/passes/outline-pass.js +0 -125
- package/dist/es5/experimental/passes/outline-pass.js.map +0 -1
- package/dist/es5/experimental/passes/ssao-pass.js +0 -133
- package/dist/es5/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/es5/experimental/shader-modules/convolution.js +0 -46
- package/dist/es5/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/es5/experimental/shader-modules/depth.js +0 -27
- package/dist/es5/experimental/shader-modules/depth.js.map +0 -1
- package/dist/es5/experimental/shader-modules/pack.js +0 -19
- package/dist/es5/experimental/shader-modules/pack.js.map +0 -1
- package/dist/es5/experimental/shader-modules/ssao.js +0 -32
- package/dist/es5/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/es5/index.js +0 -184
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/denoise.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/huesaturation.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/noise.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/sepia.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/vibrance.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/vignette.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/tiltshift.js +0 -49
- package/dist/es5/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/triangleblur.js +0 -42
- package/dist/es5/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/zoomblur.js +0 -31
- package/dist/es5/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/colorhalftone.js +0 -31
- package/dist/es5/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/dotscreen.js +0 -31
- package/dist/es5/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/edgework.js +0 -42
- package/dist/es5/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js +0 -29
- package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/ink.js +0 -24
- package/dist/es5/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/es5/shader-modules/fxaa/fxaa.js +0 -47
- package/dist/es5/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/es5/shader-modules/utils/random.js +0 -13
- package/dist/es5/shader-modules/utils/random.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/bulgepinch.js +0 -36
- package/dist/es5/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/swirl.js +0 -36
- package/dist/es5/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/warp.js +0 -13
- package/dist/es5/shader-modules/warp-filters/warp.js.map +0 -1
- package/dist/es6/experimental/passes/outline-pass.js +0 -48
- package/dist/es6/experimental/passes/outline-pass.js.map +0 -1
- package/dist/es6/experimental/passes/ssao-pass.js +0 -76
- package/dist/es6/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/es6/experimental/shader-modules/convolution.js +0 -37
- package/dist/es6/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/es6/experimental/shader-modules/depth.js +0 -13
- package/dist/es6/experimental/shader-modules/depth.js.map +0 -1
- package/dist/es6/experimental/shader-modules/pack.js +0 -10
- package/dist/es6/experimental/shader-modules/pack.js.map +0 -1
- package/dist/es6/experimental/shader-modules/ssao.js +0 -21
- package/dist/es6/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/es6/index.js +0 -23
- package/dist/es6/index.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/denoise.js +0 -20
- package/dist/es6/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/huesaturation.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/noise.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/sepia.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/vibrance.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/vignette.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/tiltshift.js +0 -38
- package/dist/es6/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/triangleblur.js +0 -31
- package/dist/es6/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/zoomblur.js +0 -20
- package/dist/es6/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/colorhalftone.js +0 -24
- package/dist/es6/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/dotscreen.js +0 -24
- package/dist/es6/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/edgework.js +0 -31
- package/dist/es6/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
- package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/ink.js +0 -17
- package/dist/es6/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/es6/shader-modules/fxaa/fxaa.js +0 -39
- package/dist/es6/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/es6/shader-modules/utils/random.js +0 -6
- package/dist/es6/shader-modules/utils/random.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/bulgepinch.js +0 -25
- package/dist/es6/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/swirl.js +0 -25
- package/dist/es6/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/warp.js +0 -6
- package/dist/es6/shader-modules/warp-filters/warp.js.map +0 -1
- package/dist/esm/experimental/passes/outline-pass.js +0 -114
- package/dist/esm/experimental/passes/outline-pass.js.map +0 -1
- package/dist/esm/experimental/passes/ssao-pass.js +0 -120
- package/dist/esm/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/esm/experimental/shader-modules/convolution.js +0 -39
- package/dist/esm/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/esm/experimental/shader-modules/depth.js +0 -16
- package/dist/esm/experimental/shader-modules/depth.js.map +0 -1
- package/dist/esm/experimental/shader-modules/pack.js +0 -12
- package/dist/esm/experimental/shader-modules/pack.js.map +0 -1
- package/dist/esm/experimental/shader-modules/ssao.js +0 -21
- package/dist/esm/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/esm/index.js +0 -23
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/denoise.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/huesaturation.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/noise.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/sepia.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/vibrance.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/vignette.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/tiltshift.js +0 -38
- package/dist/esm/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/triangleblur.js +0 -31
- package/dist/esm/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/zoomblur.js +0 -20
- package/dist/esm/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/colorhalftone.js +0 -24
- package/dist/esm/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/dotscreen.js +0 -24
- package/dist/esm/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/edgework.js +0 -31
- package/dist/esm/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
- package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/ink.js +0 -17
- package/dist/esm/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/esm/shader-modules/fxaa/fxaa.js +0 -39
- package/dist/esm/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/esm/shader-modules/utils/random.js +0 -6
- package/dist/esm/shader-modules/utils/random.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/bulgepinch.js +0 -25
- package/dist/esm/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/swirl.js +0 -25
- package/dist/esm/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/warp.js +0 -6
- package/dist/esm/shader-modules/warp-filters/warp.js.map +0 -1
- package/src/experimental/passes/outline-pass.js +0 -58
- package/src/experimental/passes/ssao-pass.js +0 -73
- package/src/experimental/passes/ssao-pass.md +0 -15
- package/src/experimental/shader-modules/convolution.js +0 -96
- package/src/experimental/shader-modules/convolution.md +0 -15
- package/src/experimental/shader-modules/depth.js +0 -84
- package/src/experimental/shader-modules/depth.md +0 -76
- package/src/experimental/shader-modules/pack.js +0 -32
- package/src/experimental/shader-modules/pack.md +0 -15
- package/src/experimental/shader-modules/ssao.js +0 -183
- package/src/experimental/shader-modules/ssao.md +0 -4
- package/src/index.js +0 -35
- package/src/shader-modules/adjust-filters/brightnesscontrast.js +0 -38
- package/src/shader-modules/adjust-filters/denoise.js +0 -49
- package/src/shader-modules/adjust-filters/huesaturation.js +0 -57
- package/src/shader-modules/adjust-filters/noise.js +0 -36
- package/src/shader-modules/adjust-filters/sepia.js +0 -37
- package/src/shader-modules/adjust-filters/vibrance.js +0 -32
- package/src/shader-modules/adjust-filters/vignette.js +0 -33
- package/src/shader-modules/blur-filters/tiltshift.js +0 -105
- package/src/shader-modules/blur-filters/triangleblur.js +0 -55
- package/src/shader-modules/blur-filters/zoomblur.js +0 -56
- package/src/shader-modules/fun-filters/colorhalftone.js +0 -60
- package/src/shader-modules/fun-filters/dotscreen.js +0 -45
- package/src/shader-modules/fun-filters/edgework.js +0 -84
- package/src/shader-modules/fun-filters/hexagonalpixelate.js +0 -63
- package/src/shader-modules/fun-filters/ink.js +0 -49
- package/src/shader-modules/utils/random.js +0 -12
- package/src/shader-modules/warp-filters/bulgepinch.js +0 -52
- package/src/shader-modules/warp-filters/swirl.js +0 -55
- package/src/shader-modules/warp-filters/warp.js +0 -19
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ORIGINAL LICENCE
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* Redistribution and use in source and binary forms, with or without
|
|
7
|
-
* modification, are permitted provided that the following conditions
|
|
8
|
-
* are met:
|
|
9
|
-
* * Redistributions of source code must retain the above copyright
|
|
10
|
-
* notice, this list of conditions and the following disclaimer.
|
|
11
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
12
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
13
|
-
* documentation and/or other materials provided with the distribution.
|
|
14
|
-
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
15
|
-
* contributors may be used to endorse or promote products derived
|
|
16
|
-
* from this software without specific prior written permission.
|
|
17
|
-
*
|
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
|
19
|
-
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
21
|
-
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
22
|
-
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
23
|
-
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
24
|
-
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
25
|
-
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
26
|
-
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
-
*/
|
|
30
|
-
var fs = "\n#define FXAA_QUALITY_PRESET 29\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n\nFxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n\nFxaaFloat4 FxaaPixelShader_(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaTexTop(tex, posM);\n}\n\nvec4 fxaa_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n const float fxaa_QualitySubpix = 0.5;\n const float fxaa_QualityEdgeThreshold = 0.125;\n const float fxaa_QualityEdgeThresholdMin = 0.0833;\n\n return FxaaPixelShader_(\n texCoord,\n texture,\n vec2(1.0) / texSize,\n fxaa_QualitySubpix,\n fxaa_QualityEdgeThreshold,\n fxaa_QualityEdgeThresholdMin\n );\n}\n";
|
|
31
|
-
export default {
|
|
32
|
-
name: 'fxaa',
|
|
33
|
-
uniforms: {},
|
|
34
|
-
fs: fs,
|
|
35
|
-
passes: [{
|
|
36
|
-
sampler: true
|
|
37
|
-
}]
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=fxaa.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shader-modules/fxaa/fxaa.js"],"names":["fs","name","uniforms","passes","sampler"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,IAAMA,EAAE,+nzBAAR;AAskBA,eAAe;AACbC,EAAAA,IAAI,EAAE,MADO;AAEbC,EAAAA,QAAQ,EAAE,EAFG;AAGbF,EAAAA,EAAE,EAAFA,EAHa;AAIbG,EAAAA,MAAM,EAAE,CAAC;AAACC,IAAAA,OAAO,EAAE;AAAV,GAAD;AAJK,CAAf","sourcesContent":["/**\n * ORIGINAL LICENCE\n * @license\n * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of NVIDIA CORPORATION nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// LUMA.GL\n// WebGL version from cesium.js, used under Apached 2.0 License\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// with the following modifications:\n// - fxaa_sampleColor to integrate with luma.gl\n// - Return color value with alpha to avoid another tap\n// - Calculate luminance in FxaaLuma\n\n// COMMENTS FROM CESIUM VERSION\n// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n//\n// Steps used to integrate into Cesium:\n// * The following defines are set:\n// #define FXAA_PC 1\n// #define FXAA_WEBGL_1 1\n// #define FXAA_GREEN_AS_LUMA 1\n// #define FXAA_EARLY_EXIT 1\n// #define FXAA_GLSL_120 1\n// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.\n// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace\n// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.\n// * There are no implicit conversions from ivec* to vec* so replace:\n// #define FxaaInt2 ivec2\n// with\n// #define FxaaInt2 vec2\n// * The texture2DLod function is only available in vertex shaders so replace:\n// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n// with\n// #define FxaaTexTop(t, p) texture2D(t, p)\n// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.\n// * The following parameters to FxaaPixelShader_ are unused and can be removed:\n// fxaaConsolePosPos\n// fxaaConsoleRcpFrameOpt\n// fxaaConsoleRcpFrameOpt2\n// fxaaConsole360RcpFrameOpt2\n// fxaaConsoleEdgeSharpness\n// fxaaConsoleEdgeThreshold\n// fxaaConsoleEdgeThresholdMi\n// fxaaConsole360ConstDir\n//\n// Choose the quality preset.\n// This needs to be compiled into the shader as it effects code.\n// Best option to include multiple presets is to\n// in each shader define the preset, then include this file.\n//\n// OPTIONS\n// -----------------------------------------------------------------------\n// 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n// 39 - no dither, very expensive\n//\n// NOTES\n// -----------------------------------------------------------------------\n// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n// 13 = about same speed as FXAA 3.9 and better than 12\n// 23 = closest to FXAA 3.9 visually and performance wise\n// _ = the lowest digit is directly related to performance\n// _ = the highest digit is directly related to style\n//\n\nconst fs = `\n#define FXAA_QUALITY_PRESET 29\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n\nFxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n\nFxaaFloat4 FxaaPixelShader_(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaTexTop(tex, posM);\n}\n\nvec4 fxaa_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n const float fxaa_QualitySubpix = 0.5;\n const float fxaa_QualityEdgeThreshold = 0.125;\n const float fxaa_QualityEdgeThresholdMin = 0.0833;\n\n return FxaaPixelShader_(\n texCoord,\n texture,\n vec2(1.0) / texSize,\n fxaa_QualitySubpix,\n fxaa_QualityEdgeThreshold,\n fxaa_QualityEdgeThresholdMin\n );\n}\n`;\n\nexport default {\n name: 'fxaa',\n uniforms: {},\n fs,\n passes: [{sampler: true}]\n};\n"],"file":"fxaa.js"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var fs = "float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n";
|
|
2
|
-
export default {
|
|
3
|
-
name: 'random',
|
|
4
|
-
fs: fs
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=random.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shader-modules/utils/random.js"],"names":["fs","name"],"mappings":"AACA,IAAMA,EAAE,iMAAR;AAOA,eAAe;AACbC,EAAAA,IAAI,EAAE,QADO;AAEbD,EAAAA,EAAE,EAAFA;AAFa,CAAf","sourcesContent":["// Quick random generator for fragment shaders\nconst fs = `\\\nfloat random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n`;\n\nexport default {\n name: 'random',\n fs\n};\n"],"file":"random.js"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import warp from './warp';
|
|
2
|
-
var fs = "uniform float radius;\nuniform float strength;\nuniform vec2 center;\n\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, center * texSize);\n\n return warp_sampleColor(texture, texSize, coord);\n}\n";
|
|
3
|
-
var uniforms = {
|
|
4
|
-
center: [0.5, 0.5],
|
|
5
|
-
radius: {
|
|
6
|
-
value: 200,
|
|
7
|
-
min: 1,
|
|
8
|
-
softMax: 600
|
|
9
|
-
},
|
|
10
|
-
strength: {
|
|
11
|
-
value: 0.5,
|
|
12
|
-
min: -1,
|
|
13
|
-
max: 1
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export default {
|
|
17
|
-
name: 'bulgePinch',
|
|
18
|
-
fs: fs,
|
|
19
|
-
uniforms: uniforms,
|
|
20
|
-
dependencies: [warp],
|
|
21
|
-
passes: [{
|
|
22
|
-
sampler: true
|
|
23
|
-
}]
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=bulgepinch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shader-modules/warp-filters/bulgepinch.js"],"names":["warp","fs","uniforms","center","radius","value","min","softMax","strength","max","name","dependencies","passes","sampler"],"mappings":"AAQA,OAAOA,IAAP,MAAiB,QAAjB;AAEA,IAAMC,EAAE,6vBAAR;AA4BA,IAAMC,QAAQ,GAAG;AACfC,EAAAA,MAAM,EAAE,CAAC,GAAD,EAAM,GAAN,CADO;AAEfC,EAAAA,MAAM,EAAE;AAACC,IAAAA,KAAK,EAAE,GAAR;AAAaC,IAAAA,GAAG,EAAE,CAAlB;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GAFO;AAGfC,EAAAA,QAAQ,EAAE;AAACH,IAAAA,KAAK,EAAE,GAAR;AAAaC,IAAAA,GAAG,EAAE,CAAC,CAAnB;AAAsBG,IAAAA,GAAG,EAAE;AAA3B;AAHK,CAAjB;AAMA,eAAe;AACbC,EAAAA,IAAI,EAAE,YADO;AAEbT,EAAAA,EAAE,EAAFA,EAFa;AAGbC,EAAAA,QAAQ,EAARA,QAHa;AAIbS,EAAAA,YAAY,EAAE,CAACX,IAAD,CAJD;AAMbY,EAAAA,MAAM,EAAE,CAAC;AAACC,IAAAA,OAAO,EAAE;AAAV,GAAD;AANK,CAAf","sourcesContent":["/**\n * @filter Bulge / Pinch\n * @description Bulges or pinches the image in a circle.\n * @param centerX The x coordinate of the center of the circle of effect.\n * @param centerY The y coordinate of the center of the circle of effect.\n * @param radius The radius of the circle of effect.\n * @param strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge)\n */\nimport warp from './warp';\n\nconst fs = `\\\nuniform float radius;\nuniform float strength;\nuniform vec2 center;\n\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, center * texSize);\n\n return warp_sampleColor(texture, texSize, coord);\n}\n`;\n\nconst uniforms = {\n center: [0.5, 0.5],\n radius: {value: 200, min: 1, softMax: 600},\n strength: {value: 0.5, min: -1, max: 1}\n};\n\nexport default {\n name: 'bulgePinch',\n fs,\n uniforms,\n dependencies: [warp],\n\n passes: [{sampler: true}]\n};\n"],"file":"bulgepinch.js"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import warp from './warp';
|
|
2
|
-
var fs = "uniform float radius;\nuniform float angle;\nuniform vec2 center;\n\nvec2 swirl_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < radius) {\n float percent = (radius - distance) / radius;\n float theta = percent * percent * angle;\n float s = sin(theta);\n float c = cos(theta);\n coord = vec2(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = swirl_warp(coord, center * texSize);\n\n return warp_sampleColor(texture, texSize, coord);\n}\n";
|
|
3
|
-
var uniforms = {
|
|
4
|
-
center: [0.5, 0.5],
|
|
5
|
-
radius: {
|
|
6
|
-
value: 200,
|
|
7
|
-
min: 1,
|
|
8
|
-
softMax: 600
|
|
9
|
-
},
|
|
10
|
-
angle: {
|
|
11
|
-
value: 3,
|
|
12
|
-
softMin: -25,
|
|
13
|
-
softMax: 25
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export default {
|
|
17
|
-
name: 'swirl',
|
|
18
|
-
uniforms: uniforms,
|
|
19
|
-
fs: fs,
|
|
20
|
-
dependencies: [warp],
|
|
21
|
-
passes: [{
|
|
22
|
-
sampler: true
|
|
23
|
-
}]
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=swirl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shader-modules/warp-filters/swirl.js"],"names":["warp","fs","uniforms","center","radius","value","min","softMax","angle","softMin","name","dependencies","passes","sampler"],"mappings":"AASA,OAAOA,IAAP,MAAiB,QAAjB;AAEA,IAAMC,EAAE,8sBAAR;AA8BA,IAAMC,QAAQ,GAAG;AACfC,EAAAA,MAAM,EAAE,CAAC,GAAD,EAAM,GAAN,CADO;AAEfC,EAAAA,MAAM,EAAE;AAACC,IAAAA,KAAK,EAAE,GAAR;AAAaC,IAAAA,GAAG,EAAE,CAAlB;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GAFO;AAGfC,EAAAA,KAAK,EAAE;AAACH,IAAAA,KAAK,EAAE,CAAR;AAAWI,IAAAA,OAAO,EAAE,CAAC,EAArB;AAAyBF,IAAAA,OAAO,EAAE;AAAlC;AAHQ,CAAjB;AAMA,eAAe;AACbG,EAAAA,IAAI,EAAE,OADO;AAEbR,EAAAA,QAAQ,EAARA,QAFa;AAGbD,EAAAA,EAAE,EAAFA,EAHa;AAIbU,EAAAA,YAAY,EAAE,CAACX,IAAD,CAJD;AAMbY,EAAAA,MAAM,EAAE,CAAC;AAACC,IAAAA,OAAO,EAAE;AAAV,GAAD;AANK,CAAf","sourcesContent":["/**\n * @filter Swirl\n * @description Warps a circular region of the image in a swirl.\n * @param centerX The x coordinate of the center of the circular region.\n * @param centerY The y coordinate of the center of the circular region.\n * @param radius The radius of the circular region.\n * @param angle The angle in radians that the pixels in the center of\n * the circular region will be rotated by.\n */\nimport warp from './warp';\n\nconst fs = `\\\nuniform float radius;\nuniform float angle;\nuniform vec2 center;\n\nvec2 swirl_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < radius) {\n float percent = (radius - distance) / radius;\n float theta = percent * percent * angle;\n float s = sin(theta);\n float c = cos(theta);\n coord = vec2(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = swirl_warp(coord, center * texSize);\n\n return warp_sampleColor(texture, texSize, coord);\n}\n`;\n\nconst uniforms = {\n center: [0.5, 0.5],\n radius: {value: 200, min: 1, softMax: 600},\n angle: {value: 3, softMin: -25, softMax: 25}\n};\n\nexport default {\n name: 'swirl',\n uniforms,\n fs,\n dependencies: [warp],\n\n passes: [{sampler: true}]\n};\n"],"file":"swirl.js"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var fs = "vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {\n vec4 color = texture2D(texture, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n return color;\n}\n";
|
|
2
|
-
export default {
|
|
3
|
-
name: 'warp',
|
|
4
|
-
fs: fs
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=warp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shader-modules/warp-filters/warp.js"],"names":["fs","name"],"mappings":"AAEA,IAAMA,EAAE,6WAAR;AAaA,eAAe;AACbC,EAAAA,IAAI,EAAE,MADO;AAEbD,EAAAA,EAAE,EAAFA;AAFa,CAAf","sourcesContent":["// TODO: FIXME\n/* eslint-disable */\nconst fs = `\\\nvec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {\n vec4 color = texture2D(texture, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n /* fade to transparent if we are outside the image */\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n return color;\n}\n`;\n\nexport default {\n name: 'warp',\n fs\n};\n"],"file":"warp.js"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A traditional stencil buffer based outline pass.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import GL from '@luma.gl/constants';
|
|
6
|
-
import {_Pass as Pass, withParameters, setParameters} from '@luma.gl/core';
|
|
7
|
-
|
|
8
|
-
export default class OutlinePass extends Pass {
|
|
9
|
-
constructor(gl, props = {}) {
|
|
10
|
-
super(gl, Object.assign({id: 'simple-outline-pass'}, props));
|
|
11
|
-
this.setProps(props);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
setProps(props) {
|
|
15
|
-
this.props = Object.assign(this.props, props);
|
|
16
|
-
// this.clipspace.setUniforms(pixelation.getUniforms(this.props));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
_renderPass({gl, animationProps}) {
|
|
20
|
-
withParameters(
|
|
21
|
-
gl,
|
|
22
|
-
{
|
|
23
|
-
stencilTest: true, // turn on stencil buffers
|
|
24
|
-
stencilOp: [GL.KEEP, GL.KEEP, GL.REPLACE] // update stencil if both stencil+depth tests pass
|
|
25
|
-
},
|
|
26
|
-
() => {
|
|
27
|
-
// Enable writing to stencil buffer plane 0
|
|
28
|
-
setParameters(gl, {
|
|
29
|
-
stencilFunc: [GL.ALWAYS, 1, 0xff], // update stencil buffer, regardless of current value
|
|
30
|
-
stencilMask: 0x01
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
gl.clear(GL.STENCIL_BUFFER_BIT);
|
|
34
|
-
|
|
35
|
-
// draw
|
|
36
|
-
for (const model of this.props.models) {
|
|
37
|
-
model.setUniforms(this.props.normalUniforms);
|
|
38
|
-
model.draw(this.props.drawParams);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Disable stencil writing, mask to stencil plane 0
|
|
42
|
-
setParameters(gl, {
|
|
43
|
-
stencilFunc: [GL.NOTEQUAL, 1, 0x01],
|
|
44
|
-
stencilMask: 0x00, // disable writing to the stencil buffer
|
|
45
|
-
depthTest: false
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
for (const model of this.props.models) {
|
|
49
|
-
model.setUniforms(this.props.outlineUniforms);
|
|
50
|
-
model.draw(this.props.drawParams);
|
|
51
|
-
model.setUniforms(this.props.normalUniforms);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// All GL settings will reset here...
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Screen-space ambient occlusion pass.
|
|
3
|
-
*
|
|
4
|
-
* Ported to luma.gl from THREE.js (MIT license).
|
|
5
|
-
* Attributions (per comments in original THREE.js files):
|
|
6
|
-
* @author alteredq / http://alteredqualia.com/
|
|
7
|
-
* @author tentone
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/* eslint-disable camelcase */
|
|
11
|
-
import {_Pass as Pass, Framebuffer, ClipSpace, withParameters} from '@luma.gl/core';
|
|
12
|
-
import ssao from '../shader-modules/ssao';
|
|
13
|
-
|
|
14
|
-
export default class SSAOPass extends Pass {
|
|
15
|
-
constructor(gl, props) {
|
|
16
|
-
super(gl, Object.assign({id: 'ssao-pass', swap: true}, ssao.DEFAULT_PROPS, props));
|
|
17
|
-
|
|
18
|
-
this.renderToScreen = false;
|
|
19
|
-
|
|
20
|
-
// Depth render target, for `depth` shader module
|
|
21
|
-
this.depthFramebuffer = new Framebuffer(gl, {id: 'ssao-pass-depth-map'});
|
|
22
|
-
|
|
23
|
-
this.clipspace = new ClipSpace(gl, {
|
|
24
|
-
id: 'ssao-pass',
|
|
25
|
-
modules: [ssao],
|
|
26
|
-
fs: `
|
|
27
|
-
varying vec2 uv;
|
|
28
|
-
void main() {
|
|
29
|
-
gl_FragColor = ssao_getColor(uv);
|
|
30
|
-
}
|
|
31
|
-
`
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
this.setProps(props);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
setProps(props) {
|
|
38
|
-
super.setProps(props);
|
|
39
|
-
|
|
40
|
-
const {width = 512, height = 512} = this.props;
|
|
41
|
-
this.depthFramebuffer.resize({width, height});
|
|
42
|
-
this.clipspace.setUniforms(this.props);
|
|
43
|
-
|
|
44
|
-
// Shader uniforms
|
|
45
|
-
// this.uniforms['cameraNear' ].value = this.camera2.near;
|
|
46
|
-
// this.uniforms[ 'cameraFar' ].value = this.camera2.far;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
_renderPass({inputBuffer, outputBuffer, animationProps}) {
|
|
50
|
-
const {width, height} = inputBuffer;
|
|
51
|
-
this.depthFramebuffer.resize({width, height});
|
|
52
|
-
|
|
53
|
-
// Render depth into depthRenderTarget
|
|
54
|
-
withParameters(this.gl, {framebuffer: this.depthFramebuffer}, () => {
|
|
55
|
-
this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
|
|
56
|
-
for (const model of this.props.models) {
|
|
57
|
-
model.setUniforms({depth_uEnabled: true});
|
|
58
|
-
model.draw(Object.assign({}, this.props.drawParams, {animationProps}));
|
|
59
|
-
model.setUniforms({depth_uEnabled: false});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
|
|
64
|
-
this.clipspace.draw({
|
|
65
|
-
animationProps,
|
|
66
|
-
uniforms: {
|
|
67
|
-
tDepth: this.depthFramebuffer,
|
|
68
|
-
tDiffuse: inputBuffer,
|
|
69
|
-
size: [this.depthFramebuffer.width, this.depthFramebuffer.height]
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# SSAOPass (Experimental)
|
|
2
|
-
|
|
3
|
-
A Screen Space Ambient Occlusion Render Pass
|
|
4
|
-
|
|
5
|
-
References:
|
|
6
|
-
|
|
7
|
-
* Based on SSAO shader module
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Properties
|
|
11
|
-
|
|
12
|
-
* `radius` - Ambient occlusion shadow radius (numeric value).
|
|
13
|
-
* `onlyAO` - Display only ambient occlusion result (boolean value).
|
|
14
|
-
* `aoClamp` - Ambient occlusion clamp (numeric value).
|
|
15
|
-
* `lumInfluence` - Pixel luminosity influence in AO calculation (numeric value).
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// A convolution shader
|
|
2
|
-
// Based on https://webglfundamentals.org/webgl/lessons/webgl-image-processing-continued.html
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
# Copyright 2012, Gregg Tavares.
|
|
6
|
-
# All rights reserved.
|
|
7
|
-
#
|
|
8
|
-
# Redistribution and use in source and binary forms, with or without
|
|
9
|
-
# modification, are permitted provided that the following conditions are
|
|
10
|
-
# met:
|
|
11
|
-
#
|
|
12
|
-
# * Redistributions of source code must retain the above copyright
|
|
13
|
-
# notice, this list of conditions and the following disclaimer.
|
|
14
|
-
# * Redistributions in binary form must reproduce the above
|
|
15
|
-
# copyright notice, this list of conditions and the following disclaimer
|
|
16
|
-
# in the documentation and/or other materials provided with the
|
|
17
|
-
# distribution.
|
|
18
|
-
# * Neither the name of Gregg Tavares. nor the names of his
|
|
19
|
-
# contributors may be used to endorse or promote products derived from
|
|
20
|
-
# this software without specific prior written permission.
|
|
21
|
-
#
|
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
-
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
-
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
// Pre-defined convolution kernels
|
|
36
|
-
/* eslint-disable */
|
|
37
|
-
const KERNEL = {
|
|
38
|
-
NORMAL: [0, 0, 0, 0, 1, 0, 0, 0, 0],
|
|
39
|
-
GAUSSIAN_BLUR: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
|
|
40
|
-
GAUSSIAN_BLUR_2: [1, 2, 1, 2, 4, 2, 1, 2, 1],
|
|
41
|
-
GAUSSIAN_BLUR_3: [0, 1, 0, 1, 1, 1, 0, 1, 0],
|
|
42
|
-
UNSHARPEN: [-1, -1, -1, -1, 9, -1, -1, -1, -1],
|
|
43
|
-
SHARPNESS: [0, -1, 0, -1, 5, -1, 0, -1, 0],
|
|
44
|
-
SHARPEN: [-1, -1, -1, -1, 16, -1, -1, -1, -1],
|
|
45
|
-
EDGE_DETECT: [-0.125, -0.125, -0.125, -0.125, 1, -0.125, -0.125, -0.125, -0.125],
|
|
46
|
-
EDGE_DETECT_2: [-1, -1, -1, -1, 8, -1, -1, -1, -1],
|
|
47
|
-
EDGE_DETECT_3: [-5, 0, 0, 0, 0, 0, 0, 0, 5],
|
|
48
|
-
EDGE_DETECT_4: [-1, -1, -1, 0, 0, 0, 1, 1, 1],
|
|
49
|
-
EDGE_DETECT_5: [-1, -1, -1, 2, 2, 2, -1, -1, -1],
|
|
50
|
-
EDGE_DETECT_6: [-5, -5, -5, -5, 39, -5, -5, -5, -5],
|
|
51
|
-
SOBEL_HORIZONTAL: [1, 2, 1, 0, 0, 0, -1, -2, -1],
|
|
52
|
-
SOBEL_VERTICAL: [1, 0, -1, 2, 0, -2, 1, 0, -1],
|
|
53
|
-
PREVIT_HORIZONTAL: [1, 1, 1, 0, 0, 0, -1, -1, -1],
|
|
54
|
-
PREVIT_VERTICAL: [1, 0, -1, 1, 0, -1, 1, 0, -1],
|
|
55
|
-
BOX_BLUR: [0.111, 0.111, 0.111, 0.111, 0.111, 0.111, 0.111, 0.111, 0.111],
|
|
56
|
-
TRIANGLE_BLUR: [0.0625, 0.125, 0.0625, 0.125, 0.25, 0.125, 0.0625, 0.125, 0.0625],
|
|
57
|
-
EMBOSS: [-2, -1, 0, -1, 1, 1, 0, 1, 2]
|
|
58
|
-
};
|
|
59
|
-
/* eslint-enable */
|
|
60
|
-
|
|
61
|
-
const fs = `
|
|
62
|
-
precision highp float;
|
|
63
|
-
|
|
64
|
-
uniform float kernel[9];
|
|
65
|
-
uniform float kernelWeight;
|
|
66
|
-
|
|
67
|
-
vec4 convolution_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoords) {
|
|
68
|
-
vec2 onePixel = vec2(1.0, 1.0) / texSize;
|
|
69
|
-
vec4 colorSum =
|
|
70
|
-
texture2D(texture, texCoords + onePixel * vec2(-1, -1)) * kernel[0] +
|
|
71
|
-
texture2D(texture, texCoords + onePixel * vec2( 0, -1)) * kernel[1] +
|
|
72
|
-
texture2D(texture, texCoords + onePixel * vec2( 1, -1)) * kernel[2] +
|
|
73
|
-
texture2D(texture, texCoords + onePixel * vec2(-1, 0)) * kernel[3] +
|
|
74
|
-
texture2D(texture, texCoords + onePixel * vec2( 0, 0)) * kernel[4] +
|
|
75
|
-
texture2D(texture, texCoords + onePixel * vec2( 1, 0)) * kernel[5] +
|
|
76
|
-
texture2D(texture, texCoords + onePixel * vec2(-1, 1)) * kernel[6] +
|
|
77
|
-
texture2D(texture, texCoords + onePixel * vec2( 0, 1)) * kernel[7] +
|
|
78
|
-
texture2D(texture, texCoords + onePixel * vec2( 1, 1)) * kernel[8] ;
|
|
79
|
-
|
|
80
|
-
// Divide the sum by the weight but just use rgb, set alpha to 1.0
|
|
81
|
-
return vec4((colorSum / kernelWeight).rgb, colorSum.a);
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
const uniforms = {
|
|
86
|
-
kernel: KERNEL.NORMAL,
|
|
87
|
-
kernelWeight: KERNEL.NORMAL.reduce((sum, x) => sum + x, 0)
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export default {
|
|
91
|
-
name: 'convolution',
|
|
92
|
-
uniforms,
|
|
93
|
-
fs,
|
|
94
|
-
KERNEL,
|
|
95
|
-
passes: [{sampler: true}]
|
|
96
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// depth buffer utilities
|
|
2
|
-
// initial version ported from THREE.js
|
|
3
|
-
|
|
4
|
-
/* eslint-disable camelcase */
|
|
5
|
-
import pack from './pack';
|
|
6
|
-
|
|
7
|
-
const fs = `\
|
|
8
|
-
#define DEPTH_PACKING 3201
|
|
9
|
-
|
|
10
|
-
uniform bool depth_uEnabled;
|
|
11
|
-
|
|
12
|
-
#ifdef USE_LOGDEPTHBUF
|
|
13
|
-
uniform float logDepthBufFC;
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
#if DEPTH_PACKING == 3200
|
|
17
|
-
uniform float opacity;
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions
|
|
22
|
-
|
|
23
|
-
float depth_viewZToOrthographicDepth(
|
|
24
|
-
const in float viewZ, const in float near, const in float far
|
|
25
|
-
) {
|
|
26
|
-
return ( viewZ + near ) / ( near - far );
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
float depth_orthographicDepthToViewZ(
|
|
30
|
-
const in float linearClipZ, const in float near, const in float far
|
|
31
|
-
) {
|
|
32
|
-
return linearClipZ * ( near - far ) - near;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
float depth_viewZToPerspectiveDepth(
|
|
36
|
-
const in float viewZ, const in float near, const in float far
|
|
37
|
-
) {
|
|
38
|
-
return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
float depth_perspectiveDepthToViewZ(
|
|
42
|
-
const in float invClipZ, const in float near, const in float far
|
|
43
|
-
) {
|
|
44
|
-
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Sample depth buffer and convert to float
|
|
48
|
-
float depth_getDepth(sampler2D tDepth, vec2 coord) {
|
|
49
|
-
float depthValue = pack_RGBA8ToFloat(texture2D(tDepth, coord));
|
|
50
|
-
#ifdef USE_LOGDEPTHBUF
|
|
51
|
-
float logz = depthValue;
|
|
52
|
-
float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;
|
|
53
|
-
float z = (logz / w) + 1.0;
|
|
54
|
-
#else
|
|
55
|
-
float z = depthValue;
|
|
56
|
-
#endif
|
|
57
|
-
return z;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
vec4 depth_getColor() {
|
|
62
|
-
#if DEPTH_PACKING == 3200
|
|
63
|
-
return vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );
|
|
64
|
-
#elif DEPTH_PACKING == 3201
|
|
65
|
-
return pack_floatToRGBA8( gl_FragCoord.z );
|
|
66
|
-
#endif
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
vec4 depth_filterColor(vec4 color) {
|
|
70
|
-
return depth_uEnabled ? depth_getColor() : color;
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
const DEFAULT_PROPS = {
|
|
75
|
-
depth_uEnabled: false
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default {
|
|
79
|
-
name: 'depth',
|
|
80
|
-
dependencies: [pack],
|
|
81
|
-
fs,
|
|
82
|
-
DEFAULT_PROPS,
|
|
83
|
-
getUniforms: (props = DEFAULT_PROPS) => props
|
|
84
|
-
};
|