• Advertisement
Sign in to follow this  

Adding motion blur

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

Hi, I'm trying to add motion blur to my game (DX9) and I'm looking for a good tutorial or some sample code. I found the one from 2003 in the DX SDK. It's not that great to be honest, so I'm looking for others. +10 Bonus if the tutorial or sample code is MDX. Thanks, David

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by fervent
I'm trying to add motion blur to my game (DX9) and I'm looking for a good tutorial or some sample code. I found the one from 2003 in the DX SDK. It's not that great to be honest, so I'm looking for others.


I have found the pixel motion blur sample to be pretty good, so I would stick with that. However, there are also examples of this in the Nvidia SDK. Since the technique is pretty much all in the shaders, there really isn't much to port to managed code.

Generally, velocity-based motion blur is a very simple effect:

- In the VS, transform each vertex by the current WVP matrix, and separately by last frame's WVP matrix.

- Subtract the two, and you have the screen-space velocity of the vertex

- Store this velocity in the alpha channel (if you don't use alpha blending), or in a separate render target (using MRTs - good if you want to do depth of field, too)

- Perform blur passes based on this velocity

This technique works very well for rigid objects, but not so well for skinned (since you would need to store far too many world transforms in the shader).

Share this post


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

  • Advertisement