powroupi / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.73k stars 278 forks source link

Issue with mesh edges on exports #358

Closed Ademar440 closed 2 years ago

Ademar440 commented 2 years ago

I've noticed a bit of an issue with some exports I've made with MMDTools and it's been a while since I noticed.

Here in this picture you can see some edges as white Shoes_04

Now since I've been dealing with this I came up with a workaround but I'll explain how I did it first

Now this "shoe" starts as a blender object with just one material called "shoes", one object, one material, but each shoe is composed of 6 meshes. Shoes_03

if I export it like this, then those white lines appear. every time.

Now what I do to stop that from happening is separating the shoes into 2 objects, usually the shoes have 6 meshes that overlap, but if I separate them into 2 objects where only 2 meshes maximum overlap at any time, then when I do the export the lines aren't a problem anymore. Shoes_01

This lines not only appear in PMXe but in MMD too, even when I use nvidia inspector to inject a newer anti aliasing.

This also happens with object with multiple overlapping meshes but different material assigned to them.

I hope that this is clear enough since English is not my native language.

powroupi commented 2 years ago

Thank you for reporting this issue. :smile:

But I can't reproduce this issue on my system, I guess there is nothing I can do on mmd_tools side. If you can provide your pmx model, I might be able to find some solutions. :thinking:

As you said, the issue is not happend after separating them into 2 objects, how about re-joining them into 1 object, and re-assigning them to the 1st material and delete the 2nd material, then export to pmx (draw order issue)? Another method is to make sure that no 2 faces of the model are too close to each other, you may delete redundant faces or increase the distance of those faces (z-fighting issue). :smiley:

Ademar440 commented 2 years ago

Yes I can provide the blend file, some details on the file, this is an old blend file that I've been working on since 2016 but I don't know if that is an issue because another person has run into the same problem and his blend files are brand new.

https://www.mediafire.com/file/ms3xt8dov9e33zy/Troubleshoot.rar

Here is a simplified version of my blend file but the issue is still present, I also added a pmx export where I can see the lines, as it is now the shoes are separated, if you want to see the lines, you have to join the shoes into 1 object, convert and export, although the issue will be present with any mesh, the shoes are the easiest to test it.

I am not sure if it is a drawing order Issue since I think I sorted the material well in PMXe, I don't know if the same can be done in blender since I work on the material order in PMXe only

Here is a copy of the finished model just in case

https://www.mediafire.com/file/fea7k052tkg55ju/Izumi_Shimizu_2.0.31f.rar

powroupi commented 2 years ago

Okay, I compared the face order by adding Build modifiers on both objects, and I think here is the reason: debug

As you can see, I think the issue can be solved when the model have correct face order. If the blue and while parts are drawn at the same time, the issue happens. You can control the order of mesh parts by separating them to another object even if they use the same material, and reorder them on [Meshes Sorter] panel of mmd_tools. :smile:

Ademar440 commented 2 years ago

Ah yes, I am aware of hot to avoid or solve the issue with models that are affected, I just hope this can help MMDTools get better by making so that this does not happen at all, before MMDTools I used MeshIO and that plug-in didn't have this problem, I hope that this information can help MMDTools find a way to stop this issue from happening without using workarounds, if not, the workaround still works.

Thanks for your attention and dedication to this plug-in I really appreciate it.

powroupi commented 2 years ago

Okay, I've updated mmd_tools to respect the face order of original mesh object, the result should be similar to MeshIO. Although I think this issue could still be happened if a mesh object has randomized face order/sequence, it should work fine now in most cases. If you don't see any further issue after using latest mmd_tools, you can close this issue. Thank you. :smile:

Ademar440 commented 2 years ago

Certainly there is progress, however the mesh still has this issue if I triangulate the mesh before exporting

I always triangulate my mesh using this method since it gives me the best aesthetic results

Triangulation

I don't know what method MMDTools uses but the result is not the same a thus I triangulate before exporting, the changes you made work if I don't triangulate the mesh which is good progress because before the change the issue was present no matter if I triangulated or not.

Mesh triangulated before export Triangulated

Mesh not triangulated before export Not Triangulated

I am sorry I didn't mention this detail before, it really didn't come to my mind, I appreciate your effort just the same

powroupi commented 2 years ago

however the mesh still has this issue if I triangulate the mesh before exporting

Yeah, that's expected, the result should be the same if you use MeshIO. Blender's triangulate operator/modifier does not maintain original face order, it append new triangles to the end. That's why you see the BAD mesh shown in above picture.

Alternatively, you can use [Mesh]->[Sort Elements...] in Edit mode to sort selected faces to rearrange the order to fix issues manually. I don't have any good idea to fix this issue automatically, it is all controlled by users. :cry:

Ademar440 commented 2 years ago

Ah I see, well it is a shame that MMDTools can't use the same triangulation method that Blender uses that would negate the problem, I'll be careful in my exports in that case, I greatly appreciate your attention and time, I will close the issue since nothing more can be done if that is ok with you, thanks again for your time and good you job maintaining MMDTools.