Motion Blur

Started by
12 comments, last by Toan1979 18 years, 3 months ago
I'm trying to implement a simple motion blur effect in my scene. I understand the concept of blurring the previous frame over the current one, but am unaware of how to do this in DirectX. Could anyone point me to a directx tutorial or identify the functions used to accomplish this.
Advertisement
You can apply high-quality blurs more efficiently and effectively using image post-processing shaders. If you check out the Nvidia SDK, you will find many different blur shaders that you can use.

You can browse through the effects online here.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Thanks for the info circlesoft, I did however want to stay away from shaders. Do you or anyone else for that matter know the process involved in merging the frame buffer over a number of frames?

Cheers
What you could do is use a simple Render-To-Texture technique where you will render the entire scene or the object you want blurred to a texture and then add some alpha component to the texture and then shift it up/down/left or right and then do this a couple of times. Also setting the appropriate render states such as alpha blending. This will give you a simple blur effect but might prove costly.

Basically the pattern will involve the following.

#1 RenderToTexture the to be blurred object (Top_Left)
#2 RenderToTexture the to be blurred object (Top_Right)
#3 RenderToTexture the to be blurred object (Bottom_Left)
#4 RenderToTexture the to be blurred object (Bottom_Right)
#5 Setting appropriate render states (Alpha blending)
#6 Final composed scene are the textures rendered into a final texture or scene.
By writing an alpha component to the textures you can create a somewhat blurred effect.

I hope this helps.
Take care.
Ahhh awesome I should be able to do that.

Just a quick question though. I'm using the default D3DXMeshes (eg. teapot and cone) for this demo, how do i set the alpha on these objects?

Cheers
Ok, I've kinda gone off track with how I was implementing this.
ATM i'm just using a normal mesh, with a material property that has an relatively low alpha value (0.3 i think). I render the initial object then trace back along the path it has travelled and render it a few more times along the track.

The object is rendering with some-what of a trail, but the blending between each of the objects looks crap. I would guess that the problem of this is my SetRenderState properites set for SRCBLEND and DESCBLEND. Could anyone suggests what values I should use for these as I progress through rendering the initial object and then its previous states.

Cheers.
Ok, perhaps I haven't made myself exactly clear.

All i need to do now is render to the frame buffer is such a way that when I am render onto pixels that have already been rendered, the alpha value increases.

So in the end when I render my object multiple times the alpha gradually increases imitating a motion blurred effect.

I think all I need to do is set the write SRCBLEND and DESTBLEND variables.

Any suggestions?
Sorry for the delayed reply,
If you haven't had any experience with alpha blending before you could look at some tutorials online and moving the texture a little bit outwards each time would be a trivial exercise.

Alpha blending tutorial on PieterG.com
Alpha blending tutorial on TwoKings

I hope this helps.
Take care.
No problem man, thanks for the reply and the info. Looks like good material. :)
On the motion blur topic... are there any good resources for implementing a pixel-velocity-based technique rather than alpha blending multiple full frames?

This topic is closed to new replies.

Advertisement