Glow/bloom effect
Hey,
I'm wanting to add a glow/bloom effect to my light sources. I have done a few searches and some people seem to use pixel shaders, HDR etc. I just wondered what's the quickest/easiest way to produce such an effect and if anyone knows of any tutorials desciribing it (OpenGL pref.).
Thanks!
Render glow materials (only) to a buffer.
Apply some blur filter to the buffer.
Then Add it to your rendered scene.
Apply some blur filter to the buffer.
Then Add it to your rendered scene.
When doing the trick Kuladus describes, remember to keep the Z-buffer intact (and use ZPASS_GREATER_OR_EQUAL or whatever the flag's called) so that you only get *visible* glow areas added to your scene. :) Also a cheap way to blur it is to just render to texture at 128x128 or something and then stretch to screen size. A slightly less cheap but much better is to render to 512x512, then do a 'generate mipmap' thing in hardware if you can, then use a lower mip level (128x128 or whatever) for your blurred image. That gives you proper downsampling.
What about rendering the entire scene to a texture, then only blurring the parts of the image that are 'bright' enough? Is that possible?
If you're talking about a software renderer, then it's possible. For a hardware renderer, unlikely. You'd have to, for each pixel, look around it for pixels in some radius that are bright enough, then add an appropriate amount to the pixel. I don't think shaders can do that sort of stuff yet, at least not at realtime rates. Separating things out into multiple simple passes and then combining them seems to be the way to go.
Quote:Original post by MikeyOYes - instead of rendering 'glow sources' into a buffer, you render the entire scene (usually the backbuffer as a textured quad), performing a luminance extraction. It requires a pixel shader, but it's easy to do. A very basic luminance extraction would be to dot3 each pixel against (0.3, 0.3, 0.3).
What about rendering the entire scene to a texture, then only blurring the parts of the image that are 'bright' enough? Is that possible?
Quote:Original post by fractoid
Also a cheap way to blur it is to just render to texture at 128x128 or something and then stretch to screen size. A slightly less cheap but much better is to render to 512x512, then do a 'generate mipmap' thing in hardware if you can, then use a lower mip level (128x128 or whatever) for your blurred image. That gives you proper downsampling.
Combining both methods also works and gives even better results. Copy screen to 512x512 texture and create mipmaps. Then add them together with equal weights (1/number_of_mipmaps). This will give you a very nice glow.
A much better (and also more expensive) method would be using FP to do gaussin blur (2x 1D gauss with 7 or 9 samples). You gain a bit more blur by grabing samples in the middle of texels. I have both methods implemented and are selected at runtime depending on HW.
ps: Another thing that would come very usefull would be MRT, but I don't know how that is supported on old/low-end cards.
May be this article can be of help.
http://www.gamasutra.com/features/20040526/james_01.shtml
http://www.gamasutra.com/features/20040526/james_01.shtml
Quote:Original post by muhkuh
May be this article can be of help.
http://www.gamasutra.com/features/20040526/james_01.shtml
This explains how to do gaussina blur. For mipmapp method look at ATIs developer pages for an old demo (for R7500?) or for Glare demo at Nutty's site.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement