Bloom
is a visual effect where the bright parts of an image seem to have fringes that
extend beyond their boundaries. Sources
of bright light “bleed” into other areas of the image.
Source: Elephant’s Dream
We
can mimic this effect by determining which parts of the image are bright. Then,
blur those bright parts, and add the blurred result back into the image.
How to create bloom (Greg's recipe)
- Pass 1:
Render the scene to texture using FBO1.
- Pass 2:
Render a full-screen quad using the texture from pass 1 to texture using
FBO2. In the fragment shader,
- Set
fragments with brightness below a threshold to zero.
- Pass 3:
Render a full-screen quad to the default framebuffer. In the fragment shader,
- Apply
a blur using the texture in FBO2
- Add
it to the original image using the texture in FBO1.