#### Archived

This topic is now archived and is closed to further replies.

# Bones

This topic is 6513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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[i].world_matrix * vertex * weight)
}
}

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

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...

KeyFramer->Update() ---> moves bones around ---> SkinController->Update() ---> moves skin around.

Of course, you may have to modify things around for your system. If you want more info on this stuff look at

"Game Programming Gems". Deloura.
"3D Game Engine Design: A practical aproach....". Eberly

Those 2 books alone got me to where I am today.

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
www.codercorner.com/flexporter.htm

good luck!

if you have any more questions, email me and i can send you some code snippets... brianhoffer@email.com

-BrianH

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633270
• Total Posts
3011156
• ### Who's Online (See full list)

There are no registered users currently online

×