5
\$\begingroup\$

Looking at websites such as mixamo.com or some game's development systems such as the animation editor for Overgrowth (http://www.youtube.com/watch?v=-RpqbC5-Z0E), i see that the skeleton in these situations is automatically being applied to the models.

I really don't expect (though wouldn't mind) code that does this, but i really am looking for some sort of pointer in the direction, or how they go about this. If any of you have done this, or know how to, please do reply, i don't want to spend the next week trying to crack it, then another to actually code it :P

Thanks all :)

Just for a bit more information, i am in C# working with OpenTK with my own custom model loader, etc. but i can easily adjust any given code / concept to fit with mine :)

\$\endgroup\$
5
  • \$\begingroup\$ What exactly are you trying to do, or need an in-game rigger for? \$\endgroup\$ Commented Mar 25, 2012 at 7:31
  • \$\begingroup\$ I basically just want animation of characters in a game i'm working on, couldn't find any other decent ways of going about it with openTK, so started working on my own rigger and animator. I have the skeletal animation and creation set out, i just need the actual connection to the mesh now. (If you have better animation solutions please do tell :D ) \$\endgroup\$
    – Joel
    Commented Mar 25, 2012 at 11:04
  • \$\begingroup\$ Use Maya, or 3DS Max (I've found Maya to be the best for video game assets). The process of rigging and skinning a character is much more complicated than it appears in the Overgrowth video. Also, directly skinning a character will lead to some strange artifacts in animation that must be solved using a process called weight painting. \$\endgroup\$ Commented Mar 25, 2012 at 17:43
  • \$\begingroup\$ What i want to know is how they would have gone about that process when coding in Overgrowth. I know i can rig/animate etc. in Maya, etc. i would just rather not... (I also am not positive on how to export animations, etc.) \$\endgroup\$
    – Joel
    Commented Mar 26, 2012 at 5:23
  • \$\begingroup\$ Sure, I'll throw an answer together with what I know about the process. \$\endgroup\$ Commented Mar 26, 2012 at 19:51

1 Answer 1

9
\$\begingroup\$

So to start, I'll just give brief overview of how skeletal animation works, which will lead in nicely to how a skeleton is applied to a mesh.

Character animation can be defined as the deformation of the 'skin,' or geometry that makes up the character, over time. The extremely naive way of accomplishing this is to individually move and keyframe each vertex in the model. This would results in the most control and perhaps visually appealing results, but it would also take forever for an animator to do his job. So the skeleton method was established (note that there are also other ways to animate such as implicit functions, but the skeleton method is most convenient for games).

Each joint of a skeleton exerts a certain amount of influence over the vertices of a mesh, and is represented as a matrix which will perform a linear transformation. In a rigid bind, a vertex can only be influenced by one joint. This is good for a robotic character, but for a humanoid character, we need smooth skinning, where a vertex can be influenced by multiple joints. And to calculate new positions of vertices as the joints move, we linearly interpolate between the new positions of the vertices calculated by multiplying by the matrix of each joint that influences them, and weighted by the amount of influence of those joints.

For more information, a good starting point is the Wikipedia article on the subject.

Now, given all that, your goal is to calculate what joints influence each vertex, and with what weights. The reason I suggested using modeling software which already does this for you (Maya, 3DS Max, etc.), is because this is quite a hard problem to do properly in one go, but all the same it's probably fun to try to implement.

What you need to do is for each vertex, figure out, perhaps, which joints are closest to it, and depending on their distance, assign a weight to that joint for that particular vertex. There are problems that come up though. For example, what if when you skin the model, the wrist joints are close to the hips (the characters arms are hanging)? The result will be that the vertices of the hip are now influenced by the wrist joint, and when you move the model's arm outwards, the hip will deform awkwardly. A naive way to remedy this might be to raycast between each vertex and potential influencing joint, and if there is an obstruction (i.e, the ray does not travel entirely inside of the model), then that joint cannot influence that vertex. Again, this is not true in all cases, and finding a general solution is difficult.

Furthermore, there are difficulties in assigning weights to joints appropriately. Even professional grade modeling and rigging software, such as Maya, cannot do this perfectly, and this is why the job of weight painting exists. Other skinning algorithms, such as Dual Quaternion Skinning, alleviate the need for this, but do not eliminate it entirely.

A couple of additional implementation notes: the sum of the weights on joints for a particular vertex must be 1. Also, the typical number of joints that influence a single vertex in the industry these days is 4.

In sum, the concept of applying a skeleton to a model is quite easy to grasp and implement at its most basic level, but the details and corner cases of doing it properly are what makes it such a hard problem.

Hope this helps, and good luck :)

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .