Bloom

Posted by Xingyu Wang on October 3, 2020

Bloom On

Bloom Off


Workflow

  1. Render the scene to 2 color buffers(with HDR). The first color buffer contains the “normal” scene. The second color buffer contains colors that their lighting intensities exceed certain threshold.
  2. Blur the second color buffer.
  3. Blend first color buffer with blurred second color buffer.

Implementation

  1. Render the scene with HDR enabled. Output values to two color buffers by using Multiple Render Targets(MRT). 2 color attachments to 1 same FBO, both are textures.

    Value in first color buffer(“normal” scene):

    Value in second color buffer(region with high lighting intensity):

  2. Blur the second color buffer by using Gaussian blur. Instead of take N * N samples for each fragment. This demo uses two-pass Gaussian blur. Blur horizontally with N samples first, and then blur vertically with N samples. 2N in total.

    Blured lighting region:

  3. Blend “normal” scene and blured blured lighting region. Do tone mapping and Gamma correction.

    Final result:


Resource

https://learnopengl.com/Advanced-Lighting/Bloom