Jump to content
  • Advertisement
Sign in to follow this  

Motion Blur

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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
On the motion blur topic... are there any good resources for implementing a pixel-velocity-based technique rather than alpha blending multiple full frames?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!