Script for converting skin morph morphs into morpher morphs for exporting into Game engine
I have been trying to develop a script that would convert an additive morph that is applied on top of the skin modifiers into a morpher friendly version which could be used under the skin modifier. I want this so that i can extract my corrective morphs from skin morph and apply them inside of Unreal engine, which only supports standard morphs, not additive ones.
Now my basic idea of making this happen was that i need to recreate the skinning algorithm in maxscript, which i managed to do, and then apply it backwards in the the deformed (corrective morphed) version of the model.
The skinning part of my script works, i store the relative positions of the vertices in the bind pose, then at a different frame where the bones are in a different transformation i read their transforms, multiply the relative transforms of the verts with the bone transforms and average all of the bones affecting that vertex based on their weights and get the final averaged positions for the vertices.
This so far works like a charm, and i get the exact same result as with the skin modifier applied.
My problem now is that in order for this conversion to work, i have to take the final additive morph, and transform the vertices backwards that is apply the transforms backwards so that i cancel out the skinning information and get the pure morph.
So basically i need to figure out the bind pose based on the deformed mesh. How would you go about doing this?
Also please don't suggest that i bind the model in the deformed pose and apply the transformation because that is not the correct way, as it then takes the relative positions of the vertices in the deformed state and makes them the bind pose. Which then when transformed back to the rest pose don't end up where they need to be.
Any idea how to make this happen?