meshoptimizer icon indicating copy to clipboard operation
meshoptimizer copied to clipboard

Split meshes can also be an optimization

Open Maxxxel opened this issue 2 years ago β€’ 6 comments

Nice tool you got there, but for my purposes I need something that can split a gltf/glb mesh Into multiple meshes (with max_Vertices_Count and max_Faces_Count), as the desired game engine only supports maximum indices of 32.767. Would it be possible to add such a feature or is it too complicated?

My current workaround is loading the model in Blender and reducing complexity :/

Maxxxel avatar Aug 09 '22 21:08 Maxxxel

Mesh splitting isn't too complicated so it could be implemented I think. Are you sure the limit is 32767 vertices as opposed to 65535?

zeux avatar Aug 10 '22 00:08 zeux

I'm sure, the reverse engineered Data says Face Indices are signed shorts :/ when I go above the value the model gets out of hand.

Another thing is that there are two separate meshes representing the whole sub meshes as one. This is used for collision detection I assume. Right now I'm merging all sub meshes into one by hand and if Face count exceeds short.maxValue I give an error message to the user.

So at best I would need to split a bunch of meshes I to meshes with Face Index < short.maxValue and then a way to generate one unified mesh with also Face Index < short.maxValue (like simplifying).

Idk if this is the right tool for this but I feel that you can give me some nice ideas hints too. πŸ₯ΊπŸ‘‰πŸ‘ˆ

Maxxxel avatar Aug 10 '22 06:08 Maxxxel

I would probably look into https://github.com/donmccurdy/glTF-Transform for this kind of involved processing - I don't know OTOH if it supports mesh splitting, but it tends to be better when you want to execute a series of specific processing commands, whereas gltfpack tends to be better at processing scenes optimally with little configuration.

zeux avatar Aug 12 '22 20:08 zeux

Thanks for the hint I'll check it out!

And a hint for switching left/right handed? πŸ™ƒ

Maxxxel avatar Aug 12 '22 21:08 Maxxxel

gltfpack doesn't do coordinate system transforms; similarly to above, this seems to be a task better suited for glTF-Transform (unsure if it already supports it or not).

zeux avatar Aug 13 '22 15:08 zeux

Thank for all πŸ‘Œ

Maxxxel avatar Aug 14 '22 10:08 Maxxxel

Looking at this again, this is probably specific enough that glTF-Transform would be a better fit.

zeux avatar Dec 02 '22 08:12 zeux