[Addon] MeshTransfer (update 10.02.12)

(ristesekuloski) #21

How come that this tool is not a part of the official builds? It absolutely should!

(lyndon) #22

Thanks for the reply ashasekayi. Yea, the poly count on these models is really heavy. I let it run for an hour before killing it, so unfortunately I didn’t have any success with the transfer. If possible I’d really appreciate it if you could let me know the poly count of the models you’ve had success with and how long (approximately) the “create vertex mapping” option processed for. So that I can work out a rough estimate, for all I know the script could take a day to process, in which case it’s not going to be of much use to me :frowning:
Thanks again for the reply!
Edit: In case you are interested, I later tried a weight transfer in Blender 2.63a from a 7K to a 27K poly model. The results were better than I expected but still needed some tweaking on the high-res model (some edges deformed creating a saw-tooth type pattern, this might be fixable if I’d changed the “Average verts” count to a higher number other than it’s default value of 1 but this would also probably mean longer processing time, maybe?). The only major downside is that this took about an hour on a hex-core CPU, and the characters I need to use this on have a much higher poly count.

(MmAaXx) #23

life saver!

thankyou so much!

(2d23d) #24

Hi everyone!

First of all: sorry for disappearing for so long. I’ve indeed abandoned this project for quite some time before it was even finished – but it’s not dead yet :slight_smile:

What I found is: doing this in Python can only really be seen as a prototype for doing it properly in C (speed being the obvious reason). The current addon code can still be made faster (it doesnt use convenient - and C accelarated - functions like “closest_point_on_mesh” even) and needs some love for the overall design (e.g. it could do better when interpolating values across faces) still. It doesnt surprise me that it doesnt perform well on highpoly meshes. While writing this I was testing on meshes with about 5000 polys and it could already take a couple of seconds there…
But I am happy to hear there is still interest and I have reserved some time now to proceed with this.

That said the main focus will be to make this C operators. Good news: in the wonderful world of opensource this actually already happened in parallel. There is a branch called “meshdata_transfer”. A student called Ove Murberg Henriksen (cyborgmuppet on IRC) works on this (mentored by Campbel Barton) and the transfer of vertexgroup weights - which I guess is the main use besides UVs - is already there (I think there is still a “WIP” label on it but my tests show it is quite functional - and meshes with much higher poycount are actually doable. there is bvh acceleration and it is MUCH faster then the MeshTransfer python addon). So if you are brave and build your own blender checkout “meshdata_transfer”! I am in contact with cyborgmuppet and if my coding doesnt suck too much I’ll be patching this branch with support for VCols/Shapekeys/UVs. This is my first jouney into Blenders C code besides some bugfixing so it wont be there tomorrow but I have some code done as well. Ideally this will end up in something generic so it can be reused for any CustomData layer in blender but we will see…

links for the meshadata_transfer branch:

I’ll keep you up to date if I do improvements on this python addon (I might still use this as a prototype). If you have examples of geometry that causes problems (sawtooth patterns etc.) -> throw them right at me - it’s always good to have these.

Thanx again for your interest

(CoDEmanX) #25

great addon, should replace the not-working copy attribute addon in trunk…

copy attributes did basically what you addon does, but in a really rough manor, and it relied on faces being all quads (pre-bmesh).

even if your python addon is slow, it should get into trunk as soon as possible if it’s stable! A slow addon is better than a not working addon.

Looking forward to a C-implementation :slight_smile:

(lyndon) #26

Hi 2d23d
Thanks for updating us :slight_smile:
You’ve done some really great work on the mesh transfer tool, and I’m really relieved to find out that such a tool exists for Blender as I used to use a similar tool in Maya called transfer skin weights quite often.
The example model I was referring to with the sawtooth pattern is quite a big file (over half a gig) so I probably won’t be able to send it to you. But I’ve included some screenshots that I hope will demonstrate what I’ve been experiencing?

This is a character with it’s head tilted back, on the low-res model the neck area deforms smoothly. But on the model, which the weights were transferred to, it seems that the weights are not as smooth in the same areas (neck, under the arms and other areas). This is with the all the addon’s settings at default, including “Average Verts” which is at 1.

(jpbouza) #27

Lyndon, why don’t you use the low res model as a mesh deform cage for the high res model… you would get far better results that way.

(lyndon) #28

Hi jpbouza
thanks for the suggestion and I appreciate your help :slight_smile: I probably will have to use the mesh deform method you’ve noted if I can’t find a way of transferring the vertex weighting from the lo-res model. This was what I first tried when I couldn’t find a weight transfer tool in Blender. But as far as I can tell the cage requires that vertices of the deformed mesh are inside the cage (i.e. lo-res model) and my high-res model has many verts outside of the area of the lo-res model, which means having to translate vertices on the lo-res model along their normals (away from the surface) so that the lo-res model’s area encompasses the high-res model? Although in this case it’s not too much of a problem, it does mean that some vertices of the cage are going to intersect the clothes the character is wearing. I realize the cage is not going to be rendered but, I imagine the intersections are going to make it difficult to use as a collision object in a cloth simulation. Which means another lo-res character (where I try to match the weights of the cage) just for the purposes of a collision object . It just seems to be alot of overhead for something that could be more easily solved with a weight transfer tool?

(jpbouza) #29

you are right about everything, but if you want your character to look professional, mesh deform is the best way to go. You will never get good deformation with armature modifier alone and this weight transfer thing. That is just not going to work well, as weighting the character with the armature modifier is never enough, you will have to either create hundreds of deformation corrector bones, or create hundreds of driven shapekeys.
With mesh deform none of these is necessary. So, you can just modify the low res mesh and make it work as a mesh deform cage, and use a duplicate for the clothes. Mesh deform is the best way to get organic deformations, specially on such dense meshes.

(3Duaun) #30

@2d23d thank you for the news. This tool is awesome and super-useful! Please keep us updated as you port it to c in the mesh-transfer branch. Do you have a twitter or Google+ account that you will be posting updates on?

(aomeoni) #31

Very impressed.

This in conjunction with the ‘Corrective Shape Keys’ addon has saved me, quite possibly, days of work.
‘Corrective Shape Keys’ had to be used to create a clean duplicate of my mesh for editing, and transfering the 30 or so facial expressions back to that mesh was done in a matter of scant seconds using your addon.

Thanks for this.

(lyndon) #32

Hi 2d23d
I just wanted to update the results I’ve had with MeshTranfer in Blender 2.63a (since my first post on this thread).
Firstly, thank you most graciously for creating a truly valuable addon to Blender (certainly for me :slight_smile: ). I’ve found it to be one of the most useful addons for my work in Blender to date. I’ve been using it to transfer mesh data from a low poly character to a high res model. Although I have not had an opportunity to document my experience with the tests I’ve been doing, I hope to do so at some point when I have more decent results to show. Currently I’ve been using it on a character, which I’ve been documenting the development process of on my blog.
The two main features I’ve been experimenting with are transfer of weight painted mesh data and shape keys.
The realtime model which is the “Source object” (in terms of MeshTransfer) is <8k polys and the high res model is about 28k polys.
If you are interested to know about how your addon is performing with such models, I’ve included a rough outline of processing times per MeshTransfer opperations.

  • Creating a vertex mapping between these two objects does not take a lot of time and completes within about 2 minutes.
  • Transferring Weights between the two objects takes approximately 2hrs
  • Transferring Shape Keys between the two objects takes about 30 seconds (for two shape keys)

The results have been very usable, and certainly a big time saver.
As you can see from the above timings the transferral of weights is the most time consuming task, once completed the resulting weights on the high res mesh have not required any further painting. I consider this to be an improvement on a similar MEL script I used in Maya, which would almost certainly always require additional tweaking on the high res model after weight transferral was completed.

One of the things I noticed with regards to weight transferral is that only one of my CPU’s cores seems to be processing the transferral operation at a time. Would making this addon multi-threaded contribute to speeding up the processing time at the expense of stability? I’m not a programmer but I’d be interested to know if there is anything I can do help improve the time it takes to process a weight transfer operation?
As you can imagine waiting a lengthy period of time for the weight transfer to complete, left me wondering if Blender had crashed as it had become unresponsive, however my system monitor indicated that the status of Blender was normal. My final question is if you would consider adding a progress bar to the info view, as is the case with other process intensive tasks in Blender?
Once again thank you most sincerely for the time you have already put into this addon, which has now become a permanent feature in my very small (and carefully selected) collection of Blender addons.
If there is anything I can do to help further the development of this addon, please don’t hesitate to contact me.

System specifications on which I’ve been running these tests,
Ubuntu 12.04 x64
Blender 2.63a (Blender foundation release)
CPU: AMD 1075t (Hex-core)
GPU: AMD 6850 (1GB RAM)
MeshTransfer 0.2

(yii7) #33

Hi Thank you for this addon it saves a lot of time while weight painting different meshes to same armature.I have tried the addon on 2.63a and it seems vertex color transfer fails

on line 192 and line 1004 operator >

“LicBuildVertFaceDict” for oObject.data.faces

AttributeError ‘Mesh’ data has no attribute ‘faces’

and a suggestion can you improve interpolation or precision in some manner so we can have better weight transfers .Thanks again for the super addon :smiley:

(John.Delannoy) #34

Weight transfer was a success. Awesome script, You’re a rockstar.

(Italic) #35

I would love to know if this addon has had any development in the last few months. I’ve been updating the addons_extern repo and came across this particularly useful addon. Would love to see it come back to life. I certainly have an interest, being a character artist.

I know there have been some rough changes in the Blender API in the last release, but I’m hoping you could possibly check it out for us. I’m also not seeing a whole lot of information on the meshdata_transfer branch and don’t know if it got anywhere.

Anyway, looking forward to hearing back about it. Would love to keep this available to everyone subscribed to the SVN/git repos.

(oscurart) #36

Hi, can you talk with meta-androcto about add to contribs?
This is very cool!

(motorsep) #37

Can this script transfer vertex weights from original mesh to lower poly iteration of the original mesh (for LOD meshes) ?

(mozzy69) #38

Don’t mean to hijack this thread or anything like that, but I also wanted to point out that weight transfer has been included in Blender since version 2.65.
Select object, then select active object (to transfer weights to) > go into Paint Weights mode > in the 3D viewport click Weights > Transfer weights
selections do not have to have the same geometry as transfer works by proximity (useful for LOD’s)

(motorsep) #39

oh, good to know. Thanks mozzy96.

(johantri) #40

OMG ! this addon is such a life saver!! thank you so much. Also wondering why shapekeys transfer is not included by default in Blender 2.7* :confused: shame. It’s a great feature. By the way. i have to tell everybody about this. Thank you 2D23D! Thank you!