PDA

View Full Version : glBlendFunc



MasTrO
08-12-2004, 06:45 AM
hello,
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 (r) inicates the result, then

R(r) = R(source) + R(dest)*ALPHA(dest)
G(r) = G(source) + G(dest)*ALPHA(dest)
B(r) = B(source) + B(dest)*ALPHA(dest)
->> wich is good for me ;)

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

ALPHA(r) = ALPHA(source)

Any idea ?

ZbuffeR
08-12-2004, 09:28 AM
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.

grimoire
08-12-2004, 06:08 PM
look up the accumulation buffer in chapter 10 of the opengl Red Book

MasTrO
08-13-2004, 08:42 AM
shame on me...well... nevermind

thank you. I'll try with the accum buffer

dorbie
08-13-2004, 10:07 AM
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).