Jump to content
  • Advertisement
Sign in to follow this  
nef

Cheap, Full Screen motion blur problem

This topic is 4324 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

Ok, im trying to impliment a faked out motion blur technique on some older hardware. I've gone through the radial blur tutorial on NeHe's website, and i came up with this method for motion blur: Step 1: Render the whole scene. Step 2: Render PreviousScene Texture over the current backbuffer w/ an alpha Step 3: Copy the entire contents of the backbuffer into previous scene. Now, i get problems with trails not dissapereing. After looking over the steps, i came up with another set that i thought would solve the problem. Step 1: Render the entire scene to a texture and clear the backbuffer Step 2: Render full opacity previous scene texture to the backbuffer. Step 3: Blur the current scene texture that we just rendered in step 1, over the contents of the back buffer which contains the previous scene at full opacity. Step 4: Copy the entire back buffer into the previous scene texture. This makes more senese, because now the current scene is being blended over the previous one, so any trails should eventually be overcome by the current scene constantly alphaing over it frame by frame. I still get the same problem with this method. My question is, am I doing some of these steps wrong? Should i be using a timer or a changing alpha? Should i be queueing up previous scene and just blending through x amount of queued scene textures? I also tried just saving the rendered scene as the previous, instead of using the entire blured scene as the previous, this didnt produce a great motion blur effect.

Share this post


Link to post
Share on other sites
Advertisement
Firstly, this isn't motion blur. Motion blur adds information not captured by a single sample. This is just persisting existing information, producing motion trails. That said, it can still look pretty good (IIRC the Burnout games use it in the crash replays).

What problems are you getting? A screenshot would help. The usual problem is streaks that won't go away, caused by rounding errors and colour imprecision. There isn't really any way around that, other than lowering the persistance so its less common.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
The usual problem is streaks that won't go away, caused by rounding errors and colour imprecision. There isn't really any way around that, other than lowering the persistance so its less common.


I know it's not real motion blur, but the hardware im working with dosn't even support pixel buffers, much less shaders so im stuck with this method.

That last part, the streaks that wont go away is exactly the problem im having. Your solution, lowering the presistance is basically impossible the way im doing it.

I think ill go with the queue method and just x number of older frames and render them all each frame, removing the oldest and adding the newest every frame. This would let me controll the persistance and hopefully solve this problem.

Thanks!

Share this post


Link to post
Share on other sites
Ok, i did a lot of searching on this particular method and wasn't able to find much help other than the basic idea of blur the previous frame over the current. I finally got it working beutifully w/o the streaks staying around, this is what i did incase anyone else ends up searching for the same problem.

Step 1: Initialize a list of objects that represent your textures that you are rendering too. I wrapped mine up inside of a RenderTarget class. The number you need to create inside the list is what i call BlurDepth, this can be a configureable number to enhance the blur effect, but for now it's 5.

Step 2: Pop the render target off the front of your list, render the current scene to that target, then push it onto the back of your list.

Step 3: Clear the back buffer. Setup your blending, and render the entire list of quads, starting at the begining all the way to the end of the list. Each quad should be renderd with an alpha value that is gradually decreasing.


And that's it. You can queue up a new RenderTarget each frame, so your still only copying the scene to a texture once, you just render multiple scene textures each frame. It's easy and it looks good for the type of effect. Good luck to anyone else.

Share this post


Link to post
Share on other sites
have you tried using the accumulation buffer?
with the help of this buffer, you can do a motion blureffect with just 3 calls (assuming you are using opengl)
and i think, this is much nicer and less ressource-consuming

some code:

glAccum(GL_MULT, 1.0 - q);
glAccum(GL_ACCUM,q);
glAccum(GL_RETURN, 1.0);

bye

Share this post


Link to post
Share on other sites
Quote:
Original post by WarMuuh
have you tried using the accumulation buffer?

Accumulation buffer support is still pretty rare (last couple of generations, max). If the OPs card doesn't even support pixel shaders then the accumulation buffer is going to be ridiculously slow (as in, non-realtime slow).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
On recent hardware, accumulation buffer is an excellent choice, on older hardware that at least supports vertex shaders, you can fake motion blur by extruding vertices along the path in the vertex shader and fading alpha to zero according to speed.

When looked at closely, it's quite bad compared to better techniquest, but on casual observation, it's a surprisingly good effect that's extremely cheap and runs on DX8 hardware. nVidia had a demo on that in one of its old SDKs (probably still found on their website somewhere).

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
Quote:
Original post by WarMuuh
have you tried using the accumulation buffer?

Accumulation buffer support is still pretty rare (last couple of generations, max). If the OPs card doesn't even support pixel shaders then the accumulation buffer is going to be ridiculously slow (as in, non-realtime slow).



You hit the nail on the head. The 3 lines of code accumulation buffer was my first try :) Of course, running the game at 1-2 fps isnt acceptible :p Im on some old hardware (GeForce4MX aka, GeForce2)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!