Blur
is another image processing operation that can be computed with a 2D
filter. These filters are lowpass
filters, since they pass the low frequencies (signal that changes slowly) but
diminish the higher frequencies (edges).
The
idea is to mix the colour of a pixel with that of its neighbours using a
weighted sum.
There
are many types of lowpass filter kernels.
Popular ones include:
- Moving average, also called a box filter. This just averages the pixels in a
neighbourhood around a pixel.
- Gaussian filter. This applies a weighting based on a 2D
Gaussian function. The neighbours are
weighted so that ones farther away contribute less.
- (others)

How to create blur (Greg's recipe)
- Pass 1:
Render the scene to texture using an FBO
- Pass 2:
Render a full-screen quad using the texture from pass 1 to the default
framebuffer. In the fragment shader, set
the fragment colour to the average of the pixels in an NxN
window around the current fragment.