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,
- Form a vector from the centre of the
screen (texture coordinate [0.5, 0.5]T) and
the current texture coordinate.
- Sample the image along this vector,
forming a blurred colour.
- Use mix, based on distance, so that pixels
farther from the centre get more blurring
Note:
texture2D()
is
deprecated -- use
texture()
instead.