PDA

View Full Version : Blur edges on static polygons



03-23-2006, 11:28 PM
I would like to put the blur effect on polygon edges. The polygons are static except that their colors are changing.

I have multiple polygons on the screen, and only some of them are going to be blured and maybe be back to shape edges after some time. A gradual blur and gradual back-to-sharp effects are preferred. The blur effect is like the title font on

http://hcsoftware.sourceforge.net/RadiosGL/RadiosGL.html
However, each polygon is in single color.


I have searched methods of blend, fog, accumulation buffer, writing to texture. But I dont think any of them would help. Is there an easiest way to do that?

dorbie
03-24-2006, 04:32 AM
The simplest way for a beginner would be to render to the stuff you want to blur to a small viewport on the framebuffer with antialiasing (there re several ways from MSAA to polygonsmooth approaches, make sure you draw it on a black background, next glCopyTexImage to an RGBA texture (this also assumes you have a destination alpha framebuffer pixel format). You then draw this texture with a magnification filter (using a quad and texture coordinates) to the framebuffer with a glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). If that's not enough filtering then using a fragment shader with multiple displaced weighted texture taps when you draw the texture.

ZbuffeR
03-24-2006, 05:03 AM
>> If that's not enough filtering then using a fragment shader with multiple displaced weighted texture taps

or simpler (but less efficient), draw multiple times the same quad, moving a bit each time, with alpha blending.

k_szczech
03-24-2006, 06:00 AM
If you do not use and do not plan to use textures on these polygons, then placing a triangle strip around polygon that should be blurred may be a good idea.
The triangle strip will have the same color as polygon and it's alpha value would be 255 on inside edge and 0 on outside edge. Additionaly you could shrink the polygon itself.
In 2D that would be very easy, in 3D it would requre some caltulations, but still it could work fast. However I think this approach would work only with simple shapes.