PDA

View Full Version : Post processing screen effects



fmatthew5876
04-29-2011, 10:15 PM
I was contemplating the best way to do screen wide effects.

The simplest example would be like fading the whole screen to black.

The easy way would be to just copy the frame buffer to client and do it in software but that would probably be the slowest.

Another way would be to render the entire scene to a texture, and then slap it onto a giant quad and do the screen effects in the fragment shader.

Third would be to just append the post processing effects directly to the fragment shaders in the main rendering pass with uniform conditionals saying whether or not to use them.

If you had to implement this how would you do it? Thanks!

overlay
04-29-2011, 11:13 PM
#2, using a FBO (frame buffer object).

BionicBytes
04-30-2011, 06:52 AM
use multiple shaders, one for each effect.
Use a series of frame buffer obejcts to perform the full screen pass/shader on the FBO colour attachment.
Use the FBO attachment as the source texture for the next post-processing effect and ping-pong between 2 or 3 FBOs depending upon whether you can recycle the FBO or need to hang on to it for later. Also, some effects may be full screen, whilst others may need to be 1/2,1/4,1/8 etc in size (eg horizonal blur, vertical blur FBOs).

uruk
04-30-2011, 09:48 AM
For a "fade to black" effect you could just animate the alpha value of a full screen black quad.