Transfer vertex order from one object to another
Would be awsome to have a way to transfer the vertex order between objects with the same vertexcount. So that you can transfer uvs and blendshape between characters, and even have a separate blendshaped rigs. Handy when you have a lot of characters and need some sort of modular building and combine bodyparts while keeping weightpaints and stuff :) youtube.com/watch
12 Comments
Holds up nicely in 2.75 in full film production :)
I tried writing a Python addon to do this once... it is not an easy task.
How would it know which vertex to map to which position?
Presumably the meshes are not the same anymore, so how would it know what maps where?
Have ypu considered treating this as a retopo task?
Take the mesh you which to be "common", and create a shape key where the verticies lie on the surface of your new character in the way you want. Voika, now you have both characters sharing the same vertex order.
* @David Jeske * In maya you select 3 verts on one mesh and then the same 3 on the other, then it figures it out and names them the same, but maya is so unstable and slow so it would be nice to be able to have my entire character modelling workflow in blender. Yes but retopo wont allow 15 characters to blendshape with each other, or share the same textures/uvs, while at the same time isolate bodyparts and then rejoining them, while keeping all this info intact. Yes wrapping one to the other could be a solution, but it takes a lot of extra steps. If I have a "fat" character and a "skinny" one, and I want to blend those shapes into a 3rd character, it would be a lot easier just to transfer vertexorder and then blendshape instead of having to move to same worldspace, add a shape and blend it, wrap it to the otherone and then blend back, plus with wrapping, it will likely explode in tight spaces like the lips so a fair ammount of cleanup is probably to be expected as well.
* @Mattias Lind * It looks like blender python can reorder verts with
bm.verts.index_update(), so assuming this reorders all associated data, it may be possible to make a python addon that does this.To clarify..
The objects need the same vertex count AND mesh topology.
Im still curious....
How would you have multiple characters with the same mesh topology, unless they are based on the same original mesh (and thus would have the same vertex order)?
You mentioned splitting and joining body parts. Why split them, rather than always keeping them whole (and thus preserving vertex order), and working on them with hide / masks / shape keys?
I think that video talked about creating a uv map on a split piece.. how does that uvmap get converted? It seems like one would have to duplicate the base, delete the verticies corresponding to the split piece, join that to the split piece to get a "full" model with the uvmap. Then vertex reorder that full model to match the base, so the uvmap for the split piece could be moved to the base. Is that how it works?
If i had this reorder tool, i feel like i would want a good way to lock the vertex count and order of my base mesh to make sure i didnt reorder the wrong way.
* @David Jeske * Blender has a data transfer modifier that could probably help with the UV maps. I think it can combine them if they share a name? Maybe?
Anyways, the Python way of doing it is difficult (I've tried it before). It might be possible to do it by keeping track of the path from vertex to vertex on the "parent" topology and trying to walk through the "child" topology the same way... but that's a pretty complex task in itself. I think you'd also have to do it in two passes, one to find things and another to set the vertex index.
It might even be possible to use a mix of Python and Data Transfer Modifier, you could store the vertex indices as named vertex groups (0, 1, 2, 3, 4, etc) and transfer by topology (using the modifier). Then, you'd just have to correct the vertex indices based on the groups (but beware, vertex groups are associated with vertex index). It's not easy however you slice it.
Has anyone here tried this python script? It claims to do what is requested. Ill try it later today.
gumroad.com/l/copy_verts_ids
* @David Jeske * tried it a couple of weeks ago, seemed to be working fine. zbrush subdivisions tend to mess up vert order so I need it now and then. It'd be great to have something like this integrated in the data transfer modifier, maybe along with UV based vert position copy.
the gumroad copy_vert_ids script is GPL, so if it works well enough it could be added to contrib and shipped with blender
* @David Jeske * Just tried the gumroad addon on 2 cubes with different vertexorders "blendshaping them made them explode" so I ran the operation and tried blendshaping again, and it worked! (not 2.8 yet though, but works fine in 2.79) :D I'll stress-test it through production as well in the coming days and let you know how it holds up, would be awsome to see it shipped with blender :) Thanks for the help! :D :D
* @Mattias Lind * tried it recently on 2.8 it works smoothly now with shapekey.
This would be very helpful to have as standard in Blender as part of the Transfer Mesh Data tool. It's invaluable for those of us working in mixed pipelines. BTW, the addon in this thread no longer works.