slang-shaders/blurs
hunterk 70256e15f6
add more blurs, ss-gamma-ramp, updated nds color (#176)
* add updated NDS color, Super Sleuth gamma ramp and more trogglemonkey blurs
2021-05-27 21:41:42 -05:00
..
gaussian_blur_filtering add hyllian's gaussian blur shaders and presets 2020-12-10 09:59:22 -06:00
kawase add threshold parameter to kawase blur for use in blooms 2019-01-11 14:26:38 -06:00
sunset_gaussian add gristleVHS shaders and preset 2018-10-25 22:12:13 -05:00
bilateral.slang add Sp00kyFox's bilateral 2017-07-10 10:13:36 -05:00
blur-gauss-h.slang add scalefx and dreamscape shaders 2017-01-30 08:51:12 -06:00
blur-gauss-v.slang add scalefx and dreamscape shaders 2017-01-30 08:51:12 -06:00
blur3fast-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3fast-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3fast-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3fast-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3fast-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3fast-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3resize-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3resize-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3resize-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3resize-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3resize-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3resize-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3resize-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3resize-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3resize-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur3x3resize.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5fast-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5fast-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5fast-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5fast-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5fast-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5fast-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5resize-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5resize-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5resize-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5resize-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5resize-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5resize-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5x5-gamma-encode-every-fbo.slang add a bunch of trogglemonkey blurs 2016-10-07 10:56:36 -05:00
blur5x5-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5x5-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur5x5.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7fast-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7fast-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7fast-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7fast-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7fast-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7fast-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7resize-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7resize-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7resize-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7resize-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7resize-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7resize-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7x7-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7x7-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7x7-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur7x7.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9fast-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9fast-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9fast-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9fast-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9fast-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9fast-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9resize-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9resize-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9resize-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9resize-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9resize-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9resize-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9x9-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9x9-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9x9-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur9x9.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur10x10shared-gamma-encode-every-fbo.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur10x10shared-last-pass-gamma-encode-every-fbo.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur10x10shared-last-pass.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur10x10shared.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur11fast-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11fast-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11fast-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11fast-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11fast-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11fast-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11resize-horizontal-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11resize-horizontal-last-pass-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11resize-horizontal-last-pass.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11resize-horizontal.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11resize-vertical-gamma-encode-every-fbo.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur11resize-vertical.slang massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
blur12x12shared-gamma-encode-every-fbo.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur12x12shared-last-pass-gamma-encode-every-fbo.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur12x12shared-last-pass.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur12x12shared.slang add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
blur43fast-horizontal-gamma-encode-every-fbo.slang add blur43fast shaders 2020-01-15 16:00:30 -06:00
blur43fast-horizontal-last-pass-gamma-encode-every-fbo.slang add blur43fast shaders 2020-01-15 16:00:30 -06:00
blur43fast-horizontal-last-pass.slang add blur43fast shaders 2020-01-15 16:00:30 -06:00
blur43fast-horizontal.slang add blur43fast shaders 2020-01-15 16:00:30 -06:00
blur43fast-vertical-gamma-encode-every-fbo.slang add blur43fast shaders 2020-01-15 16:00:30 -06:00
blur43fast-vertical.slang add blur43fast shaders 2020-01-15 16:00:30 -06:00
gaussian_blur-sharp.slangp add hyllian's gaussian blur shaders and presets 2020-12-10 09:59:22 -06:00
gaussian_blur.slangp add hyllian's gaussian blur shaders and presets 2020-12-10 09:59:22 -06:00
gaussian_blur_2_pass-sharp.slangp add hyllian's gaussian blur shaders and presets 2020-12-10 09:59:22 -06:00
gaussian_blur_2_pass.slangp add hyllian's gaussian blur shaders and presets 2020-12-10 09:59:22 -06:00
kawase_blur_5pass.slangp add wrap mode to kawase presets to fix dark border from sampling outside of image 2018-08-18 13:52:21 -05:00
kawase_blur_9pass.slangp add wrap mode to kawase presets to fix dark border from sampling outside of image 2018-08-18 13:52:21 -05:00
kawase_glow.slangp add wrap mode to kawase presets to fix dark border from sampling outside of image 2018-08-18 13:52:21 -05:00
README.md add more blurs, ss-gamma-ramp, updated nds color (#176) 2021-05-27 21:41:42 -05:00
sharpsmoother.slang add sharpsmoother, aa-shader-4.0-level2 shaders and presets 2017-06-14 10:26:50 -05:00
smart-blur.slang add crt-hyllian and crt-guest updates (#166) 2021-01-16 09:31:32 -06:00
vertex-shader-blur-fast-horizontal.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
vertex-shader-blur-fast-vertical.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
vertex-shader-blur-one-pass-resize.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
vertex-shader-blur-one-pass-shared-sample.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
vertex-shader-blur-one-pass.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
vertex-shader-blur-resize-horizontal.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00
vertex-shader-blur-resize-vertical.h massive overhaul of crt-royale and all associated shaders 2017-11-29 13:40:28 -06:00

This info pertains to the Blurs by TroggleMonkey:

DESCRIPTION: Gaussian blurs are common building blocks in multi-pass shaders, and this library of optimized and tested blurs should make it easier to use whatever size blur you need. All of these shaders are based on the tex2Dblur* functions in include/blur-functions.h, so you can use those directly if you ever need to add more processing to the same pass as a Gaussian blur.

PICK THE RIGHT BLUR FOR YOUR USE CASE: There are several different types of blurs, ranging in size from 3-12 texels: a.) "Resize" separable blurs use vertical and horizontal passes and require N taps for an Nx blur. These are arbitrarily resizable. b.) "Fast" separable blurs use vertical and horizontal passes and require N taps for an (N*2 - 1)x blur. They exploit bilinear filtering to reduce the required taps from e.g. 9 to 5. These are always faster, but they have strict image scale requirements. c.) "Resize" one-pass blurs combine the vertical/horizontal passes of the "resize" separable blurs, and they require NxN taps for an NxN blur. These perform slowly enough that only tex2Dblur3x3resize is useful/included. d.) Other one-pass blurs combine the vertical/horizontal passes of the "fast" separable blurs, and they exploit bilinear filtering the same way. They're faster than separable blurs at 3x3, competitive at 5x5 depending on options, and slower at 7x7 and above...but larger blurs may still be useful if you're hurting for passes. e.) "Shared" one-pass blurs go a step further: They also use quad-pixel communication with fine-grained derivatives to distribute texture samples across a 2x2 pixel quad. (ddx() and ddy() are required, as well as a GPU that uses fine-grained derivatives). These blurs are faster than the other one-pass blurs, but they have some artifacts from combining sample-sharing with bilinear sampling, so they're best reserved for reblurring an already- blurred input.

