MeshTransfer (update 10.02.12)

The MeshTransfer Addon creates a mapping between meshes of arbitrary topology.
It then takes mesh data (vertex colors, vertex weights, shapekeys and an experimental vertex displacement driver supported atm.) from a “source” object and transfers the data to a “target” object.
Original thought is from Ben of GeckoAnimation and I picked up the idea as my first real Addon. It is still work in progress, so it’s not production-tested, propably has bugs, but how do you say it: “release early and often” :slight_smile:

current v0.2 here
v0.1 here

As there is no documentation yet some quick notes about usage:


to install the Addon :
(a) just open the (unzipped) file in Blenders Text Editor and hit “Run Script” or
(b) go to User Preferences > Addons > Install addon

the Addon registers a panel in Object Data Properties > MeshTransfer

“Target object” is your currently selected object (the object that will receive the data, aka the object that is transfered TO)
“Source object” is the object you want to transfer data FROM

In order to transfer stuff you perform 2 steps:

(1) “Create Vertex mapping”

The mapping goes over the TargetObject’s vertices and finds out the most appropriate (aka closest) vertex/vertices on the SourceObject to copy from.

First pick a SourceObject.

Line up the SourceObject and the TargetObject in 3D-space as good as possible.
The mapping will be calculated based on proximity in 3D-space (UV-space may follow) so the better the two objects line up, the better the mapping will be. If the two objects are too different in form here’s what you can do as a workaround: create a shapekey on the target and only for the time of the mapping tweak the targets verts to line up with the source as you wish (after the mapping you can throw away that shapekey to go back to your original form).

Most of the time you will want to have the options “transforms” & “modifiers” turned on. This will compensate for objects with e.g. different scaling and will also take modifiers (if applicable) into account. In other words: it tries to make the mapping see what you see in the viewport when you line up the objects.

As an option “Average verts” it allows for mapping more than just one “closest” vertex but instead a list of nearby vertices along with their distances. Choosing more than “1” here will interpolate all the “nearby vertices” according to their distance and in practice has an effect of blurring. This also comes in handy when the target has very dense topology and the source is is very light. “Average verts” has a soft limit of 50 but you will be able to type in larger numbers if really desired. Larger numbers take longer! (for the creation of the vertex mapping as well as actually doing the transfer)

Depending on the density of the meshes the creation of the mapping may take some time.

Once the mapping is done you can move Source and target away from each other again if you like. Transfer should still work in that case.

A mapping can also be deleted again, the button will change automatically. This gets rid of all associated data for you.

(2) “Transfer”

First choose what to transfer (Vertex Colors, Vertex Groups, Shape Keys and or an experimental vertex displacement driver

Choose to transfer a specific data layer or to transfer all available at once.
(When only transfering a single data layer > choose the one on the Source)
“Names as on Source” will transfer to equally named data on the Target. Leaving this OFF will generate descriptive names like “MeshTransfer [SourceObject] [SourceShapekey]” on the Target or will let you choose an existing layer (if only a single layer is transfered)

“Overwrite existing” will overwrite an equally named layer on the Target (otherwise will be left alone)

When specifing an optional “Target Mask” vertexgroup you can multiply the transfer by the weights of this vertexgroup. It should do the same thing than specifing a vertexgroup in most modifiers.

For the experimental vertex displacement it sets up a driver that transfers the movement of source vertices over to a (automatically created) shapekey on the target. So however far a vertex on the Source moves (caused by e.g. armatures, other modifiers or shapekeys) the corresponding vertex on the Target should also move. Comparable to a lattice or mesh deform maybe - though worse in performance propably… This should work in animation as well and hopefully will be helpful - for example in transfering existing facial animation.

Hit “Transfer”.
Depending on the density of the meshes the transfer may take some time.


Futher dev:

  • DONE: shapekey transfer
  • DONE: option to transfer all at once
  • DONE: option to keep names
  • DONE: option to specify Target data layer (if only a single layer is transfered)
  • will this work with bmesh?
  • UV-space proximity
  • transfer from/to TEXTURE as well?
  • I’d also like to look at converting this to a modifier in C
    (think of the VertexWeight modifiers - or even a mode of DynamicPaint?)

If there’s any questions/bugs/improvements, just shout at me. [btw. I was working on 2.61 SVN and didnt test on anything else ;)]
This was fun to do, let me know what you think.
I’ll try to put together a little video showing what can be done with this the next days.

Attachments

lichtwerk_MeshTransfer.0.2.zip (10.7 KB)

2 Likes

It seems to be really useful! Just a suggestion: alling the two objects could be a time loosing. Can you made an option to take the local vertices coordinates to comparer the two meshes? For example, in your image, if the heads pivots are both in the neck, it could be enough for the script to understand what vertex associate between the meshes. Don’t know if I explained well. Sorry for my english!

@Lell: if both objects have the pivot in the same spot (neck in your case) and are the same scale it should work like you suggested when you turn off the “transforms” option. Can you give it a try?

Also looking into transfering UV Maps now…

update v.0.2 (see first post):

  • shapekey transfer
  • option to transfer all at once
  • option to keep names
  • option to specify Target data layer (if only a single layer is transfered)
  • reorganized GUI a bit

next up: UV Maps now…

is this usable as for morphing 2 meshes?

Awesomesauce! I’m itching to try out the shapekey transfer. I’ll post some tests later hopefully.

this is absolutely awesome!!! You’ve brought the blender some GREAT tools that users of Maya and other packages have come to appreciate greatly(for any type of character modeling & animation work).

