Project B - More On The Update and Post-Processing Framework
game post-processing glow
I feel really bad about my last post. I feel like I made it too quickly and I did a poor job of explaining things. Because of this, I'm going to try to explain things a little better.I want to give more details of what is in the demo that I posted earlier. Though I talk a lot about the GUI, actually the first thing that I worked on was the post-processing framework. What is post-processing, basically with it, you can achieve all sorts of effects by running the entire completed scene through another set of shaders. You can use it to achieve effects like glow, motion blur, and many other things.
Here's an example of glow being created as a post-processing effect. From Genesis SEED, out IGF entry last year
This was the first system that I worked on because I wanted to fix a bug in it. I also wanted to design a really robust framework capable of handling many different kinds of effects.
How to do Post-Processing
The basic idea of post-processing is first render the screen to an auxiliary buffer instead of the back buffer. This auxiliary buffer can then be set as a texture to a shader. Then render a full screen quad of the texture using some effect shader. To perform different effects, you may need more than one auxiliary buffer. This is shown below.
The demo that I included in my last post used a glow effect. To perform glow, it uses the alpha channel to determine which areas should glow. The scene is first rendered to an auxiliary buffer. Then I use a 1/4 size buffer and render the entire scene to that buffer using a filter to only write pixels whose alpha value is set. Then I perform a vertical blur and then a horizontal blur. The final blurred texture is combined with the original image and then rendered to the back buffer. If you download the demo from my last post, you can take a look at the HLSL shaders.
Making a good post-processing framework isn't that hard. There's a good article on the subject here.
You have to be careful though. As you will be rendering the entire screen multiple times, you can lose a lot of speed. One way to speed things up is by using 1/2, 1/4 or even 1/8 size intermediary auxiliary buffers.
I hope this was useful. Check out my previous post to download the demo and see this and my GUI in action.
Here are some screen shots.