Archived

This topic is now archived and is closed to further replies.

plessing

motion blur on 2D img

Recommended Posts

hi To create a motion blur effect on a 2D image, do you simply overlay that image onto itself with an offset and alpha blend it? Or is there a more elegant way? I''d like to have different degrees(power) of motion blur, and if possible in different directions as well. p.

Share this post


Link to post
Share on other sites
Using a simple blend can give a motion blur like effect, but it wont be too convincing. Additive blending should be better. So for the 5 pixel blur you would draw each sprite at 20% intensity adding the colour to the existing pixels. If your background isnt black you may have to draw it on to a offscreen buffer before you copy it to the display..

Share this post


Link to post
Share on other sites
I''ve had another idea right now, but it''s untested.

The idea is to do the blur completely on the GPU by drawing a squeezed version of the image into a background buffer and stretching it back on the screen.

First, you need to turn anisotropic filtering on. Generate a mip-mapped texture from the image you want to motion-blur. Then you draw the texture into a background buffer. This image should be squeezed by a factor of say 4 in the direction of the blur, e.g. for horizontal blur:

original image:

o---------o
| |
| |
| |
| |
o---------o


squeezed image drawn into the buffer:

o--o
| |
| |
| |
| |
o--o


In the non-blur direction, one texel should correspond to one pixel, so that the image will look normal in non-blur direction (thanks to anisotropic filtering!) but smoothed and squeezed in x-direction thanks to mip-mapping. Then you read the image back, strech it by a factor of 4 in motion-blur-direction and draw it on the screen.

You can modify the strength of blur by adjusting the scale 4 to a lower/higher value.

I think it''s the fastest thing you can do but it might not look as realistic as the so-called temporal oversampling d000hg proposed since the image doesn''t "mix" with the background unless you do some fancy alpha-fading (shouldn''t be too complicated, though).

Does anybody understand what I try to say?
Is it some new idea?
Has anybody ever tried it?

Share this post


Link to post
Share on other sites
Well, thanks for the link. What I could find is that they use filters to do software motion blur and mipmapping just for (approx) rotational blur like depth effects. Thats old, I admit. There''s also a NeHe Lesson on that.

But I could not find where they describe abusing the anisotropic filtering combined with mip-mapping for doing motion blur in hardware. I''ve just skimmed the article. If I''ve missed this, please excuse.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What about pixel-shaders for post-process motion blur? There r some elegant algos out http://www.gamedev.net/community/forums/icons/icon25.gif
http://www.gamedev.net/community/forums/icons/icon25.gif

Share this post


Link to post
Share on other sites