If you’re interested in being able to reapply vertex id’s, Oscuart has a cool python tool to do so, heres the video link to it in action:


this is beyond helpful when you export a mesh, or duplicate one, and the vertex id’s get mangled, yet you want the exacter vertex positions to be applied as a shapekey(which usually only works when the vertex id’s are identical). it allows you to re-apply the mesh with the improper vertex id’s, to the base mesh again, as a shapekey. Looks like you have a loose version of that in here now, based on vertex positions; this script could help you offer the option to have exact vertex id’s matched too, if you chose to add such a cool feature.

also, on Oscuart’s page, http://www.oscurart.blogspot.com/ Oscuart has some great videos & scripts offering some of the functionality of your script, but using precise vertex id’s to do copying of weights/shapekeys/ and a ton of other stuff, also mirroring of weights, and vertex positions, & lots more. I only bring this up, this being opensource blender and all, because(if you wanted to) you could likely port/copy/reference any of the hard work Oscuart has already put in, to strengthen your awesome toolset too :-).

Thank you again for your hard work to create this great toolset, I really hope this makes it to trunk once its bug tested. I’ll use this constantly ! :slight_smile:

edit: and if you do ever make this a modifier!!! WOW, that would be VERY empowering for character modelers/riggers. I cant emphasize enough how great that would be. The ability to tweak parameters as a modifier, then apply once perfected, whoa. We’d be able to transfer full sets of perfect tuned weights from a reference mesh(and its rig), and then just tweak the bone positions on any new mesh and have near perfect weighting automatically on freshly modeled meshes, WOW! Please, oh please, make this a modifier too :wink:

I wanted to chime in again, and share a thought. If you did choose to reference/copy Oscuart’s code for MIRRORING vertex weights, it would allow for me to transfer weights from one mesh to another, and then choose which side of the x-axis I would like mirrored on both sides of the mesh that I’ve transferred weights to.
I bring this up, because occasionally, the vertex weights dont transfer symmetrically in MeshTransfer, even when both the source and target are symmetrical & sized very very closely, or especially when once mesh is less or more dense than the other(which is totally understandable) This way, we could transfer weights, then preview in realtime, which side of the axis transferred “better”, and then have that side of the x-axis’s weights transferred(mirrored) to both sides of the target mesh, thus giving us GREAT vertex weights on our target mesh, and none of the current inconsistencies of weight distribution that occassionally happens now un MeshTransfer, since for some reason sometimes one side of the axis transfers better than the other with the current version of MeshTransfer v0.2. This would be a powerful native feature to have in MeshTransfer.

I dont mean to criticize in any way, MeshTransfer is AWESOME!, seriously, I dont know why this hasnt gotten more attention already. I just want to offer thoughts on how to have MeshTransfer be a more solid solution that doesn’t rely on external scripts/addons to be production-ready. Thank you for all your hard work. I cant wait to see version 0.3! :slight_smile:

Hi!

I’m on a job again for the next days, so dont want to promise too much progress for these days

@stvndysn: it’s not meant with morphing in mind

@ben: looking forward to your feedback!

@blenderificus: thanx for looking into this! Can you provide an example where “the vertex weights dont transfer symmetrically in MeshTransfer” or “one side of the axis transfers better than the other”? I’d like to fix that :). If you could send me problematic cases that would help a lot. I will have a look at the oscuart tools again (they are really good! but they work on fixed vertex count, right?) They seem to work pretty good in concert MeshTransfer for you (mirroring after Transfer)? For the time being I’d like to fix problems (e.g. asymmetry) in MeshTransfer first before implementing workarounds (I hope to get to the point where mirroring shouldnt be needed). If that doesnt work out, sure, this (mirroring) could be implemented. Thanx again for trying it out!

P.S.: here is a quick hack at UV Maps (this still fails miserably in many situations - see below, esp. seams, need to find a way to improve that)

http://graphics-engineer.com/shared_files/MeshTransfer_UVMaps_miserable.png

Cant wait to try this :slight_smile:
Thanks!

HI 2d23d, I have not tried yet your addon but this is a fondamental tool for working with characters,thank you very much!
A Really great addon here:eyebrowlift:

Great tool 2d23d ! I’ve tried it with a character created with makehuman and imported to blender. The character was exported as obj to sculptris.
I sculpt the character with sculptris and export as obj. After importation to blender of obj and use of your addon, the sculpted character could be animated.

It’s a very great addon.

Has there been any new development on this GREAT tool lately?

This is like XSI Gator.
Amazing!!!

Thanks a bunch!.

Are we limited to the same number of vertex on both objects with this tool?

2d23d such a great tool!!! Thanks so much!! I hope you can keep on working on this, it’s an great contribution!! :smiley:

SamCameron: no vertex limit, it’s just geometry independent.

Thanks for the info jpbouza :wink:

Does anybody know if this works with Blender 2.63? I’ve been trying to use it to transfer weight maps from a 10k model to a 100k poly model but after pressing the “Create vertex mapping” button, my CPU usage on one of my core’s goes up to 100% stays there for about 5 mins then switches to another core which goes up to 100% usage then switches to another core etc. I’m not sure if it’s working or not as it’s been doing this for about 30mins?
Would be such a useful feature for Blender, I’ve needed something like Maya’s transfer skin weights maps tool for many projects on Blender.

@Lyndon: I’ve been using it with 2.63 just fine. But, the models were not as heavy as the ones you just described.