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.

5 Answers
5

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.

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