[Bf-python] formulas for Armature deformation

Jordi Rovira i Bonet jordi.rovira at ima.udg.es
Fri Jun 6 15:43:57 CEST 2003


Jacek Popławski wrote:

>I was trying to imagine what will be needed in character animation exporter. I
>am interested how to display animation in 3D engine, so I need to know formulas
>to calculate mesh after armature deformation.
>
>I understand that vertex has it's "static" position in mesh. Vertices are in
>any number of vertex groups, and have weights. Bones have their position and
>orientation.
>
>I think to calculate final position one need to use loop like:
>
>position=vertex.StaticPosition;
>for(i=0;i<ngroups;i++)
>{
> position+=bones[i].influence*vertex.weight[i];
>}
>
>1) Am I right? Or is forumula completly different?
>
In my opinion you'er almost right. You have to accumulate the relative 
position for each bone ponderated byt he weight like you suggest, but 
initializing with 0,0,0 instead of the static position. Weights usually 
(but depending on animation type can be different) have to sum up 1.0

>2) How to calculate influence? Is it just position (or change from initial
>position) of some point laying on bone?
>
i think it's only a position, but again there are variations.

>3) What data will be available in Armature module? Will orientation of bones be
>in world space or parent space?
>
Now, you can access the bone hierarchy and orientation in loc,rot,size 
form, i don't know if it's relative, but i would say it is not. If it 
works like the object transformations, then it's even more complex and 
to be usable, matrices will need to be made accessible, and use them 
instead of the curent transform.
The vertex weight is also accesible. If you query for the bone influence 
in a vertex (there's a function in nmesh) you get a list of pairs (bone 
name, weight (0.0-1.0) ) but the sum of weight here is not 1.0, you'll 
have to scale for each vertex to use the formula you wrote.

(bandoler)




More information about the Bf-python mailing list