iDevGames Forums

Full Version: openGL blur
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what's the easiest way to do a blur effect in OpenGL?
That depends on what kind of a blur effect you're trying to achieve.

To do motion blurs like in Oni you draw the blurred object multiple times in slightly different positions, with a traparent blend mode.

To get light trails like in some flight sims you draw extra polygons on the screen to form the trails. You can also use the trails method on moving sticks (character limbs) to quite good effect.

To get real full screen motion blur you can use accumulation buffers, or render-to-texture.

To get fake full screen motion blur (ala GTA3 and GTA:VC) you use render to texture, and then draw that on top of the previous frame with a slight bit of transparency.
I was looking for more of just a basic blur, like gaussian or radial, not a motion blur. is there any way to use a matrix transorm to do this?
Oh, sorry. Most people are interested in motion blur Smile.

For a general blur your best bet is render-to-texture. Render the object once then draw it several times with a mostly transparent blend.


or use glConvolutionFilter2D which enables you to apply arbitrary filter kernals to images.


Have a look at NeHe's tutorial on Radial Blur & Rendering To A Texture

NeHe tutorial 36

Here's a link to download the Cocoa source code of this tutorial.
the glConvolutionFilter2D sounds like what I need. I looked at the NeHe#36 and they just use texture scaling to fake the blur; not bad, but it gets chunky when you do a big blur.


I think glConvolutionFilter2D is part of the Imaging Subset, which I don't think is accelerated under any common consumer cards. I could be wrong though.
Reference URL's