0
\$\begingroup\$

I'm currently developing a game using OpenGL and my dev has run into a small problem. I'm having some problems understanding how "array of vectices works with animated object". For example, if we have a 3D object is there a different array for each frame of the animation or is there an instruction which does the animation ?

So, does a 3D objet file look like this :

Idle Frame 1 mouvement animation Frame 2 mouvement animation Frame 3 mouvement animation

All of the above being big array containing vertices and texture coords ?

Thank you for the answer and explaning this thing to me !

\$\endgroup\$
  • \$\begingroup\$ that's one good way. Have all the data already up there and draw different sets of data from it. Or you can modify the vertices in place by uploading new ones. Or you can have matrices that effect certain vertices and not others via the vertex shader... There are many ways to have different frames be different. \$\endgroup\$ – david van brink Apr 22 '16 at 3:45
  • \$\begingroup\$ this is what I thought, thx, What I think i will do is setup an array of index pointer connected to each different frames possible that way, just before I draw I can check the state of the objet and choose the pointer I want to use for the draw. For example, Idle. \$\endgroup\$ – Gabriel Roy Apr 22 '16 at 4:18
3
\$\begingroup\$

There are two common ways to animate something.

One of them is what you described: morphs or per-vertex animation. You have number of different models representing each frame in your animation, and you interpolate the position of the vertices individually between the previous frame and the next to achieve smooth animation. This technique is usually applied in facial animation or other small details. (Interestingly, it also formed the entire basis of animation with Quake 2 and Quake 3's MD2 and MD3 model formats.)

The other technique is the far more common skeletal animation, where you have a single model in a reference pose, and a "skeleton" consisting of "bones" which the vertices inherit the transformation of, and which bone they move along with depends on which bones the vertices are assigned to using "weights" given to each vertex.

\$\endgroup\$
  • \$\begingroup\$ so like, by moving the skeleton, the vertices would move around so in the file there is The outside vertices with data like, where they are bind, to which bones they are bind and at which distances and you have the skeleton itself which move abit during animation ? \$\endgroup\$ – Gabriel Roy Apr 22 '16 at 8:09
  • \$\begingroup\$ @GabrielRoy Yes \$\endgroup\$ – Bálint Apr 22 '16 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.