8
\$\begingroup\$

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.

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

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.

\$\endgroup\$
6
\$\begingroup\$

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).

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.
\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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