Animation

I’ve written a class to load a 3D MAX file and display it. Most everything works so far, material properties, normals, etc. Now the big step…ANIMATION!!! I’ve written a function that uses the keyframe information stored by 3D MAX to display animated files. I’m having a lot of trouble and I wonder if anyone knows where I can find information on this topic.

I´m interested in this too!

I’m amazed at how hard a time I’m having finding information on simple Keyframe animation. It seems like you can’t find information that’s useful until it’s out dated when it comes to game programing. Anyway, if you’re interested in what I have so far, I’d be glad to email you the file reader/converter, and the display program. They are actually 2 seperate programs.

Originally posted by rolfewiz:
I’m amazed at how hard a time I’m having finding information on simple Keyframe animation. It seems like you can’t find information that’s useful until it’s out dated when it comes to game programing. Anyway, if you’re interested in what I have so far, I’d be glad to email you the file reader/converter, and the display program. They are actually 2 seperate programs.

I’m interested too rolfewiz
If you can mail me , i would be very gratfeful…
my email is brunomtc@hotmail.com
thanks
bruno

Sorry Rolfewiz,I was absent from this forum for some time so I didn´t realize your offer.
Thanx a lot anyway,but I don´t really need
your code ´cause I already have a good source for this kind of thing(found a link on Opengl.Org someday but I cannot remember the location,so if you´re interested I´ll try to find the link again),the only problem is the Keyframing Part!

[This message has been edited by XBCT (edited 05-07-2000).]

I’m writing a camera-animation tool in which I think to solve the key-frame parts. But I’m not that far this moment (but hopefully very soon). My main problem is displaying 2d curves in opengl (and extract interpolated value form them - this is how I try to solve it). I did a lot of animations - so finding a nice key-framing method should not be the main problem. If you - or anybody else - just get me into displaying 2d curves in ogl - I share the rest with you as soon as I progress.

[This message has been edited by Iebele Abel (edited 07-04-2000).]

Keyframe animation isn’t that hard.

For each frame, you have to determine if you are exactly at a keyframe, in which case you draw that particular frame. Else you have to “tween” the frames.

I’m assuming you store all the vertexes as an array with indexes from 0 to N-1. I’m also assuming that your animation has M frames (from 0 to M-1). Thus, you can tween like so:

// This is just pseudo-code, it won’t compile as-is

class shape
{
vector<vector > m_verticies;
};

shape::draw()
{
float tween = time_since_start*speed/1000.0;
int base = floor(tween);
if (base == M-1) goto animation_done;
if (base == tween)
{
draw(m_verticies[base]);
}
else
{
draw_tweened(base, base+1, tween-base);
}
}

It is very important that the “same” vertex has the same index for each keyframe!!! (I e, if the tip of the nose has vertex index 34 for the first frame, it has to have index 34 for all frames!)

draw_tween() is implemented like so:

shape::draw_tween(int first, int second, float delta)
{
// optimize your storage the way you see fit
vector v;
for (int ix=0; ix<N; ix++)
{
v.push_back(m_verticies[first]*(1.0-delta)+m_verticies[second]*delta);
}
draw(v);
}

I’ll leave the imlementation of class vertex and draw() to your imagination. (They should be fairly obvious.)

[This message has been edited by bgl (edited 07-03-2000).]

[This message has been edited by bgl (edited 07-03-2000).]