@luma.gl/effects 7.4.0-alpha.2 → 9.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -1
- package/README.md +2 -2
- package/dist/dist.dev.js +3458 -0
- package/dist/dist.min.js +18 -30
- package/dist/index.cjs +1724 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts +15 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
- package/{src/shader-modules → dist/passes/postprocessing}/fxaa/fxaa.js +18 -14
- package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +43 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +68 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +43 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js +74 -0
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +46 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +101 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +33 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.js +58 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +29 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js +44 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +29 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +35 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +44 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js +39 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +79 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +111 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +56 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +65 -0
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +42 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +59 -0
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +52 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +64 -0
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +50 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +50 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +54 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.js +101 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +43 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +68 -0
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +40 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.js +52 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +45 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.js +49 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +49 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +56 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +50 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.js +57 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +8 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.js +21 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -0
- package/package.json +37 -13
- package/src/index.ts +99 -0
- package/src/passes/postprocessing/fxaa/fxaa.ts +694 -0
- package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +81 -0
- package/src/passes/postprocessing/image-adjust-filters/denoise.ts +97 -0
- package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +120 -0
- package/src/passes/postprocessing/image-adjust-filters/noise.ts +73 -0
- package/src/passes/postprocessing/image-adjust-filters/sepia.ts +54 -0
- package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +48 -0
- package/src/passes/postprocessing/image-adjust-filters/vignette.ts +58 -0
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +135 -0
- package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +84 -0
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +75 -0
- package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +85 -0
- package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +70 -0
- package/src/passes/postprocessing/image-fun-filters/edgework.ts +120 -0
- package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +86 -0
- package/src/passes/postprocessing/image-fun-filters/ink.ts +73 -0
- package/src/passes/postprocessing/image-fun-filters/magnify.ts +70 -0
- package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +72 -0
- package/src/passes/postprocessing/image-warp-filters/swirl.ts +77 -0
- package/src/passes/postprocessing/image-warp-filters/warp.ts +28 -0
- package/dist/dist.js +0 -3621
- package/dist/es5/experimental/passes/outline-pass.js +0 -125
- package/dist/es5/experimental/passes/outline-pass.js.map +0 -1
- package/dist/es5/experimental/passes/ssao-pass.js +0 -133
- package/dist/es5/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/es5/experimental/shader-modules/convolution.js +0 -46
- package/dist/es5/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/es5/experimental/shader-modules/depth.js +0 -27
- package/dist/es5/experimental/shader-modules/depth.js.map +0 -1
- package/dist/es5/experimental/shader-modules/pack.js +0 -19
- package/dist/es5/experimental/shader-modules/pack.js.map +0 -1
- package/dist/es5/experimental/shader-modules/ssao.js +0 -32
- package/dist/es5/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/es5/index.js +0 -184
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/denoise.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/huesaturation.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/noise.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/sepia.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/vibrance.js +0 -24
- package/dist/es5/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/es5/shader-modules/adjust-filters/vignette.js +0 -29
- package/dist/es5/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/tiltshift.js +0 -49
- package/dist/es5/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/triangleblur.js +0 -42
- package/dist/es5/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/es5/shader-modules/blur-filters/zoomblur.js +0 -31
- package/dist/es5/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/colorhalftone.js +0 -31
- package/dist/es5/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/dotscreen.js +0 -31
- package/dist/es5/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/edgework.js +0 -42
- package/dist/es5/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js +0 -29
- package/dist/es5/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/es5/shader-modules/fun-filters/ink.js +0 -24
- package/dist/es5/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/es5/shader-modules/fxaa/fxaa.js +0 -47
- package/dist/es5/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/es5/shader-modules/utils/random.js +0 -13
- package/dist/es5/shader-modules/utils/random.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/bulgepinch.js +0 -36
- package/dist/es5/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/swirl.js +0 -36
- package/dist/es5/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/es5/shader-modules/warp-filters/warp.js +0 -13
- package/dist/es5/shader-modules/warp-filters/warp.js.map +0 -1
- package/dist/es6/experimental/passes/outline-pass.js +0 -48
- package/dist/es6/experimental/passes/outline-pass.js.map +0 -1
- package/dist/es6/experimental/passes/ssao-pass.js +0 -76
- package/dist/es6/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/es6/experimental/shader-modules/convolution.js +0 -37
- package/dist/es6/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/es6/experimental/shader-modules/depth.js +0 -13
- package/dist/es6/experimental/shader-modules/depth.js.map +0 -1
- package/dist/es6/experimental/shader-modules/pack.js +0 -10
- package/dist/es6/experimental/shader-modules/pack.js.map +0 -1
- package/dist/es6/experimental/shader-modules/ssao.js +0 -21
- package/dist/es6/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/es6/index.js +0 -23
- package/dist/es6/index.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/denoise.js +0 -20
- package/dist/es6/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/huesaturation.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/noise.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/sepia.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/vibrance.js +0 -17
- package/dist/es6/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/es6/shader-modules/adjust-filters/vignette.js +0 -22
- package/dist/es6/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/tiltshift.js +0 -38
- package/dist/es6/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/triangleblur.js +0 -31
- package/dist/es6/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/es6/shader-modules/blur-filters/zoomblur.js +0 -20
- package/dist/es6/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/colorhalftone.js +0 -24
- package/dist/es6/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/dotscreen.js +0 -24
- package/dist/es6/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/edgework.js +0 -31
- package/dist/es6/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
- package/dist/es6/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/es6/shader-modules/fun-filters/ink.js +0 -17
- package/dist/es6/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/es6/shader-modules/fxaa/fxaa.js +0 -39
- package/dist/es6/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/es6/shader-modules/utils/random.js +0 -6
- package/dist/es6/shader-modules/utils/random.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/bulgepinch.js +0 -25
- package/dist/es6/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/swirl.js +0 -25
- package/dist/es6/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/es6/shader-modules/warp-filters/warp.js +0 -6
- package/dist/es6/shader-modules/warp-filters/warp.js.map +0 -1
- package/dist/esm/experimental/passes/outline-pass.js +0 -114
- package/dist/esm/experimental/passes/outline-pass.js.map +0 -1
- package/dist/esm/experimental/passes/ssao-pass.js +0 -120
- package/dist/esm/experimental/passes/ssao-pass.js.map +0 -1
- package/dist/esm/experimental/shader-modules/convolution.js +0 -39
- package/dist/esm/experimental/shader-modules/convolution.js.map +0 -1
- package/dist/esm/experimental/shader-modules/depth.js +0 -16
- package/dist/esm/experimental/shader-modules/depth.js.map +0 -1
- package/dist/esm/experimental/shader-modules/pack.js +0 -12
- package/dist/esm/experimental/shader-modules/pack.js.map +0 -1
- package/dist/esm/experimental/shader-modules/ssao.js +0 -21
- package/dist/esm/experimental/shader-modules/ssao.js.map +0 -1
- package/dist/esm/index.js +0 -23
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/brightnesscontrast.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/denoise.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/denoise.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/huesaturation.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/huesaturation.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/noise.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/noise.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/sepia.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/sepia.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/vibrance.js +0 -17
- package/dist/esm/shader-modules/adjust-filters/vibrance.js.map +0 -1
- package/dist/esm/shader-modules/adjust-filters/vignette.js +0 -22
- package/dist/esm/shader-modules/adjust-filters/vignette.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/tiltshift.js +0 -38
- package/dist/esm/shader-modules/blur-filters/tiltshift.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/triangleblur.js +0 -31
- package/dist/esm/shader-modules/blur-filters/triangleblur.js.map +0 -1
- package/dist/esm/shader-modules/blur-filters/zoomblur.js +0 -20
- package/dist/esm/shader-modules/blur-filters/zoomblur.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/colorhalftone.js +0 -24
- package/dist/esm/shader-modules/fun-filters/colorhalftone.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/dotscreen.js +0 -24
- package/dist/esm/shader-modules/fun-filters/dotscreen.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/edgework.js +0 -31
- package/dist/esm/shader-modules/fun-filters/edgework.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js +0 -22
- package/dist/esm/shader-modules/fun-filters/hexagonalpixelate.js.map +0 -1
- package/dist/esm/shader-modules/fun-filters/ink.js +0 -17
- package/dist/esm/shader-modules/fun-filters/ink.js.map +0 -1
- package/dist/esm/shader-modules/fxaa/fxaa.js +0 -39
- package/dist/esm/shader-modules/fxaa/fxaa.js.map +0 -1
- package/dist/esm/shader-modules/utils/random.js +0 -6
- package/dist/esm/shader-modules/utils/random.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/bulgepinch.js +0 -25
- package/dist/esm/shader-modules/warp-filters/bulgepinch.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/swirl.js +0 -25
- package/dist/esm/shader-modules/warp-filters/swirl.js.map +0 -1
- package/dist/esm/shader-modules/warp-filters/warp.js +0 -6
- package/dist/esm/shader-modules/warp-filters/warp.js.map +0 -1
- package/src/experimental/passes/outline-pass.js +0 -58
- package/src/experimental/passes/ssao-pass.js +0 -73
- package/src/experimental/passes/ssao-pass.md +0 -15
- package/src/experimental/shader-modules/convolution.js +0 -96
- package/src/experimental/shader-modules/convolution.md +0 -15
- package/src/experimental/shader-modules/depth.js +0 -84
- package/src/experimental/shader-modules/depth.md +0 -76
- package/src/experimental/shader-modules/pack.js +0 -32
- package/src/experimental/shader-modules/pack.md +0 -15
- package/src/experimental/shader-modules/ssao.js +0 -183
- package/src/experimental/shader-modules/ssao.md +0 -4
- package/src/index.js +0 -35
- package/src/shader-modules/adjust-filters/brightnesscontrast.js +0 -38
- package/src/shader-modules/adjust-filters/denoise.js +0 -49
- package/src/shader-modules/adjust-filters/huesaturation.js +0 -57
- package/src/shader-modules/adjust-filters/noise.js +0 -36
- package/src/shader-modules/adjust-filters/sepia.js +0 -37
- package/src/shader-modules/adjust-filters/vibrance.js +0 -32
- package/src/shader-modules/adjust-filters/vignette.js +0 -33
- package/src/shader-modules/blur-filters/tiltshift.js +0 -105
- package/src/shader-modules/blur-filters/triangleblur.js +0 -55
- package/src/shader-modules/blur-filters/zoomblur.js +0 -56
- package/src/shader-modules/fun-filters/colorhalftone.js +0 -60
- package/src/shader-modules/fun-filters/dotscreen.js +0 -45
- package/src/shader-modules/fun-filters/edgework.js +0 -84
- package/src/shader-modules/fun-filters/hexagonalpixelate.js +0 -63
- package/src/shader-modules/fun-filters/ink.js +0 -49
- package/src/shader-modules/utils/random.js +0 -12
- package/src/shader-modules/warp-filters/bulgepinch.js +0 -52
- package/src/shader-modules/warp-filters/swirl.js +0 -55
- package/src/shader-modules/warp-filters/warp.js +0 -19
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderPass} from '@luma.gl/shadertools';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ORIGINAL LICENCE
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
11
|
+
*
|
|
12
|
+
* Redistribution and use in source and binary forms, with or without
|
|
13
|
+
* modification, are permitted provided that the following conditions
|
|
14
|
+
* are met:
|
|
15
|
+
* * Redistributions of source code must retain the above copyright
|
|
16
|
+
* notice, this list of conditions and the following disclaimer.
|
|
17
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
18
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
19
|
+
* documentation and/or other materials provided with the distribution.
|
|
20
|
+
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
21
|
+
* contributors may be used to endorse or promote products derived
|
|
22
|
+
* from this software without specific prior written permission.
|
|
23
|
+
*
|
|
24
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
|
25
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
27
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
28
|
+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
29
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
30
|
+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
31
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
32
|
+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
33
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
// LUMA.GL
|
|
38
|
+
// WebGL version from cesium.js, used under Apached 2.0 License
|
|
39
|
+
// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
40
|
+
// with the following modifications:
|
|
41
|
+
// - fxaa_sampleColor to integrate with luma.gl
|
|
42
|
+
// - Return color value with alpha to avoid another tap
|
|
43
|
+
// - Calculate luminance in FxaaLuma
|
|
44
|
+
|
|
45
|
+
// COMMENTS FROM CESIUM VERSION
|
|
46
|
+
// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples
|
|
47
|
+
// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h
|
|
48
|
+
//
|
|
49
|
+
// Steps used to integrate into Cesium:
|
|
50
|
+
// * The following defines are set:
|
|
51
|
+
// #define FXAA_PC 1
|
|
52
|
+
// #define FXAA_WEBGL_1 1
|
|
53
|
+
// #define FXAA_GREEN_AS_LUMA 1
|
|
54
|
+
// #define FXAA_EARLY_EXIT 1
|
|
55
|
+
// #define FXAA_GLSL_120 1
|
|
56
|
+
// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.
|
|
57
|
+
// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace
|
|
58
|
+
// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.
|
|
59
|
+
// * There are no implicit conversions from ivec* to vec* so replace:
|
|
60
|
+
// #define FxaaInt2 ivec2
|
|
61
|
+
// with
|
|
62
|
+
// #define FxaaInt2 vec2
|
|
63
|
+
// * The texture2DLod function is only available in vertex shaders so replace:
|
|
64
|
+
// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
|
|
65
|
+
// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
|
|
66
|
+
// with
|
|
67
|
+
// #define FxaaTexTop(t, p) texture2D(t, p)
|
|
68
|
+
// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
|
|
69
|
+
// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.
|
|
70
|
+
// * The following parameters to FxaaPixelShader_ are unused and can be removed:
|
|
71
|
+
// fxaaConsolePosPos
|
|
72
|
+
// fxaaConsoleRcpFrameOpt
|
|
73
|
+
// fxaaConsoleRcpFrameOpt2
|
|
74
|
+
// fxaaConsole360RcpFrameOpt2
|
|
75
|
+
// fxaaConsoleEdgeSharpness
|
|
76
|
+
// fxaaConsoleEdgeThreshold
|
|
77
|
+
// fxaaConsoleEdgeThresholdMi
|
|
78
|
+
// fxaaConsole360ConstDir
|
|
79
|
+
//
|
|
80
|
+
// Choose the quality preset.
|
|
81
|
+
// This needs to be compiled into the shader as it effects code.
|
|
82
|
+
// Best option to include multiple presets is to
|
|
83
|
+
// in each shader define the preset, then include this file.
|
|
84
|
+
//
|
|
85
|
+
// OPTIONS
|
|
86
|
+
// -----------------------------------------------------------------------
|
|
87
|
+
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
|
|
88
|
+
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
|
|
89
|
+
// 39 - no dither, very expensive
|
|
90
|
+
//
|
|
91
|
+
// NOTES
|
|
92
|
+
// -----------------------------------------------------------------------
|
|
93
|
+
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
|
|
94
|
+
// 13 = about same speed as FXAA 3.9 and better than 12
|
|
95
|
+
// 23 = closest to FXAA 3.9 visually and performance wise
|
|
96
|
+
// _ = the lowest digit is directly related to performance
|
|
97
|
+
// _ = the highest digit is directly related to style
|
|
98
|
+
//
|
|
99
|
+
|
|
100
|
+
const fs = /* glsl */ `
|
|
101
|
+
#define FXAA_QUALITY_PRESET 29
|
|
102
|
+
|
|
103
|
+
#if (FXAA_QUALITY_PRESET == 10)
|
|
104
|
+
#define FXAA_QUALITY_PS 3
|
|
105
|
+
#define FXAA_QUALITY_P0 1.5
|
|
106
|
+
#define FXAA_QUALITY_P1 3.0
|
|
107
|
+
#define FXAA_QUALITY_P2 12.0
|
|
108
|
+
#endif
|
|
109
|
+
#if (FXAA_QUALITY_PRESET == 11)
|
|
110
|
+
#define FXAA_QUALITY_PS 4
|
|
111
|
+
#define FXAA_QUALITY_P0 1.0
|
|
112
|
+
#define FXAA_QUALITY_P1 1.5
|
|
113
|
+
#define FXAA_QUALITY_P2 3.0
|
|
114
|
+
#define FXAA_QUALITY_P3 12.0
|
|
115
|
+
#endif
|
|
116
|
+
#if (FXAA_QUALITY_PRESET == 12)
|
|
117
|
+
#define FXAA_QUALITY_PS 5
|
|
118
|
+
#define FXAA_QUALITY_P0 1.0
|
|
119
|
+
#define FXAA_QUALITY_P1 1.5
|
|
120
|
+
#define FXAA_QUALITY_P2 2.0
|
|
121
|
+
#define FXAA_QUALITY_P3 4.0
|
|
122
|
+
#define FXAA_QUALITY_P4 12.0
|
|
123
|
+
#endif
|
|
124
|
+
#if (FXAA_QUALITY_PRESET == 13)
|
|
125
|
+
#define FXAA_QUALITY_PS 6
|
|
126
|
+
#define FXAA_QUALITY_P0 1.0
|
|
127
|
+
#define FXAA_QUALITY_P1 1.5
|
|
128
|
+
#define FXAA_QUALITY_P2 2.0
|
|
129
|
+
#define FXAA_QUALITY_P3 2.0
|
|
130
|
+
#define FXAA_QUALITY_P4 4.0
|
|
131
|
+
#define FXAA_QUALITY_P5 12.0
|
|
132
|
+
#endif
|
|
133
|
+
#if (FXAA_QUALITY_PRESET == 14)
|
|
134
|
+
#define FXAA_QUALITY_PS 7
|
|
135
|
+
#define FXAA_QUALITY_P0 1.0
|
|
136
|
+
#define FXAA_QUALITY_P1 1.5
|
|
137
|
+
#define FXAA_QUALITY_P2 2.0
|
|
138
|
+
#define FXAA_QUALITY_P3 2.0
|
|
139
|
+
#define FXAA_QUALITY_P4 2.0
|
|
140
|
+
#define FXAA_QUALITY_P5 4.0
|
|
141
|
+
#define FXAA_QUALITY_P6 12.0
|
|
142
|
+
#endif
|
|
143
|
+
#if (FXAA_QUALITY_PRESET == 15)
|
|
144
|
+
#define FXAA_QUALITY_PS 8
|
|
145
|
+
#define FXAA_QUALITY_P0 1.0
|
|
146
|
+
#define FXAA_QUALITY_P1 1.5
|
|
147
|
+
#define FXAA_QUALITY_P2 2.0
|
|
148
|
+
#define FXAA_QUALITY_P3 2.0
|
|
149
|
+
#define FXAA_QUALITY_P4 2.0
|
|
150
|
+
#define FXAA_QUALITY_P5 2.0
|
|
151
|
+
#define FXAA_QUALITY_P6 4.0
|
|
152
|
+
#define FXAA_QUALITY_P7 12.0
|
|
153
|
+
#endif
|
|
154
|
+
#if (FXAA_QUALITY_PRESET == 20)
|
|
155
|
+
#define FXAA_QUALITY_PS 3
|
|
156
|
+
#define FXAA_QUALITY_P0 1.5
|
|
157
|
+
#define FXAA_QUALITY_P1 2.0
|
|
158
|
+
#define FXAA_QUALITY_P2 8.0
|
|
159
|
+
#endif
|
|
160
|
+
#if (FXAA_QUALITY_PRESET == 21)
|
|
161
|
+
#define FXAA_QUALITY_PS 4
|
|
162
|
+
#define FXAA_QUALITY_P0 1.0
|
|
163
|
+
#define FXAA_QUALITY_P1 1.5
|
|
164
|
+
#define FXAA_QUALITY_P2 2.0
|
|
165
|
+
#define FXAA_QUALITY_P3 8.0
|
|
166
|
+
#endif
|
|
167
|
+
#if (FXAA_QUALITY_PRESET == 22)
|
|
168
|
+
#define FXAA_QUALITY_PS 5
|
|
169
|
+
#define FXAA_QUALITY_P0 1.0
|
|
170
|
+
#define FXAA_QUALITY_P1 1.5
|
|
171
|
+
#define FXAA_QUALITY_P2 2.0
|
|
172
|
+
#define FXAA_QUALITY_P3 2.0
|
|
173
|
+
#define FXAA_QUALITY_P4 8.0
|
|
174
|
+
#endif
|
|
175
|
+
#if (FXAA_QUALITY_PRESET == 23)
|
|
176
|
+
#define FXAA_QUALITY_PS 6
|
|
177
|
+
#define FXAA_QUALITY_P0 1.0
|
|
178
|
+
#define FXAA_QUALITY_P1 1.5
|
|
179
|
+
#define FXAA_QUALITY_P2 2.0
|
|
180
|
+
#define FXAA_QUALITY_P3 2.0
|
|
181
|
+
#define FXAA_QUALITY_P4 2.0
|
|
182
|
+
#define FXAA_QUALITY_P5 8.0
|
|
183
|
+
#endif
|
|
184
|
+
#if (FXAA_QUALITY_PRESET == 24)
|
|
185
|
+
#define FXAA_QUALITY_PS 7
|
|
186
|
+
#define FXAA_QUALITY_P0 1.0
|
|
187
|
+
#define FXAA_QUALITY_P1 1.5
|
|
188
|
+
#define FXAA_QUALITY_P2 2.0
|
|
189
|
+
#define FXAA_QUALITY_P3 2.0
|
|
190
|
+
#define FXAA_QUALITY_P4 2.0
|
|
191
|
+
#define FXAA_QUALITY_P5 3.0
|
|
192
|
+
#define FXAA_QUALITY_P6 8.0
|
|
193
|
+
#endif
|
|
194
|
+
#if (FXAA_QUALITY_PRESET == 25)
|
|
195
|
+
#define FXAA_QUALITY_PS 8
|
|
196
|
+
#define FXAA_QUALITY_P0 1.0
|
|
197
|
+
#define FXAA_QUALITY_P1 1.5
|
|
198
|
+
#define FXAA_QUALITY_P2 2.0
|
|
199
|
+
#define FXAA_QUALITY_P3 2.0
|
|
200
|
+
#define FXAA_QUALITY_P4 2.0
|
|
201
|
+
#define FXAA_QUALITY_P5 2.0
|
|
202
|
+
#define FXAA_QUALITY_P6 4.0
|
|
203
|
+
#define FXAA_QUALITY_P7 8.0
|
|
204
|
+
#endif
|
|
205
|
+
#if (FXAA_QUALITY_PRESET == 26)
|
|
206
|
+
#define FXAA_QUALITY_PS 9
|
|
207
|
+
#define FXAA_QUALITY_P0 1.0
|
|
208
|
+
#define FXAA_QUALITY_P1 1.5
|
|
209
|
+
#define FXAA_QUALITY_P2 2.0
|
|
210
|
+
#define FXAA_QUALITY_P3 2.0
|
|
211
|
+
#define FXAA_QUALITY_P4 2.0
|
|
212
|
+
#define FXAA_QUALITY_P5 2.0
|
|
213
|
+
#define FXAA_QUALITY_P6 2.0
|
|
214
|
+
#define FXAA_QUALITY_P7 4.0
|
|
215
|
+
#define FXAA_QUALITY_P8 8.0
|
|
216
|
+
#endif
|
|
217
|
+
#if (FXAA_QUALITY_PRESET == 27)
|
|
218
|
+
#define FXAA_QUALITY_PS 10
|
|
219
|
+
#define FXAA_QUALITY_P0 1.0
|
|
220
|
+
#define FXAA_QUALITY_P1 1.5
|
|
221
|
+
#define FXAA_QUALITY_P2 2.0
|
|
222
|
+
#define FXAA_QUALITY_P3 2.0
|
|
223
|
+
#define FXAA_QUALITY_P4 2.0
|
|
224
|
+
#define FXAA_QUALITY_P5 2.0
|
|
225
|
+
#define FXAA_QUALITY_P6 2.0
|
|
226
|
+
#define FXAA_QUALITY_P7 2.0
|
|
227
|
+
#define FXAA_QUALITY_P8 4.0
|
|
228
|
+
#define FXAA_QUALITY_P9 8.0
|
|
229
|
+
#endif
|
|
230
|
+
#if (FXAA_QUALITY_PRESET == 28)
|
|
231
|
+
#define FXAA_QUALITY_PS 11
|
|
232
|
+
#define FXAA_QUALITY_P0 1.0
|
|
233
|
+
#define FXAA_QUALITY_P1 1.5
|
|
234
|
+
#define FXAA_QUALITY_P2 2.0
|
|
235
|
+
#define FXAA_QUALITY_P3 2.0
|
|
236
|
+
#define FXAA_QUALITY_P4 2.0
|
|
237
|
+
#define FXAA_QUALITY_P5 2.0
|
|
238
|
+
#define FXAA_QUALITY_P6 2.0
|
|
239
|
+
#define FXAA_QUALITY_P7 2.0
|
|
240
|
+
#define FXAA_QUALITY_P8 2.0
|
|
241
|
+
#define FXAA_QUALITY_P9 4.0
|
|
242
|
+
#define FXAA_QUALITY_P10 8.0
|
|
243
|
+
#endif
|
|
244
|
+
#if (FXAA_QUALITY_PRESET == 29)
|
|
245
|
+
#define FXAA_QUALITY_PS 12
|
|
246
|
+
#define FXAA_QUALITY_P0 1.0
|
|
247
|
+
#define FXAA_QUALITY_P1 1.5
|
|
248
|
+
#define FXAA_QUALITY_P2 2.0
|
|
249
|
+
#define FXAA_QUALITY_P3 2.0
|
|
250
|
+
#define FXAA_QUALITY_P4 2.0
|
|
251
|
+
#define FXAA_QUALITY_P5 2.0
|
|
252
|
+
#define FXAA_QUALITY_P6 2.0
|
|
253
|
+
#define FXAA_QUALITY_P7 2.0
|
|
254
|
+
#define FXAA_QUALITY_P8 2.0
|
|
255
|
+
#define FXAA_QUALITY_P9 2.0
|
|
256
|
+
#define FXAA_QUALITY_P10 4.0
|
|
257
|
+
#define FXAA_QUALITY_P11 8.0
|
|
258
|
+
#endif
|
|
259
|
+
#if (FXAA_QUALITY_PRESET == 39)
|
|
260
|
+
#define FXAA_QUALITY_PS 12
|
|
261
|
+
#define FXAA_QUALITY_P0 1.0
|
|
262
|
+
#define FXAA_QUALITY_P1 1.0
|
|
263
|
+
#define FXAA_QUALITY_P2 1.0
|
|
264
|
+
#define FXAA_QUALITY_P3 1.0
|
|
265
|
+
#define FXAA_QUALITY_P4 1.0
|
|
266
|
+
#define FXAA_QUALITY_P5 1.5
|
|
267
|
+
#define FXAA_QUALITY_P6 2.0
|
|
268
|
+
#define FXAA_QUALITY_P7 2.0
|
|
269
|
+
#define FXAA_QUALITY_P8 2.0
|
|
270
|
+
#define FXAA_QUALITY_P9 2.0
|
|
271
|
+
#define FXAA_QUALITY_P10 4.0
|
|
272
|
+
#define FXAA_QUALITY_P11 8.0
|
|
273
|
+
#endif
|
|
274
|
+
|
|
275
|
+
#define FxaaBool bool
|
|
276
|
+
#define FxaaFloat float
|
|
277
|
+
#define FxaaFloat2 vec2
|
|
278
|
+
#define FxaaFloat3 vec3
|
|
279
|
+
#define FxaaFloat4 vec4
|
|
280
|
+
#define FxaaHalf float
|
|
281
|
+
#define FxaaHalf2 vec2
|
|
282
|
+
#define FxaaHalf3 vec3
|
|
283
|
+
#define FxaaHalf4 vec4
|
|
284
|
+
#define FxaaInt2 vec2
|
|
285
|
+
#define FxaaTex sampler2D
|
|
286
|
+
|
|
287
|
+
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
|
288
|
+
#define FxaaTexTop(t, p) texture(t, p)
|
|
289
|
+
#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
|
|
290
|
+
|
|
291
|
+
FxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }
|
|
292
|
+
|
|
293
|
+
FxaaFloat4 FxaaPixelShader_(
|
|
294
|
+
//
|
|
295
|
+
// Use noperspective interpolation here (turn off perspective interpolation).
|
|
296
|
+
// {xy} = center of pixel
|
|
297
|
+
FxaaFloat2 pos,
|
|
298
|
+
//
|
|
299
|
+
// Input color texture.
|
|
300
|
+
// {rgb_} = color in linear or perceptual color space
|
|
301
|
+
// if (FXAA_GREEN_AS_LUMA == 0)
|
|
302
|
+
// {___a} = luma in perceptual color space (not linear)
|
|
303
|
+
FxaaTex tex,
|
|
304
|
+
//
|
|
305
|
+
// Only used on FXAA Quality.
|
|
306
|
+
// This must be from a constant/uniform.
|
|
307
|
+
// {x_} = 1.0/screenWidthInPixels
|
|
308
|
+
// {_y} = 1.0/screenHeightInPixels
|
|
309
|
+
FxaaFloat2 fxaaQualityRcpFrame,
|
|
310
|
+
//
|
|
311
|
+
// Only used on FXAA Quality.
|
|
312
|
+
// This used to be the FXAA_QUALITY_SUBPIX define.
|
|
313
|
+
// It is here now to allow easier tuning.
|
|
314
|
+
// Choose the amount of sub-pixel aliasing removal.
|
|
315
|
+
// This can effect sharpness.
|
|
316
|
+
// 1.00 - upper limit (softer)
|
|
317
|
+
// 0.75 - default amount of filtering
|
|
318
|
+
// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
|
|
319
|
+
// 0.25 - almost off
|
|
320
|
+
// 0.00 - completely off
|
|
321
|
+
FxaaFloat fxaaQualitySubpix,
|
|
322
|
+
//
|
|
323
|
+
// Only used on FXAA Quality.
|
|
324
|
+
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
|
|
325
|
+
// It is here now to allow easier tuning.
|
|
326
|
+
// The minimum amount of local contrast required to apply algorithm.
|
|
327
|
+
// 0.333 - too little (faster)
|
|
328
|
+
// 0.250 - low quality
|
|
329
|
+
// 0.166 - default
|
|
330
|
+
// 0.125 - high quality
|
|
331
|
+
// 0.063 - overkill (slower)
|
|
332
|
+
FxaaFloat fxaaQualityEdgeThreshold,
|
|
333
|
+
//
|
|
334
|
+
// Only used on FXAA Quality.
|
|
335
|
+
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
|
|
336
|
+
// It is here now to allow easier tuning.
|
|
337
|
+
// Trims the algorithm from processing darks.
|
|
338
|
+
// 0.0833 - upper limit (default, the start of visible unfiltered edges)
|
|
339
|
+
// 0.0625 - high quality (faster)
|
|
340
|
+
// 0.0312 - visible limit (slower)
|
|
341
|
+
// Special notes when using FXAA_GREEN_AS_LUMA,
|
|
342
|
+
// Likely want to set this to zero.
|
|
343
|
+
// As colors that are mostly not-green
|
|
344
|
+
// will appear very dark in the green channel!
|
|
345
|
+
// Tune by looking at mostly non-green content,
|
|
346
|
+
// then start at zero and increase until aliasing is a problem.
|
|
347
|
+
FxaaFloat fxaaQualityEdgeThresholdMin
|
|
348
|
+
) {
|
|
349
|
+
/*--------------------------------------------------------------------------*/
|
|
350
|
+
FxaaFloat2 posM;
|
|
351
|
+
posM.x = pos.x;
|
|
352
|
+
posM.y = pos.y;
|
|
353
|
+
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
|
|
354
|
+
#define lumaM rgbyM.y
|
|
355
|
+
FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
|
|
356
|
+
FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
|
|
357
|
+
FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
|
|
358
|
+
FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
|
|
359
|
+
/*--------------------------------------------------------------------------*/
|
|
360
|
+
FxaaFloat maxSM = max(lumaS, lumaM);
|
|
361
|
+
FxaaFloat minSM = min(lumaS, lumaM);
|
|
362
|
+
FxaaFloat maxESM = max(lumaE, maxSM);
|
|
363
|
+
FxaaFloat minESM = min(lumaE, minSM);
|
|
364
|
+
FxaaFloat maxWN = max(lumaN, lumaW);
|
|
365
|
+
FxaaFloat minWN = min(lumaN, lumaW);
|
|
366
|
+
FxaaFloat rangeMax = max(maxWN, maxESM);
|
|
367
|
+
FxaaFloat rangeMin = min(minWN, minESM);
|
|
368
|
+
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
|
|
369
|
+
FxaaFloat range = rangeMax - rangeMin;
|
|
370
|
+
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
|
|
371
|
+
FxaaBool earlyExit = range < rangeMaxClamped;
|
|
372
|
+
/*--------------------------------------------------------------------------*/
|
|
373
|
+
if(earlyExit)
|
|
374
|
+
return rgbyM;
|
|
375
|
+
/*--------------------------------------------------------------------------*/
|
|
376
|
+
FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
|
|
377
|
+
FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
|
|
378
|
+
FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
|
|
379
|
+
FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
|
|
380
|
+
/*--------------------------------------------------------------------------*/
|
|
381
|
+
FxaaFloat lumaNS = lumaN + lumaS;
|
|
382
|
+
FxaaFloat lumaWE = lumaW + lumaE;
|
|
383
|
+
FxaaFloat subpixRcpRange = 1.0/range;
|
|
384
|
+
FxaaFloat subpixNSWE = lumaNS + lumaWE;
|
|
385
|
+
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
|
|
386
|
+
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
|
|
387
|
+
/*--------------------------------------------------------------------------*/
|
|
388
|
+
FxaaFloat lumaNESE = lumaNE + lumaSE;
|
|
389
|
+
FxaaFloat lumaNWNE = lumaNW + lumaNE;
|
|
390
|
+
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
|
|
391
|
+
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
|
|
392
|
+
/*--------------------------------------------------------------------------*/
|
|
393
|
+
FxaaFloat lumaNWSW = lumaNW + lumaSW;
|
|
394
|
+
FxaaFloat lumaSWSE = lumaSW + lumaSE;
|
|
395
|
+
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
|
|
396
|
+
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
|
|
397
|
+
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
|
|
398
|
+
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
|
|
399
|
+
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
|
|
400
|
+
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
|
|
401
|
+
/*--------------------------------------------------------------------------*/
|
|
402
|
+
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
|
|
403
|
+
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
|
|
404
|
+
FxaaBool horzSpan = edgeHorz >= edgeVert;
|
|
405
|
+
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
|
|
406
|
+
/*--------------------------------------------------------------------------*/
|
|
407
|
+
if(!horzSpan) lumaN = lumaW;
|
|
408
|
+
if(!horzSpan) lumaS = lumaE;
|
|
409
|
+
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
|
|
410
|
+
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
|
|
411
|
+
/*--------------------------------------------------------------------------*/
|
|
412
|
+
FxaaFloat gradientN = lumaN - lumaM;
|
|
413
|
+
FxaaFloat gradientS = lumaS - lumaM;
|
|
414
|
+
FxaaFloat lumaNN = lumaN + lumaM;
|
|
415
|
+
FxaaFloat lumaSS = lumaS + lumaM;
|
|
416
|
+
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
|
|
417
|
+
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
|
|
418
|
+
if(pairN) lengthSign = -lengthSign;
|
|
419
|
+
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
|
|
420
|
+
/*--------------------------------------------------------------------------*/
|
|
421
|
+
FxaaFloat2 posB;
|
|
422
|
+
posB.x = posM.x;
|
|
423
|
+
posB.y = posM.y;
|
|
424
|
+
FxaaFloat2 offNP;
|
|
425
|
+
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
|
|
426
|
+
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
|
|
427
|
+
if(!horzSpan) posB.x += lengthSign * 0.5;
|
|
428
|
+
if( horzSpan) posB.y += lengthSign * 0.5;
|
|
429
|
+
/*--------------------------------------------------------------------------*/
|
|
430
|
+
FxaaFloat2 posN;
|
|
431
|
+
posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
|
|
432
|
+
posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
|
|
433
|
+
FxaaFloat2 posP;
|
|
434
|
+
posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
|
|
435
|
+
posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
|
|
436
|
+
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
|
|
437
|
+
FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));
|
|
438
|
+
FxaaFloat subpixE = subpixC * subpixC;
|
|
439
|
+
FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));
|
|
440
|
+
/*--------------------------------------------------------------------------*/
|
|
441
|
+
if(!pairN) lumaNN = lumaSS;
|
|
442
|
+
FxaaFloat gradientScaled = gradient * 1.0/4.0;
|
|
443
|
+
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
|
|
444
|
+
FxaaFloat subpixF = subpixD * subpixE;
|
|
445
|
+
FxaaBool lumaMLTZero = lumaMM < 0.0;
|
|
446
|
+
/*--------------------------------------------------------------------------*/
|
|
447
|
+
lumaEndN -= lumaNN * 0.5;
|
|
448
|
+
lumaEndP -= lumaNN * 0.5;
|
|
449
|
+
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
|
|
450
|
+
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
|
|
451
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
|
|
452
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
|
|
453
|
+
FxaaBool doneNP = (!doneN) || (!doneP);
|
|
454
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
|
|
455
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
|
|
456
|
+
/*--------------------------------------------------------------------------*/
|
|
457
|
+
if(doneNP) {
|
|
458
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
459
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
460
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
461
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
462
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
463
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
464
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
|
|
465
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
|
|
466
|
+
doneNP = (!doneN) || (!doneP);
|
|
467
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
|
|
468
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
|
|
469
|
+
/*--------------------------------------------------------------------------*/
|
|
470
|
+
#if (FXAA_QUALITY_PS > 3)
|
|
471
|
+
if(doneNP) {
|
|
472
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
473
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
474
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
475
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
476
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
477
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
478
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
|
|
479
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
|
|
480
|
+
doneNP = (!doneN) || (!doneP);
|
|
481
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
|
|
482
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
|
|
483
|
+
/*--------------------------------------------------------------------------*/
|
|
484
|
+
#if (FXAA_QUALITY_PS > 4)
|
|
485
|
+
if(doneNP) {
|
|
486
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
487
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
488
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
489
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
490
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
491
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
492
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
|
|
493
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
|
|
494
|
+
doneNP = (!doneN) || (!doneP);
|
|
495
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
|
|
496
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
|
|
497
|
+
/*--------------------------------------------------------------------------*/
|
|
498
|
+
#if (FXAA_QUALITY_PS > 5)
|
|
499
|
+
if(doneNP) {
|
|
500
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
501
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
502
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
503
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
504
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
505
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
506
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
|
|
507
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
|
|
508
|
+
doneNP = (!doneN) || (!doneP);
|
|
509
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
|
|
510
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
|
|
511
|
+
/*--------------------------------------------------------------------------*/
|
|
512
|
+
#if (FXAA_QUALITY_PS > 6)
|
|
513
|
+
if(doneNP) {
|
|
514
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
515
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
516
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
517
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
518
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
519
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
520
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
|
|
521
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
|
|
522
|
+
doneNP = (!doneN) || (!doneP);
|
|
523
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
|
|
524
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
|
|
525
|
+
/*--------------------------------------------------------------------------*/
|
|
526
|
+
#if (FXAA_QUALITY_PS > 7)
|
|
527
|
+
if(doneNP) {
|
|
528
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
529
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
530
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
531
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
532
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
533
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
534
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
|
|
535
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
|
|
536
|
+
doneNP = (!doneN) || (!doneP);
|
|
537
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
|
|
538
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
|
|
539
|
+
/*--------------------------------------------------------------------------*/
|
|
540
|
+
#if (FXAA_QUALITY_PS > 8)
|
|
541
|
+
if(doneNP) {
|
|
542
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
543
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
544
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
545
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
546
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
547
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
548
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
|
|
549
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
|
|
550
|
+
doneNP = (!doneN) || (!doneP);
|
|
551
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
|
|
552
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
|
|
553
|
+
/*--------------------------------------------------------------------------*/
|
|
554
|
+
#if (FXAA_QUALITY_PS > 9)
|
|
555
|
+
if(doneNP) {
|
|
556
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
557
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
558
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
559
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
560
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
561
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
562
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
|
|
563
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
|
|
564
|
+
doneNP = (!doneN) || (!doneP);
|
|
565
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
|
|
566
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
|
|
567
|
+
/*--------------------------------------------------------------------------*/
|
|
568
|
+
#if (FXAA_QUALITY_PS > 10)
|
|
569
|
+
if(doneNP) {
|
|
570
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
571
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
572
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
573
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
574
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
575
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
576
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
|
|
577
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
|
|
578
|
+
doneNP = (!doneN) || (!doneP);
|
|
579
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
|
|
580
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
|
|
581
|
+
/*--------------------------------------------------------------------------*/
|
|
582
|
+
#if (FXAA_QUALITY_PS > 11)
|
|
583
|
+
if(doneNP) {
|
|
584
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
585
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
586
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
587
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
588
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
589
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
590
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
|
|
591
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
|
|
592
|
+
doneNP = (!doneN) || (!doneP);
|
|
593
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
|
|
594
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
|
|
595
|
+
/*--------------------------------------------------------------------------*/
|
|
596
|
+
#if (FXAA_QUALITY_PS > 12)
|
|
597
|
+
if(doneNP) {
|
|
598
|
+
if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
|
|
599
|
+
if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
|
|
600
|
+
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
601
|
+
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
602
|
+
doneN = abs(lumaEndN) >= gradientScaled;
|
|
603
|
+
doneP = abs(lumaEndP) >= gradientScaled;
|
|
604
|
+
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
|
|
605
|
+
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
|
|
606
|
+
doneNP = (!doneN) || (!doneP);
|
|
607
|
+
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
|
|
608
|
+
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
|
|
609
|
+
/*--------------------------------------------------------------------------*/
|
|
610
|
+
}
|
|
611
|
+
#endif
|
|
612
|
+
/*--------------------------------------------------------------------------*/
|
|
613
|
+
}
|
|
614
|
+
#endif
|
|
615
|
+
/*--------------------------------------------------------------------------*/
|
|
616
|
+
}
|
|
617
|
+
#endif
|
|
618
|
+
/*--------------------------------------------------------------------------*/
|
|
619
|
+
}
|
|
620
|
+
#endif
|
|
621
|
+
/*--------------------------------------------------------------------------*/
|
|
622
|
+
}
|
|
623
|
+
#endif
|
|
624
|
+
/*--------------------------------------------------------------------------*/
|
|
625
|
+
}
|
|
626
|
+
#endif
|
|
627
|
+
/*--------------------------------------------------------------------------*/
|
|
628
|
+
}
|
|
629
|
+
#endif
|
|
630
|
+
/*--------------------------------------------------------------------------*/
|
|
631
|
+
}
|
|
632
|
+
#endif
|
|
633
|
+
/*--------------------------------------------------------------------------*/
|
|
634
|
+
}
|
|
635
|
+
#endif
|
|
636
|
+
/*--------------------------------------------------------------------------*/
|
|
637
|
+
}
|
|
638
|
+
#endif
|
|
639
|
+
/*--------------------------------------------------------------------------*/
|
|
640
|
+
}
|
|
641
|
+
/*--------------------------------------------------------------------------*/
|
|
642
|
+
FxaaFloat dstN = posM.x - posN.x;
|
|
643
|
+
FxaaFloat dstP = posP.x - posM.x;
|
|
644
|
+
if(!horzSpan) dstN = posM.y - posN.y;
|
|
645
|
+
if(!horzSpan) dstP = posP.y - posM.y;
|
|
646
|
+
/*--------------------------------------------------------------------------*/
|
|
647
|
+
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
|
|
648
|
+
FxaaFloat spanLength = (dstP + dstN);
|
|
649
|
+
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
|
|
650
|
+
FxaaFloat spanLengthRcp = 1.0/spanLength;
|
|
651
|
+
/*--------------------------------------------------------------------------*/
|
|
652
|
+
FxaaBool directionN = dstN < dstP;
|
|
653
|
+
FxaaFloat dst = min(dstN, dstP);
|
|
654
|
+
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
|
|
655
|
+
FxaaFloat subpixG = subpixF * subpixF;
|
|
656
|
+
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
|
|
657
|
+
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
|
|
658
|
+
/*--------------------------------------------------------------------------*/
|
|
659
|
+
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
|
|
660
|
+
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
|
|
661
|
+
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
|
|
662
|
+
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
|
|
663
|
+
return FxaaTexTop(tex, posM);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
vec4 fxaa_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
667
|
+
const float fxaa_QualitySubpix = 0.5;
|
|
668
|
+
const float fxaa_QualityEdgeThreshold = 0.125;
|
|
669
|
+
const float fxaa_QualityEdgeThresholdMin = 0.0833;
|
|
670
|
+
|
|
671
|
+
return FxaaPixelShader_(
|
|
672
|
+
texCoord,
|
|
673
|
+
source,
|
|
674
|
+
vec2(1.0) / texSize,
|
|
675
|
+
fxaa_QualitySubpix,
|
|
676
|
+
fxaa_QualityEdgeThreshold,
|
|
677
|
+
fxaa_QualityEdgeThresholdMin
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
`;
|
|
681
|
+
|
|
682
|
+
export type FXAAProps = {};
|
|
683
|
+
export type FXAAUniforms = {};
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* FXAA - Fast Approximate Anti-aliasing.
|
|
687
|
+
*/
|
|
688
|
+
export const fxaa = {
|
|
689
|
+
name: 'fxaa',
|
|
690
|
+
propTypes: {},
|
|
691
|
+
fs,
|
|
692
|
+
passes: [{sampler: true}],
|
|
693
|
+
getUniforms: props => props
|
|
694
|
+
} as const satisfies ShaderPass<FXAAProps, FXAAUniforms, {}>;
|