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”
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)