1
$\begingroup$

I have a mesh with armature modifier (active+posed) and wish to do some modifications with vert coords (after armature deformations) saved in shape key on that mesh. But currently it seems not possible - shape key contain coords before modifiers and armature can change each vertex in unpredictable manner. So to save final coord back into original mesh coord (on each vertex) - i have to revert armature deformations some how… and this seems to be generally impossible //

In other words - for every given vertex coord, after all deformations (armature) and after applying some custom movements i need (i can calculate them only on final mesh) that i need - i need to calculate ORIGINAL coords (that can be saved in shape key) so they will give me my final position after applying armature.

Interestingly enough, Sculpt mode manages to do this somehow - you can sculpt posed mesh with active shapekey and it will put into shapekey proper position related to undeformed mesh. Not the coords that can be seen on screen.

Is it possible to do the same in Python? May be there is a way to do “sculpted translate” for vertex, that will do all the revert magic? any suggestions welcome

$\endgroup$
  • 1
    $\begingroup$ This old addon has some techniques for reversing the transforms: archive.blender.org/wiki/index.php/Extensions:2.6/Py/Scripts/… $\endgroup$ – Sazerac Apr 29 at 2:07
  • $\begingroup$ thanks, i see this script "bruteforce" verts positions by checking different initial positions to get right final position... So its kind of guided guess-work. While this should work - its an overkill imho. although if there is no other options... But sculpt tool definitely has this revers-transformations, without guess-work stuff? can it be accessed from python? $\endgroup$ – IPv6 Apr 29 at 6:11
  • $\begingroup$ Ok, I haven't actually read the script. I though it said there was a general version and an armature specific version included. The algorithm used for standard armature deformation is called linear blend skinning and I think should be able to be reversed by inverting bone transform matrices and applying them along with the weights in appropriate order. Preserve Volume option uses a different algorithm and is trickier. $\endgroup$ – Sazerac Apr 29 at 6:24
  • $\begingroup$ I had another look and the unposeMesh method should have the relevant details. Note that this addon is bundled with blender as animation_add_corrective_shape_key.py $\endgroup$ – Sazerac Apr 29 at 6:30
0
$\begingroup$

Answering own question: Ended up by applying deformations as displacement with custom texture AFTER armature… shapekey is essentially just a displacement for verts, after all, and making this displacement after armature make more sense. and easier to implement (just baking verts shift into packed image)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.