Sign in to follow this  

Motion blur and artifacts

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Since the accumulation buffer is insanely slow I decided to achieving some motion blur-effects by rendering my scene and copying the framebuffer to a texture. Next frame, switch to ortho mode and render a quad textured with said texture over the entire screen at 0.9 alpha, then once again copy the framebuffer to the same texture. Repeat as long as motion blur-effects are turned on. While this performance-wise seems to work pretty well and gives almost exactly the same visual result as the accum buffer, all objects leave a faint trail of its own color on the black background. The blending equation used is GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA. Does anyone have any ideas about how to eliminate that trail while still maintaining the motion blur-effects?

Share this post


Link to post
Share on other sites
(ONE,ONE) doesn't 'fade away' with time.
With (SRC_ALPHA,ONE_MINUS_SRC_ALPHA), old frames decay as new frames are rendered on top of them, with (ONE,ONE) the new frame is just layered on top of the old ones without any decay.

Share this post


Link to post
Share on other sites
Oh I know that problem, what I did to overcome it is instead render an alpha blended black screen quad over the scene like this:


glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
glBlendFunc(GL_ONE, GL_ONE);
glBindTexture(GL_TEXTURE_2D, 0);
glBegin(GL_QUADS);
float Fade=TimeStep*FADE_RATE;
glColor4f(Fade, Fade, Fade, Fade);
glVertex2f( 1, 1);
glVertex2f( 1, -1);
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glEnd();


Then I copy the result to a texture, and this is what I use for the trails. This way the fade is a linear function where FADE_RATE is the number of seconds it takes for the trail to disappear. Then I just draw the scene normally for the next timestep, and layer the trail texture overtop using glBlendEquation(GL_FUNC_MAX);

btw, BlendEquation is an extension.

Share this post


Link to post
Share on other sites

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this