I implemented the GLSL from http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/, but is unclear to me how to reduce or increase the amount of blur. Has it something to do with the iterations? I don't understand how.
There are a few ways to control the amount of blur:
Change your kernel size.
This is the width of the window you sample from your source texture. The guide you're using samples a 9-pixel window (4 pixels to either side of the center), using 5 texture samples.
By adding more texture samples you can make that window wider, for more blur. Or by sampling a smaller neighborhood around your center you can get less blur.
To maintain the Gaussian property when using a different kernel size, you'll need to adjust the weight you apply to each pixel (called the kernel weights), which your guide already shows you how to calculate.
Iterate your blur.
If you want to blur a lot more, then just making your kernel wider and wider might start to get prohibitively expensive because you have to do so much texture fetching for every fragment.
Instead you can just blur once with your current kernel size, then blur again with the same (or different) kernel size. That is:
- Original Image --[horizontal blur]--> intermediate
- intermediate --[vertical blur]--> 1x blurred
- 1x blurred --[horizontal blur]--> intermediate
- intermediate --[vertical blur]--> 2x blurred
This gives you the effect of a single Gaussian blur whose radius is the square root of the sum of the squares of the radii of the blurs used as stepping stones.
So repeating your 9-pixel blur (horizontal & vertical) twice would do the same as scaling up your kernel 1.4x (to about 13 pixels) — so it's not as efficient as just widening your kernel as long as you can do so. It's just a way to keep blurring more even if you hit an absolute cap on texture samples (eg. on older/weaker hardware)
If you need a particularly extreme blur, you can go via a smaller texture as an intermediate.
Your first pass might average blocks of 4 pixels to produce a texture half the width and height of your original. Then repeat with this texture to make one a quarter the width & height of your original.
Now when you run your 9-pixel Gaussian blur using this quarter-sized texture as input, it's like running a 36-pixel blur on your original source texture, at vastly reduced cost.
The downsampling will erase high-frequency information from your texture, but so does a big blur kernel, so in practice the scaling artifacts are not very noticeable in the blurred output.