Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is there a nice way in OpenGL to blur objects without using shaders?

Currently, I'm accomplishing blur by rendering the object slightly up, down, left, right, and the four diagonals from its original position. It seems like there should be a much better way of doing this. I'm working in a 2d scene.

share|improve this question
    
Why not use shaders? –  Jonathan Fischoff Jul 30 '10 at 16:17
1  
@Jonathan Several reasons, but the biggest might be using OpenGL ES 1.1 (Just FF). –  Matias Valdenegro Jul 30 '10 at 16:24
    
ah, gotcha ya. :( –  Jonathan Fischoff Jul 30 '10 at 16:29
    
Do you want to achieve blurred animation of these objects? –  Alexandre Jasmin Jul 30 '10 at 17:59

5 Answers 5

up vote 5 down vote accepted

What you've got already is good and the canonical way to achieve fullscreen blurring.

If you don't want fullscreen blurring, but want to blur 2d sprites on a per sprite basis, you can use mipmap LOD clamping/bias to force your hardware to sample a lower mip level. Used in conjunction with bilinear magnification filtering, the natural result should look blurred.

Failing that, you could use a separate texture for the blurred image and just switch between it and the unblurred texture. If you want smooth transitions, you can draw 2 sprites with each texture simultaneously and animate the alpha value for each of the sprites. ie. as time increases, alpha for sprite1 goes from 0..1 and alpha for sprite2 goes from 1..0.

share|improve this answer

Without using Shaders rendering the images offset as you do is as close to a blur effect as you can get. You could also just draw over the previous framebuffer with transparancy if you want to achieve full-screen blurring. However, each pass roughly doubles the needed fillrate to sustain a good framerate.

The next step would involve at least a Rendertexture and your own logic to process the image (software shader), or use a real hardware shader (iPhone 3GS and up).

share|improve this answer

That may not result in the the same kind of blur effect but what about downsampling the image to a small pixmap size and draw it on the screen with linear interpolation.

share|improve this answer

Without shaders, that's pretty much everything you can do. The accumulation buffer might give you more power to do more job, if it's available in your platform.

share|improve this answer

Do the objects need to transition from clear to blurry?

Level1:

  • The simplest solution is to pre-blur the source art and just draw it directly.

Level 2:

  • Create a handful of discrete steps of blur and generate those beforehand, then do image swaps as needed. You likely won't need that many to get the appearance of a smooth transition.

Level 3:

  • Generate a series of discrete pre-generated blur steps and alpha blend between the nearest two steps to smooth the transitions.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.