Archived

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

Terren

Motion Blur Artifacts

Recommended Posts

Terren    122
Hi I am trying to create a motion blur effect using the following method: 1) *not* clearing the screen every frame 2) Drawing a transparent quad over the screen to fade out the last frame 3) drawing the next frame geometry over the last faded frame. On my own system everything is hunky-dory in windowed mode, but in fullscreen mode I get large horizontal black lines flickering over the screen. I assume this is down to the refresh rate perhaps? I am running an ATI Radeon 8500 in Windows XP with the latest drivers. On a laptop, using an ATI IGP 340M (with latest drivers), the quad blending does not work at all (hence no fading out and the screen eventually becomes totally white). On another similar machine using a NVIDIA GeForce 4 Ti4200, the fading quads flicker and does not produce the desired image still. I gather that this could be down to the different manufacturers implementation of the OpenGl drivers, with regards the technique I am using (ie: not clearing the screen), but am still curious as to how I can get this to work reliably. The reason this is being made is for a fullscreen MP3 jukebox, and will be implemented as a Visualization type feature. I have it working perfectly the way I want it (screenshots on demand), just only on my machine. I have tried the motion blur technique that is implemented in the GameTutorials.com tutorial, but this seems to produce very short motion trails and colour artifacts. I have also tried the Image Feedback method outlined in Special Effects Game Programming, but really I am after the same technique I have used above. Can anyone give me any pointers? Cheers muchly! Steve

Share this post


Link to post
Share on other sites
mictian    138
I don''t know whats up with your app, but assuming it is some problem caused by not clearing the framebuffer you could always do this:

render 1st frame
glCopyTexSubImage2D(), copy framebuffer into a texture

now every frame just render the texture(faded like you are already doing) render the new image, then copy the framebuffer into the texture for next time

clear the framebuffer between frames

hope this is at least pseudo-useful

Share this post


Link to post
Share on other sites
LockePick    707
I must be misunderstanding something, because I don''t see how your motion blur technique is going to work. Pixels will just be completely replaced by the new frame, not blended in. If your level is enclosed (indoors, skybox, etc) then there will be nothing of the previous frame left (it''s common to skip clearing the colour buffer if you have enclosed levels since it all just gets written over anyways).
You should be doing what mictian says, copying the previous frame and blending that overtop of the new frame.

You absolutely have to clear the depth buffer either way.

Share this post


Link to post
Share on other sites
Maximus    124
Instead of doing it that way, copy the previous frame to a texture, clear the framebuffer, render the new frame, and then blend the old frame over the top, rather lightly but not too lightly.

Share this post


Link to post
Share on other sites
Terren    122
Thanks for the replies!

quote:

Lockepick: I must be misunderstanding something, because I don't see how your motion blur technique is going to work. Pixels will just be completely replaced by the new frame, not blended in.



The technique works because every frame I am only covering maybe 30% of the screen, by drawing a few shapes in the middle, along with a line drawing of the current audio frequency spectrum. The camera rotates around it's Z axis to give the motion, which is then blurred by not clearing the colour buffer. Also, every 30ms, say, I am blending a fullscreen Quad over the screen to give the effect of fading out to the background.

quote:

Mihail121: Don't clear the color buffer but clear the depth buffer!


I haven't tried this yet on the other machines that don't work, but will do tonight. I'm not using depth testing at all - would clearing the depth buffer still have an effect?

Basically, the effect I am trying to achieve is exactly the same as how Windows Media Player does it's visualizations, in particular the Ambient ones.. I have been pointed to the Winamp site, which didn't really help me too much; I've also heard that MP does it using the Image Feedback technique, but I can't seem to get it looking right at all.

My first thought after I found that my technique didn't quite work out was to try the technique that Mictian and Maximus talk about, but I just cannot get the blur trails to last anywhere near long enough for it to look good - i've tried using a timer to lengthen the blur intervals, but to get them long enough it begins to look jerky and intermittant; I try and set the alpha value of the blending quad as high as possible without reaching full opaque, it gets to a point (round about 0.96) where the result is either no fading out at all, or the shapes on screen start carving out large pink areas - I would assume this is maybe down to the colour precision of the texture, or something. Also, when I set the alpha low enough to produce a small amount of blurring, from a white shape to a black background the blur colours go from white (from the shape) to black through a progression of greens and pinks, not a straight greyscale gradient, if you understand what I mean. Ach, i'll upload some pictures tonight, and you'll see.

Basically I would just like one frame to 'melt' into the next - the technique I started with produces the best results, but isn't reliable; using the render to texture method I just can't get it right

[edited by - Terren on September 1, 2003 4:33:34 AM]

Share this post


Link to post
Share on other sites
Terren    122
Incidentally I have just tried the program using a Radeon 9000 and the program works fine.

More testing and experimentation neccessary, methinks..

Share this post


Link to post
Share on other sites
Terren    122
Ok, I just got this working.

Basically I went back to trying the Image Feedback technique, which I just couldn''t get right earlier, and it is exactly the effect I am after. Basically its very similar to what I had when blending the previous rendered screen over the new one. After messing about with different color and alpha values and experimenting with various transformations I finally got it looking half-decent. I''m still messing about, of course. Later on when I get home from work (he he..) i''ll try and finish a final version of *a* visualization. I''ll post some pics if anyone is at all interested.

At least it works on the Ti4200 as expected, and also the R8500.
However, if it still doesn''t work on the IGP 340M i shall be forced to rip out my genitalia..

Share this post


Link to post
Share on other sites