Archived

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

Thrump

Interpolating Animation Frames

Recommended Posts

Thrump    169
Is it possible to interpolate animation frames at run-time? For example, I want to make 25 frames run over the time of 30 frames, but it''s not known until the game is being played. How involved is this? A weekend? 1 week? 1 month? I may have a few things doing this on screen at a time. Is this possible? Thanks.

Share this post


Link to post
Share on other sites
amag    152
Wouldn''t this happen automagically if you use delta-times in the animation calculation? Something like (hopeless pseudo-code):
  
dest = destination frame
curr = current frame but moved dt times

MoveVertices(curr, dest, dt)
{
for all vertices do
{
dist = dest.vertex - curr.vertex;
curr.vertex += dist * dt;
}
}

Share this post


Link to post
Share on other sites
+AA_970+    122
Here''s the equation...

interpolated_point = point_frame_end * dt + point_frame_start * ( 1.0f - dt );

(where dt is the time ''location'' between the two frames, dt>=0.0f, dt<1.0f)

point_frame_start is the location of the point in the current frame
point_frame_end is the location of the point in the destination frame

What I do is that i set dt += speed * Delta_Time where Delta_Time is the time that''s passed since the last frame. Then when dt >= 1.0 i change to the next frame and set dt = 0.

I did this in about 2 days, but I already had an animation system set up without interpolation.

Digital Radiation

Share this post


Link to post
Share on other sites
Thrump    169
Thanks for the tips. It gave me some food for thought. I can''t do this right now, as I know now that something that''s not done yet has to be done first. So, I''ll get back to you with my results at a later date.

Share this post


Link to post
Share on other sites
Pseudo    100
To my understanding, this can be done with DX8 rather easily. as in 1 hour. all you have to do is load the frames mesh''s into different vertex buffers, and then use SetStream to put them in different streams, and then dx8 has built in support for interpolating them.

Share this post


Link to post
Share on other sites