Motion Blur/Warp effect

Having recently played games like Metal Gear Solid and Chrono Cross for the PSX, I’ve gotten interested in the neat motion blur technique they use. I tried to duplicate it with the following code:

//in Init()
glReadBuffer(GL_COLOR_BUFFER_BIT);

//in Draw(), after scene is drawn
//x < 1 and x > 0

glAccum(GL_MULT, x);
glAccum(GL_ACCUM, (1-x));
glAccum(GL_RETURN, 1.0);

I tried this for many values of x. This was very slow, and didn’t look quite like the effect on the PSX. Anyone out there know what algorithm they use in those games, and how to do it easily with OpenGL? Thanks in advance:.

[This message has been edited by Naerbnic (edited 08-28-2000).]

[This message has been edited by Naerbnic (edited 08-29-2000).]

methinks your read is killing your performance. you don’t REALY need to read nitmaps…

what motion blur means is the camera shutter is open for a period of time, and during this period objects have moved, ie. are multiply exposed over different positions.

what you need to do is render multiple scenes reflecting this movement, and average them together. suppose… hmm. you wanted the shutter to be open for 1/4 of a second, and an object moves 4 pixels a second, and suppose you want to sample… say (to make the maths easier 4 samples per frame. you just need to draw four scenes, each where the pixel moves 1 pixel along. can you see why??

if s is the time the shutter is open, a object moves d units in a second and you want m samples per frame, then for frame n E m, you want an object to be ((n/m)/s)*d units from the start of the frame to where you want it to be in 1 seconds time. that’s probably a very screwy way of describing that…

for each frame n E m, you just glAccum with a weighting of 1/m. you have to (have to? there are tricks around this, btw) redraw the entire screen each frame…

well, not. you can get around it if you know the camera isn’t moving, and can render all the static stuff, read it to some other memory (incl the depth map) and then copy it back for each frame n E m.

cheers,
John

I’ve not seen the motion blur effect, but could it be that they just draw the moving objects several times with some alpha at different time steps?. Sort of keeping a couple of animation frames.

Or maybe the objects themself has been “enlarged” in the direction of the movement? With more and more transperancy in the opposite of direction of movement.

Reading back pixels from the screen is bound to be slow with todays hardware.

If you want a cheap and easy pseudo-motion blur effect,and you don’t mind having a solid white background color,here’s what you can do.Cut off doublebuffering and don’t use glclear(GL_COLOR_BUFFER_BIT).Draw your scene as usual,and then draw a transparent quad that covers the entire screen with RGB settings all cranked up to 1.0f.
Set the alpha value of the quad to around 0.1-0.2f,and TADA! It’s not real motion blur,as it only effects the EDGES of objects,but it’s a pretty cheap effect.You won’t see the effect if you’re scene covers the whole screen,so use small objects for best results…
Chris