Open sboys3 opened 3 months ago
Keeping track of which meshes I could potentially do this with and making sure everything works correctly with movement and scaling of bones seams pretty complicated. So don't get your hopes up of this happening.
Alternatively an option to just keep the original mesh instead for when there is no major optimization would work well for my case.
Put them into the exclusion list if it doesn't even optimize much anyways.
I made a script to do it. The ragdoll system winds up creating numerous copies of just about everything, so there were many duplicated meshes. Here is the repository https://github.com/sboys3/VRCAvatarMeshDeduplicator It compares meshes to find identical matches. If you feel that it is not too much of a hack or unique of an issue, feel free to reuse my code in your project.
When there are multiple copies a specific skinned mesh on an avatar they wind up getting optimized separately. This causes there to be two duplicates of the same mesh asset in the BinaryAssetBundle and eventually the final output bundle as well. Therefore increasing the download and unpacked size.
In my case, a majority of these meshes have not been merged at all. They are just slightly optimized copies of the original meshes. It would be nice if at least basic unmerged meshes are de-duplicated in the output. Alternatively an option to just keep the original mesh instead for when there is no major optimization would work well for my case. For most of my meshes the only thing changed in BinaryAssetBundle vs the original seems to be the number of referenced bones.