Whinarn / UnityMeshSimplifier

Mesh simplification for Unity.
MIT License
1.76k stars 277 forks source link

Improved the core model simplification algorithm #28

Closed bawar9 closed 4 years ago

bawar9 commented 4 years ago

Hi, these changes are based on a research paper that augments the original paper by Dr Garland. You can read it here: https://www.hindawi.com/journals/mpe/2015/428917/. This also solves the issue listed here to some extent https://github.com/Whinarn/UnityMeshSimplifier/issues/19. See for yourself below.

BEFORE MY CHANGES

LOD Level (Quality 0.55 - Total Triangles after reduction 1208)ca

Capture

AFTER MY CHANGES

LOD Level (Quality 0.55 - Total Triangles after reduction 1208)ca

Capture2

Please note that this is not meant to exclusively solve the boat problem originally reported here https://github.com/Whinarn/UnityMeshSimplifier/issues/19. In fact the issue with the boat model is still there and something tells me that it's related to the vertex linking.

Whinarn commented 4 years ago

Hi @bawar9,

Thank you for your contribution! I'll try to go over the code and test this sometime this week and get back to you.

bawar9 commented 4 years ago

Hi @bawar9, Thank you for your contribution! I'll try to go over the code and test this sometime this week and get back to you.

Thank you. I also found a solution to the 2nd problem I reported here: https://github.com/Whinarn/UnityMeshSimplifier/issues/27 After you merge this branch I'll make another pull request for that as well

bawar9 commented 4 years ago

Hi, thank you for pointing out the issues and sorry for being sloppy. Only now did I realize that the "Triangle" and "Vertex" are structs and not classes, If I knew that earlier I would've passed them by reference to all the new methods and please do let me know if you find any other optimization hotfix. I have also removed the normal calculation method and have made all the other requested changed as well.