Whinarn / UnityMeshSimplifier

Mesh simplification for Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Combine triangles with close proximity of each other

Erlend2 opened this issue · comments

Hello, first of all, thank you for providing this useful and efficient mesh tool!

I suppose this is more of a suggestion/enhancement post, as I would love to have some tools/methods for merging massive clusters of triangles. I try to create terrain by merging land meshes, which unfortunately leads to excessive triangles and vertices as seen on the provided images.

Overview of merged mesh terrain.
meshsimplifier1
Lots of unnecessary triangles and vertices...
meshsimplifier2
What a mess of triangles!
meshsimplifier3

I have tried setting "quality" to a variety of levels. While lower levels do reduce the triangle and vertex count, it quickly affects the outer edges of the terrain by creating long lines of terrain, which honestly doesn't look that nice.

quality = 1.0f (full quality, but yes, it's low poly models)
meshsimplifier4_1f
quality = 0.8f (still acceptable)
meshsimplifier5_08f
quality = 0.6f (not that pretty with the sharp corner!)
meshsimplifier6_06f

Oh, another thing, I tried to preserve the corners by setting the special booleans to true, but the results were:
preserveBorderEdges = true; // Minimal impact, doesn't preserve borders?...
preserveUVSeamEdges = true; // Also minimal impact.
preserveUVFoldoverEdges = true; // However, this one preserves everything and leads to minimal (if any) simplification.

I would truly appreciate it if you would consider these suggestions!

  • Erlend

Hi @Erlend2,

I'm not sure how I missed this one. Sorry for the very delayed answer.
This is due to the original algorithm that I have ported. I have seen plenty of cases where this happens, and it is unfortunate. The most basic example is if you try to simplify a plane with a lot of triangles, you will see the edges starting to move, when that's the last thing you'd want.

Since I'm not very active with this project anymore, and only consider bug fixes to my implementation, I will unfortunately not look into this any further.

However, I find it strange that preserveBorderEdges doesn't save you from that. Because that should work in not touching the border edges. This of course limits the decimation since not a single vertex along the borders are touched. In my tests it works fine.

I guess there's a chance that you will never see this reply. But if you can reproduce the preserveBorderEdges not working, I could take a look at that specifically.

I hope this was of any help to you, even if I couldn't solve your problem.