Closed laurentopia closed 6 years ago
This is a known issue with the Fast Quadric Mesh Simplification algorithm (which is the used algorithm in this project), because it doesn't take this into account.
However, there is a property called KeepBorders on the MeshSimplifier class. See here: https://github.com/Whinarn/UnityMeshSimplifier/blob/master/Scripts/MeshSimplifier.cs#L195
This will be turned off by default, but once you enable KeepBorders, it will preserve all borders of the mesh, to prevent holes from being created. However, this means that the simplification becomes more restricted and in a lot of cases it might not be able to ensure the desired count of triangles in the mesh. This is the reason why it has been turned off by default.
I have been looking into other ways of solving this issue, without restricting the simplification too much, but have not yet found anything that I am happy with.
Since you are using this through AutoLOD, you would have to set that property here: https://github.com/Unity-Technologies/AutoLOD/blob/master/Scripts/Editor/MeshSimplifiers/QuadricMeshSimplifier.cs
But I will leave this issue open, because I still wish to improve this.
Thanks, I understand what's going on. UV border is a hard problem, the best decimators I used are also 3d painters so they can massage the UVs no problem. Off those that leave the UV island intact, atangeo balancer is the best, maybe you can be inspired by how they do it.
I wanted to post an update on this, because I believe that I have found a better way to prevent holes, where the simplification is not limited in any way, but the visuals of the mesh still staying intact (as much as possible). This slows down the algorithm a bit, so I have made sure that the feature can be disabled if desired. But I am planning on having it enabled by default.
However I still have issues with the vertex attributes not merging correctly around the actual UV seams. But I have ideas of how to solve this as well.
If you are interested in the WIP you can find it in the new feature-prevent-holes branch.
There are other issues where undesired holes are being created that are unrelated to UV seams, and I believe that this can be improved with some tweaking of the edge error calculation. But the fixes in this branch should be a huge improvement from before.
Thanks a lot for that, I'll ping the unity folks so they use this WIP branch!
Hello again!
This work has now been merged into master. Feel free to test the code if this also solves your issues. I recommend to read the changes to the readme for more details: https://github.com/Whinarn/UnityMeshSimplifier/commit/c5fe020f1c7fd540b28e2cb275cb655fd8da4147
There might still be scenarios where holes are created, but those are slightly harder to cover. I will close this issue, but feel free to reopen it if you are still experiencing issues.
see https://github.com/Unity-Technologies/AutoLOD/issues/6