Bloom On
Bloom Off
Workflow
- 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.
- Blur the second color buffer.
- Blend first color buffer with blurred second color buffer.
Implementation
-
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):
-
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:
-
Blend “normal” scene and blured blured lighting region. Do tone mapping and Gamma correction.
Final result:
Resource
https://learnopengl.com/Advanced-Lighting/Bloom