Open MarcoWang1 opened 1 year ago
Hello, your input mesh indeed has a number of complex overlaps inside:
What we can propose:
The result will be as follows:
Is it something that you would like to get?
Thanks for quick reply, but I do not think global remesh or offset or decimate can solve this problem perfectly,since it will cause distortion elsewhere. nearly overlapping often occurs when convert cad files to triangle mesh,and only occurs in small regions of large model.so If use global method , it is not that good. I think maybe find a method to project these nearly overlapping triangles to a common plane,and then resolve intersections?
Thanks for the explanation.
Let me show your original mesh in semi-transparent view:
Edges with label 1
are non-manifold. Unlike normal edges they have 4 neighbor triangles instead of 2.
All triangles in region 2
are overlapping. The triangles in between red and magenta lines have to be deleted.
And triangles from region 3
have to be cut below magenta line.
These are serious issues in the software that produced such mesh, and they hardly can be easily and automatically fixed.
I can just guess that the root cause of these issues is incorrect implementation of Boolean operations (union, intersection, subtraction) in that software. And a possible fix is to export individual components of your model and make Boolean operations using MeshLib.
Do you think it is a typical error mode with export from CAD applications (e.g. more than one CAD software makes such overlapping triangles)?
Hello! Our team has managed to achive next result on this case, does it look acceptable for you?
I think it is a typical error mode with export from CAD applications (e.g. more than one CAD software makes such overlapping triangles)
Hello! Our team has managed to achive next result on this case, does it look acceptable for you?
It looks fine ,how do you solve this problem,did you use global method?
For now it is experemental method in development, we will make it public as soon as we finish work on it
@MarcoWang1 , could you please send us more samples with this type of issue, so we could use them for testing of the experimental method?
I will collect some models and send to you tomorrow
Thanks for new sample. This one is much more complicated than the first one:
We are trying to find a better solution that will work for it as well.
Thanks. Currently MeshLib does not support .3MF format, however it would be a good idea to start supporting it.
.3MF is smaller than other format I guess. If you solve this algorithm ,please tell me
We just added a possibility to load .model-files (it can be found in unzipped .3MF) in MeshLib, and now we can investigate your example. Thanks again. I will let you know about the progress.
By the way, if you save the model in PLY and then ZIP, the resulting file will be twice smaller: 3dmodel.ply.zip
We implemented a function for searching of overlapped triangles in the mesh findOverlappingTris
. It finds every triangle having oppositely oriented triangle close by, even if they are very different by size.
On your first model it selects red triangles as expected:
On you latest model the selection is as follows: because every large outer boundary triangle has some small oppositely oriented small triangle somewhere.
Actually it is not clear what do you expect to get here:
If one removes overlapping triangles, then you will get not-closed model (with holes), something like that (very approximately):
Please find how we can remove overlaps in your original sample (UI will be available in next release): https://youtu.be/OeVflimwOI8
I think you did a good job, I think 1 mark overlapping triangles 2 subdivide, 3mark overlapping triangles 4 subdivide ,5 mark overlapping triangles ,6 delete marked triangles 7 fill holes is a good idea
Your algorithm finds every triangle having oppositely oriented triangle close by, but sometime overlapping triangles may have same direction. Will your algorithm still can find this kind of triangles?
The method you use in your youtube video is deleting all overlapping triangles and then fill holes,I think this method can solve more than 50 percent of this kind of models. But there are models like cad1 file that it is not good to delete all the overlapping tirangles, I need to keep one surfaces( for example I have two overlapping surfaces,I need to keep one and delete one).
My thought on this problem, step 1 find overlapping trianlges( you have done this job) ,step 2 project this overlapping triangles on a common plane .so that all the triangles exactly intersect each other, and then split intersections, and then delete identical triangles and just keep one copy. I do not know it is a good method or not
Currently the method works only for oppositely oriented overlapping triangles. For same orientation overlapping triangles it must be extended to avoid false consideration of ordinary neighbor triangles as overlapping. It is possible to do, but will take a while.
As to projection on a plane, it is a good approach for 2D case, but if overlapping triangles form some curved complicated 3D shape, it may not work.
And as to cad1 model, it is not clear how expected result should look like. Do you have that model fixed by some other means?
I will try to fix cad1 model and then send to you
Thanks, expected result helped us much.
Then the method shown in the video works here as well, with the only exception that after deleting overlapping triangles, the original body may split on several connected components and automatic hole filling will not work. Below I connected such components manually using Stitch Two Holes tool:
From top to bottom:
So the fixing can be done manually already, however its automation will require additional efforts.
If the mesh have overlapping triangles ,it is easy to resolve this problems I guess, just split triangles.But if the mesh has many nearly overlapping triangles,(this triangles In theory, are not coplanar due to floating-point error), I used a lot of free softwares, like meshlab meshmixer etc,none of them have this function, I think models with such flaws are common ,Do you have plan to solve this problem?