Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 trail implement
Post New Topic  Post Reply 
Hi,
I just implement a trail attach to a sword,
but it is not smooth when sword changing position quickly.

I wonder how to achieve this kind of smooth in this video:
http://www.youtube.com/watch?v=EFPJ0W9LpKQ

Any suggestion?
Thank you!

 User Rating: 995   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Haven't tried it, but a guess: each frame, calculate the worldspace position of some points on the sword (the top and bottom for instance), and save these in a list; then, draw trails by connecting those points.

 User Rating: 1064   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
but it is not smooth when sword changing position quickly.

To address this specifically... If a sword swing takes 1/2 of a second and the game is running at 30 fps then that swing only lasts 15 frames. If you are generating only one new point per frame for the trail then it may look jagged. Have you tried you taking multiple, interpolated samples each frame?

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by gzboli
Quote:
but it is not smooth when sword changing position quickly.

To address this specifically... If a sword swing takes 1/2 of a second and the game is running at 30 fps then that swing only lasts 15 frames. If you are generating only one new point per frame for the trail then it may look jagged. Have you tried you taking multiple, interpolated samples each frame?


Yep, you can update your animation at a higher frequency than your frame rate to find intermediate points or you can pass a spline through the top and bottom set of points and find intermediate points that way. Running the animation at a higher frequency is likely to be higher quality but more CPU intensive.

I would recommend using a catmull rom spline as this passes through all the points generated by the animation. You will have to duplicate the current time point in order that the trail actually reaches the current frame.

http://www.mvps.org/directx/articles/catmull/

Cheers,
Martin

 User Rating: 1033   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Martin

I would recommend using a catmull rom spline as this passes through all the points generated by the animation. You will have to duplicate the current time point in order that the trail actually reaches the current frame.



Thank you all!
I will try using catmull rom curve to implement the trail effect.


 User Rating: 995   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: