Bones

Started by
2 comments, last by Antknei 23 years, 3 months ago
I understand how to use bones in a model ( and build transformation matrixes to move them ) as long as each vertex can only belong to one bone, but the artists I work with showed me in Max how you can assign more than one bone to a vertex with a weight factor. For example, vertex 1 belongs 40% to bone 1 and 60% to bone 2. How do you take this into account when you build a transformation matrix?
Advertisement
I can''t exactly answer your question but I might be able to clearify a little bit what it is doing. If a vertex is attached to one bone then it''s position relative to that bone is absolute. So it is like you stacked two cans on top of one another and then tilt one. There is then a gap between the cans. If you take your arm and bend it there isn''t a gap though. That is because points on the elbow move relative to both bones. The further from a joint the less a point is affected by the other bone. With a point weighted 50/50 then its position is half way between where it would have been if it was attached to one or the other bone exclusively, i.e. rather than 0 or 90 degrees it is 45 degrees.
Keys to success: Ability, ambition and opportunity.
I agree that the models look more real when vertex''s are assigned more than one bone, but you don''t get the gaps that you talked about when you only allow one bone assignment to each vertex. The model just looks more rigid. Thanks for the reply. I am guessing that multiple bones for each vertex is a mathematically expensive process, and that is why games such as Halflife don''t use it.


I just can''t see how to mix the translation matrices together. I can''t believe that if a vertex is assigned 20% to a particular bone and that bone rotates 10(degrees), the vertex only rotates 2. maybe that is all you have to do.
here is the very general formula for deforming a skin vertex with more than one bone...

new_vert = (orig_vert * bone_mat1 * weight1) + (orig_vert * bone_mat2 * weight2) + ... + (orig_vert * bone_matN * weightN)

where...

- orig_vert is the vertex before being deformed
- weight1 + weight2 + ... + weightN = 1.0
- bone_matX is the world transform of the boneX

you can limit the number of bones per vertex to 2 to try to trade off some speed for looks.

if you want no limit to the number of bones per vertex then set a loop to go through all the bones in the system...


clear all vertices to [0,0,0]

for(i=0; i{
for each vertex bone influences
{
vertex += (bone.world_matrix * vertex * weight)<br> }<br>}<br><br>set the skin mesh''s world and local transforms to identity because it is basically using those of the bone system when you calculate the skin deformations<br><br>what I did is to make a SkinController class that knows the relationship between the bone system and the skin mesh. Your bone system will most likely be controlled by a KeyFrame Controller. So the order you want is…<br><br>KeyFramer->Update() —&gt; moves bones around —&gt; SkinController->Update() —&gt; moves skin around.<br><br>Of course, you may have to modify things around for your system. If you want more info on this stuff look at<br><br>"Game Programming Gems". Deloura.<br>"3D Game Engine Design: A practical aproach….". Eberly<br><br>Those 2 books alone got me to where I am today.<br><br>Now… to get data out of 3DStudio (Character Studio) your kinda on your own - thats what I am working on now. Take a look at<br>www.codercorner.com/flexporter.htm<br><br><br>good luck!<br><br>if you have any more questions, email me and i can send you some code snippets… brianhoffer@email.com<br><br>-BrianH<br> </i>

This topic is closed to new replies.

Advertisement