I’m trying to determine (find) the bone/skin weights for a mesh that has been subsurf’d. If myMesh has the original info (control cage) and if I use:
ssMesh = myMesh.GetRawFromObject(myMesh_ob.name)
ssMesh then has the subsurf’d data - well - much of it.
I can get the verts and normals of the subsurf’d mesh - cool.
getVertexInvfluences() - requires ssMesh to be linked. When I link it to a new object I get an empty list for influences.
getVertsFromGroup(…) - returns the same list as with the original mesh.
I’m guessing that GetRawFromObject gets the “renderable” representation of the mesh in it’s deformed, modified state. That would explain why I get the data that I do and since it’s already deformed, why would it need to have the influences…
But since the subsurf mesh is displayed in the 3d window the info is somewhere. I just can’t find the access to it, if there is one.
My tragic fall back will be to create a dictionary of the old verticies by physical position in 3space and then match the new ones to the old ones finding the closest old vertex and take the influence set of that old vertex. This just sounds slow… (order n(subsurf) * n(old)) and not all that pretty at the joints…
I have no idea how to do what you’re trying to do.
But since the Subsurf modifier cannot be moved above the Armature modifier in the stack (“Cannot move above a modifier requiring original data”), my guess ??? is that bone-weights stay the same regardless of whether a subsurf is applied or not ???
Since you’re familiar with the vert/weight/bone methods, would you mind taking a look at this thread I just started ? Maybe it’s something really simple that you could code in 5 minutes vs 5 hours for me
Yes, the bone weights do, but the verticies don’t. That is to say the subsurf has a pile more verticies than the original mesh and even the original ones don’t really end up in the same place.
The new modifiers stack in development will support this.
Any idea what that means in human years? Is that something that will be available soon or a ways off?
I have implemented my fallback plan with sketchy results. I need to check the code further, but the model looks perfect until it bends and then it looks like it tears. Actually, I think that the real problem is that the mesh is sort of inside out and some faces get culled. If I turn off culling in mview, the tears go away.
It would be great to be able to complete the subsurf export I’m working on even if the output wasn’t perfect, as it would save a lot of work producing development models that could be made perfect once they were finallized.
I think that I really should apply some reverse matrix to the getraw verticies to put them back into local space, but I’m not sure exactly what transforms are applied to go from myMesh.verts to getRawFromObject(myMesh_ob.name).verts.
Its a gsoc project with 3 weeks to go. hopefully it will be finished (I think the parts your looking for are alredy finished) - so possibly for teh next release.
Thanks Cambo. If I don’t beat this quick, I think I can wait then.
If anyone knows the math for translating from mesh data to raw data that my solve my problem…
I suspect it’s something in the form of:
rawVert = meshVertobjMatarmatureMat*worldMat ???
and the reverse would be:
meshVert = (((rawVert *worldMat.inv) * armatureMat.inv) * objMat.inv
Can anyone correct this and set me (and my mesh) straight?