Archived

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

NewAmber

Motion Blur ???

Recommended Posts

Hmm just some brief info on this.
In openGL the ''proper'' way to apply motion blur to a scene is through use of the accumulation buffer, this is rarely supported in hardware so is painfully slow. I think voodoo 4/5 have one and some really high end cards.
But if you have say just particles moving on a black background, you can fake it by simply drawing a frame, then when you draw the next one, dont clear the colour buffer, then blend a black quad over the screen instead, then redraw the updated scene on top.
There are many ways to fake it but most seem to look not too nice or be to slow. Look around I''m sure you''ll find something cool in openGl, Direct3d or software.
I''m sure people here will know more than me.
Hope this brief post has been of some use.

Share this post


Link to post
Share on other sites
It's actually a pretty easy effect to implement, it's just that you don't want to do it too much or you'll kill your fillrate. Basically, with the object in question, you redraw it multiple times slightly behind the actual position of the object. So, quasipseudocode would look like so:

    
//Create a vector that goes the opposite direction as the player

Vector InvObjectPosition=MyObjectPosition();
InvObjectPosition *= -1;

//Loop through and draw the object multiple times. We're

//just going to cheat and use the integer length of the vector

//to determine how many blurred objects we'll have. There's

//probably a "real" way to do this that you might want to look

//up, but this is sufficient for our purposes.


float Alpha=1.0f; //Alpha, continually subtract from this number

Vector ObjectDirection; //Same as InvObjectPosition, but length

//of 1.


ObjectDirection = InvObjectPostion;
ObjectDirection.Normalize();

for(int i=0; i<InvObjectPosition.Length(); i++)
{
//Move it back along the vector based on the value of i

Position BlurredObjectPosition = MyObjectPosition();
BlurredObjectPosition += (ObjectDirection * i);

//Render the object again with other positions

RenderObject(Alpha, BlurredObjectPosition);

//Calculate a new Alpha value

Alpha = 1-(i/InvObjectPosition.Length());
}


That's sort of cheap, but it's a starting point at least . It doesn't handle animation, and you'll need to figure out what blending states work best, but that hopefully helps a bit.

Edited by - The Senshi on June 7, 2001 1:14:27 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://freespace.virgin.net/hugo.elias/graphics/x_motion.htm

Share this post


Link to post
Share on other sites