Bitplane: yeah that sounds good.
Does anyone have some pseudocode which explains how the SkinnedMesh handles the weights, cause it seems to be quite strange and if it really works the way i think it works, we might run into a severe performance problem. Is the way the SkinnedMesh uses weights adapted from the B3D modelformat? If it is then we need to implement a new mesh, converting the MD5 joint data to B3D joint data would create a severe performance impact if it is possible.
The B3D format uses a main model in which every vertex is affected by several joints according to a weighting factor. The MD5 format uses different vertices (called weights) which in turn are affected by a joint to construct one "real" vertex like this:
Code: Select all
for(int j = 0; j < meshes[curmesh].vertices[i].countWeight; j++)
{
MD5Weight weight = meshes[curmesh].weights[meshes[curmesh].vertices[i].startWeight + j];
MD5Joint joint = frames[0].joints[weight.joint];
core::vector3df rotatedWeight = weight.pos;
joint.orientation.getMatrix().rotateVect(rotatedWeight);
vert.Pos += ((joint.pos + rotatedWeight) * weight.bias);
}
So one "real" vertex is affected by many weights, which are affected by the joints they belong to. Every single weight may affect several "real" vertices. In contrast, the B3D vertices are affected by several joints. They are just single vertices not consisting of several weights. Trying to create a relationship which is equal to the one used in B3D models out of MD5 models would be an overkill. So i would suggest writing a whole new Mesh, if the SkinnedMesh Irrlicht uses really works that way.
I hope this post is not too confusing ^^
Greetz
r2