Every blur expects linear filtering. Except for resize separable blurs, all require a pass scale of (1/(2^M)) for some M >= 0. That is, the output image has to have a 1:1 pixel:texel ratio with some mipmap of the input image, so use e.g. scaleN = "1.0" or scaleN = "0.25", not scaleN = "0.33" or scaleN = "2.0". Note: mipmap_inputN must = "true" in your .slangp file for scales other than 1.0.

There are two suffixes on the .slang files relating to gamma correction:

  • Blurs with no suffix assume linear RGB input and output.
  • Blurs with a "-last-pass" suffix use pow() to gamma-correct their output.
  • Blurs with a "-gamma-encode-every-fbo" suffix use pow() to linearize each input sample and again to gamma-correct the output. These blurs are MUCH slower than blurs without this suffix, but they're provided in case you want to be [almost] gamma-correct on platforms without sRGB FBO's. (The "almost" is because bilinear filtering still won't be gamma-correct without sRGB.)
  • There are also blurs with both suffixes. This may seem redundant, but they make it easier to use a different output gamma for the last pass than for the rest of the pipeline (such as when simulating another display device like a Game Boy Advance or CRT). See srgb-helpers/README.txt for more information.

BENCHMARK RESULTS: Blurs have different performance characteristics depending on whether the input is mipmapped and depending on whether they're gamma-encoding every FBO. Here's an excerpt from the blur-functions.h description with a comparison. Note that benchmarks without an sRGB heading use "-gamma-encode-every-fbo" suffixes, and you can just look at the sRGB performance figures if you don't care about gamma: // Here are some framerates from a GeForce 8800GTS. The first pass resizes to // viewport size (4x in this test) and linearizes for sRGB codepaths, and the // remaining passes perform 6 full blurs. Mipmapped tests are performed at the // same scale, so they just measure the cost of mipmapping each FBO (only every // other FBO is mipmapped for separable blurs, to mimic realistic usage). // Mipmap Neither sRGB+Mipmap sRGB Function // 76.0 92.3 131.3 193.7 tex2Dblur3fast // 63.2 74.4 122.4 175.5 tex2Dblur3resize // 93.7 121.2 159.3 263.2 tex2Dblur3x3 // 59.7 68.7 115.4 162.1 tex2Dblur3x3resize // 63.2 74.4 122.4 175.5 tex2Dblur5fast // 49.3 54.8 100.0 132.7 tex2Dblur5resize // 59.7 68.7 115.4 162.1 tex2Dblur5x5 // 64.9 77.2 99.1 137.2 tex2Dblur6x6shared // 55.8 63.7 110.4 151.8 tex2Dblur7fast // 39.8 43.9 83.9 105.8 tex2Dblur7resize // 40.0 44.2 83.2 104.9 tex2Dblur7x7 // 56.4 65.5 71.9 87.9 tex2Dblur8x8shared // 49.3 55.1 99.9 132.5 tex2Dblur9fast // 33.3 36.2 72.4 88.0 tex2Dblur9resize // 27.8 29.7 61.3 72.2 tex2Dblur9x9 // 37.2 41.1 52.6 60.2 tex2Dblur10x10shared // 44.4 49.5 91.3 117.8 tex2Dblur11fast // 28.8 30.8 63.6 75.4 tex2Dblur11resize // 33.6 36.5 40.9 45.5 tex2Dblur12x12shared

BASIC USAGE: The .slangp presets in the quality-test-presets folder provide usage examples for basically every .slang blur shader. The "-srgb" suffix on some .slangp presets is an explicit notice that they use sRGB FBO's. Note how and when the "-last-pass" suffix is used for each .slang file, etc.

The provided .slangp files with the "-mipmap" suffix are used to test quality and benchmarking with mipmapping enabled, but none of them actually use mipmapping as a feature in and of itself. The following contrived .slangp would do that: shaders = "4"

# Pass0: Linearize RGB:
shader0 = ../../srgb-helpers/first-pass-linearize.slang
filter_linear0 = "true"
scale_type0 = "source"
scale0 = "1.0"
srgb_framebuffer0 = "true"

# Pass1: Upsize to 4x.  Pretend this pass does significant processing at 4x.
shader1 = ../../stock.slang
filter_linear1 = "true"
scale_type1 = "source"
scale1 = "4.0"
srgb_framebuffer1 = "true"

# Pass2: Blur a source-sized mipmap 9x vertically; just shrink horizontally.
shader2 = ../blur9fast-vertical.slang
filter_linear2 = "true"
scale_type2 = "source"
scale2 = "0.25"
srgb_framebuffer2 = "true"
mipmap_input = "true"

# Pass3: Blur 9x horizontally
shader3 = ../blur9fast-horizontal.slang
filter_linear3 = "true"
scale_type3 = "source"
scale3 = "1.0"
srgb_framebuffer3 = "true"

# Pass4: Scale to the screen size and gamma-correct the output:
shader4 = ../../srgb-helpers/last-pass-gamma-correct.slang
filter_linear4 = "true"
scale_type4 = "viewport"
scale4 = "1.0"