Interpolating Animation Frames
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.
Wouldn''t this happen automagically if you use delta-times in the animation calculation? Something like (hopeless pseudo-code):
dest = destination framecurr = current frame but moved dt timesMoveVertices(curr, dest, dt){ for all vertices do { dist = dest.vertex - curr.vertex; curr.vertex += dist * dt; }}
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement