Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplification creates holes alongside UV boundaries #2

Closed
laurentopia opened this issue Feb 15, 2018 · 5 comments
Closed

simplification creates holes alongside UV boundaries #2

laurentopia opened this issue Feb 15, 2018 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@laurentopia
Copy link

laurentopia commented Feb 15, 2018

see Unity-Technologies/AutoLOD#6

@Whinarn
Copy link
Owner

Whinarn commented Feb 15, 2018

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.

@laurentopia
Copy link
Author

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.

@Whinarn
Copy link
Owner

Whinarn commented Mar 4, 2018

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.

@laurentopia
Copy link
Author

Thanks a lot for that, I'll ping the unity folks so they use this WIP branch!

@Whinarn Whinarn self-assigned this Apr 1, 2018
@Whinarn Whinarn added the bug Something isn't working label Apr 1, 2018
@Whinarn
Copy link
Owner

Whinarn commented Apr 1, 2018

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: c5fe020

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.

@Whinarn Whinarn closed this as completed Apr 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants