Correspondence between vertices coords in Blender and MH

MakeHuman python API, python plugins, etc

Moderator: joepal

Correspondence between vertices coords in Blender and MH

Postby Iburenko » Wed Aug 12, 2015 4:09 pm

Hi!

Is there connection between numbering vertices (and coordinates of these vertices) in Blender and MH? What do I mean?

If I want to know vertices' coordinates in Blender I type
Code: Select all
import bpy
obj = bpy.context.object
mesh = obj.data
mesh.vertices[10030].co


and for this example I get (3.2936999797821045, -0.42649999260902405, 3.812299966812134)

So I expect to get the same data in MH, so I type (in the Shell):
Code: Select all
human = G.app.selectedHuman
mesh = human.mesh
mesh.coord[10030]


and I get (3.49353361, 3.51263309, 0.48666668).

What is the difference between "coord" and "orig_coord" array? And the most important question for me is: are vertices from Blender and MH with the same index exactly the same in the mesh? What array in mesh I should use?

Thank you!
Iburenko
 
Posts: 8
Joined: Fri Mar 27, 2015 8:32 pm
Location: Moscow

Re: Correspondence between vertices coords in Blender and MH

Postby ThomasL » Thu Aug 13, 2015 2:54 am

This depends on how the character was exported to Blender. If the character is nude or the Hide face under clothes option is unchecked, and the Smooth button is also unchecked, then the answer is yes. However, clothes may remove body vertices beneath them, and smoothing quadruples the vertex count, so in that case the correspondence is lost.

The MH mesh also contains helper geometry which is used for clothes fitting. If you need that, select Helper geometry when exporting. Helpers have higher vertex numbers than the body, so they can be excluded without affecting the body numbers.

A mesh loaded with MakeClothes always respects vertex numbers. Otherwise MC would not work.

Some Blender importers, e.g. .obj, has an option to keep vertex order. Use that.

The coordinates are often transformed since Blender and MH use different conventions: Z up and Y up, respectively. But that again depends on the importer settings.
ThomasL
 
Posts: 1139
Joined: Tue Sep 15, 2009 2:46 am

Re: Correspondence between vertices coords in Blender and MH

Postby duststorm » Thu Aug 13, 2015 9:15 am

MakeHuman exports ensure that the vertex order is kept, if you have the options set as Thomas explained.
But that does not yet mean that the (Blender) importer respects this order of vertices. For example, in the Wavefront OBJ importer you need to select the "keep vertex order" option before importing, or the vertex order is rearranged.
MakeHuman™ developer
User avatar
duststorm
 
Posts: 2569
Joined: Fri Jan 27, 2012 11:57 am
Location: Belgium


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest