artnas / Unity-Plane-Mesh-Splitter

Split large meshes in Unity into smaller submeshes
MIT License
263 stars 41 forks source link

Mesh is split up in odd chunks. #13

Open asusralis opened 2 years ago

asusralis commented 2 years ago

We wanted our terrain to be split up more into quadrants, but it instead splits up into seemingly arbitrary pieces. You can see some of the pieces highlighted in orange: image

Is there a way to split in up into roughly squares?

artnas commented 2 years ago

Hey. The script iterates all triangles, calculates their centers and groups them by closest grid coordinates, so it should work as you expected. Is the model really small or unusual in some way? I'm working on a solution to fix splitting very small models (with grid size less than 1).

Edit: I just pushed an update - see if it changes anything. I see that the model uses greedy meshing, so triangles might be quite large, but this still doesnt quite explain why they seem so random, can you provide the model and split settings so i can see whats going on?

asusralis commented 2 years ago

The model is actually pretty big in terms of unity's units. We create our model in MagicaVoxel & use a voxel mesh optimizer, so it's possible it is unusual. Here is the wireframe of the mesh. image

Is there any way to increase the grid size beyond 256? Even at max there are about 110 submeshes.

artnas commented 2 years ago

Right now you can increase the max size in the script. I'll change it later