Copy Bone assignment

Blitz3D Forums/Blitz3D Programming/Copy Bone assignment

RifRaf(Posted 2004) [#1]
Does anyone know how to assign a verte to a bone? What I have is an animated model, I want to cel shade it, but when he moves teh flipped mesh for shading does not move with him(animation) so I need to assign each vertex of the cel mesh to the same bone as the vertex on the original mesh?
in other words copy the bone assignment from the original to the cel mesh. any advice here would be greatly appreciated.


Ricky Smith(Posted 2004) [#2]
I'm assuming youre using .b3d .
To find out which bone a vertex is assigned to you will have to parse the .b3d file - this info is not available to the user at run-time.
Every NODE (Joint) that has vertices assigned to it has a BONE\WEIGHTS chunk containing the index of the vertex and its weight which in the case of Blitz3d is always 1 - (no vertex weighting).
You could then assign the corresponding vertex on the new mesh to the joint of their nearest neighbour on the original mesh - they should be in the same position.
To assign a vertex you just have to make an entry for that vertex in the WEIGHTS list of the joint's node.

Add both meshes together and export the merged mesh with the new info then Reload.

Have a look at the info on the .b3d file format and the .b3d file utilites in Specs & Utils - there's also some good .b3d export routines in the code archives. Also have a look at Peter Sheutz's XML to B3d converter - it shows you how to parse and write .b3d files including weights and animation keys.


(tu) sinu(Posted 2004) [#3]
if your using any of the functions from the code archives all they do is create a static mesh for the model which works good for segmented models but not for boned meshes.


RifRaf(Posted 2004) [#4]
I am using my own function.. got it sorted though, thanks