Vertex Bone Assignments in Ogre

Problems building or running the engine, queries about how to use features etc.
Post Reply
utgames
Gnoblar
Posts: 19
Joined: Thu Feb 24, 2005 7:05 pm
Location: Austin, Texas

Vertex Bone Assignments in Ogre

Post by utgames »

I am trying to debug an exporter application that I am working on. It looks like the vertex bone assignments are exporting -- but when I try to convert the binary file back to .xml, I don't see them. Is there some reason why the .xml file would not have them, but the .mesh would?

Here is the code where I'm setting the bone assignments.


for (int h = 0; h < env->GetVertexWeightCount(); ++h)
{
VertexBoneAssignment vertAssign;
vertAssign.boneIndex = boneIdx;
vertAssign.vertexIndex = (int) wtList[h].m_fVertexIndex;
vertAssign.weight = (Real) wtList[h].m_fWeight;
sm->addBoneAssignment(vertAssign);
}

Getting a .mesh file size of 75K without the bone assignments, and approximately 112K with.... but the .xml files coming from the xml converter are identical... no vertex assignments. Is there anything else I need to give Ogre other than running the 'addBoneAssignment' function to tell it that I have bone assignments?

Haven't got to serializing the .skeleton yet... but I'd like to get one piece working at a time.

Thanks in advance for anyone's help.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

I see you're adding the bone assignment to the SubMesh, does the SubMesh have dedicated geometry? If it's using shared geometry of the Mesh then this won't work, you should be assigning bones in the parent Mesh.
utgames
Gnoblar
Posts: 19
Joined: Thu Feb 24, 2005 7:05 pm
Location: Austin, Texas

Vertex Bone Assignments

Post by utgames »

Thanks sinbad for replying to my message.

I was able to get the assignments to serialize with the mesh. It turns out that I had neglected to run the "setSkeletonName" function.

Yes, I am using dedicated submesh geometry. Nothing shared.

However... and there is always a however in any programming work... my mesh crashes when I try to load it. It causes a failed assertion.

I am thinking -- it must be because when I created those additional vertices to account for multiple normals at a vertex, I have to also make additional vertex bone assignments for those additional vertices? Presumably copying over the same assignment and weights as the collocated original vertex?

Sorry if that sounds confusing. But say for example I had 300 vertices before expanding all the normals -- and I had 411 afterward. Then I should have 411 vertex bone assignments? Or do I just need the 300?

Thanks so much in advance for anyone's help.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Re: Vertex Bone Assignments

Post by sinbad »

utgames wrote: I am thinking -- it must be because when I created those additional vertices to account for multiple normals at a vertex, I have to also make additional vertex bone assignments for those additional vertices? Presumably copying over the same assignment and weights as the collocated original vertex?

Sorry if that sounds confusing. But say for example I had 300 vertices before expanding all the normals -- and I had 411 afterward. Then I should have 411 vertex bone assignments? Or do I just need the 300?
Sounds perfectly normal, and yes you do need 411 vertex bone assignments, not 300; copying the assignments when you copy everything else is indeed the way to do it.
Post Reply