Monday
Feb232009
Fullscreen Glow

I added support for fullscreen glow to my renderer yesterday and overall I am happy with the results. While this effect is not full blown HDR color correction/bloom/etc., it gives the scene a softer look while making the luminous colors brighter and providing some anti-aliasing on the side. I realize some people feel these type of post-processing effects are overused, but I like it. If you disagree, it will be one of the detail settings in the game that you can turn off.
WARNING: What follows is graphics nerd speak...
Here's the rundown on my implementation:
Here's what the final result looked like:
WARNING: What follows is graphics nerd speak...
Here's the rundown on my implementation:
- If glow is on, we render the scene (minus UI) to an offscreen rendertarget, otherwise proceed as normal while rendering to the backbuffer.
- When we're done rendering the scene, switch the rendertarget over to one that is 1/4 the size. This fraction can be larger or smaller, but I made the performance/quality tradeoff at 1/4.
- Set the full-size offscreen rendertarget as a source texture.
- Set a fullscreen quad as the vertex source.
- Sample from the offscreen RT now... we are effectively downsampling the original result.
- The output of this stage is this sample, with the alpha channel containing the luminosity (or grayscale) of the color.
- Set the alpha blending mode to additive.
- Set the rendertarget to the backbuffer and another source texture to the downsampled luminosity RT.
- For this pass, sample the downsampled luminosity texture with a 3x3 gaussian blur kernel. Again, the size of the blur can be larger or it can be a box filter. This is also a performance/quality tradeoff.
- Add the blurred luminosity value to the sample for the scene texture.
Here's what the final result looked like:
