modification for current release MHX2 exporter

Discussions about MHX2 and other plugins that are developed outside the scope of MakeHuman. Note that bug reports should go to the respective code projects and might go unseen here.

Moderator: joepal

modification for current release MHX2 exporter

Postby punkduck » Fri Jan 18, 2019 9:21 pm

Hi

I just feel that I have to support all people using triangles and clothes in MakeHuman but then wonder why after exporting the mesh with mhx2 does only work without subdivision. Also the system crashes sometimes when you select more vertices using e.g. CTRL-NUM + ...

It is simply not correct that triangles can't be sub-divided. Here is a simple Blender sphere of triangles smoothed. By the way: It is one of the deterministic algorithms to generate Quads from triangles, although you now have more geometry instead of less.

subdividing_tris.png


The reason is, that MakeHuman inside changes triangles to quads. But instead of having four vertices A-B-C-D you now have A-B-C-A ... so vertex A twice. Inside in MakeHuman that does not create trouble. Depending on the way it is imported to Blender you can have trouble. The used routine (in Blender) from_pydata does not do any tests on this kind quads and accepts them. But now the neighbor could be your own vertex A ... you get in an endless loop and the systems freezes, the reason why CTRL-NUM + does not work. Subdivision surface also does not work on identical points. ...

But from_pydata also accepts triangles. So why not change the exporter to create triangles again? Inside the current version in MakeHuman you only can determinate a triangle by comparing the first and last vertex of the quad, so you have to do it for each quad. (The new version will hold the information that the source was made from triangles). But it works for the current one as well.

If you want replace it you can do that on your own risk. So save the old files before ...here is the fix, which must replace mh2mhx2.py in 9_export_mhx2 directory:

mh2mhx2.py
(16.63 KiB) Downloaded 69 times


If you need meshes with more than 100000 vertices like we had for some hair, you should also replace the Json-Writer (works up to 1000000 now).

save_json.py
(4.39 KiB) Downloaded 59 times


As small fix. It avoids vertex number 100001 to be converted as 1E5.

With this change I had no problems after loading tri-meshes in Blender then, especially the crashes are avoided.
User avatar
punkduck
 
Posts: 691
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Return to MHX2 and other plugins developed outside MakeHuman

Who is online

Users browsing this forum: No registered users and 1 guest