I’m trying to do motion blur using the alpha buffer.

In order to make the new frame on top and to make the last frame darker, I’m using :

glBlendFunc(GL_ONE,GL_DST_ALPHA), then I draw using
glColor4f(r,g,b, 0.95); if the obect is blurred
glColor4f(r,g,b, 0); if the obect is not blurred
if ® inicates the result, then

R® = R(source) + R(dest)*ALPHA(dest)
G® = G(source) + G(dest)*ALPHA(dest)
B® = B(source) + B(dest)*ALPHA(dest)
->> wich is good for me :wink:

but also:
ALPHA® = ALPHA(source) + ALPHA(dest)*ALPHA(dest)
->> the problem is I want :

ALPHA® = ALPHA(source)

Any idea ?

I’m afraid your idea is flawed :

What if you have a big wall not blurred drawn behind a blurred object ? It will clear the object blur.

look up the accumulation buffer in chapter 10 of the opengl Red Book

shame on me…well… nevermind

thank you. I’ll try with the accum buffer

FWIW that isn’t correct motion blur anyway.

Motion blur should NOT be a blending of the last few frames. Motion blur is an integration of all positions between the last frame and this frame, or better stated an integration of the positions over the exposure time of this frame. The LAST thing you’d want to do for motion blur is accumulate old frames that have been shown from previous renderings, (unless you are rendering faster than the vertical refresh of the monitor in which case you get away with it for all the wrong reasons).