d4rkc0d3r / d4rkAvatarOptimizer

d4rkpl4y3r's VRChat Avatar 3.0 optimizer
MIT License
402 stars 17 forks source link

Having skinned mesh/mesh components disabled can produce incorrect results in optimized copy #15

Closed Asovrix closed 1 year ago

Asovrix commented 2 years ago

As in title. Apparently toggling skinned mesh/mesh components is way more performant than toggling the entire gameobject with mesh on it. It seems though that optimizer does not seem to properly support these kind of scenarios and produces a copy where meshes are not getting enabled/disabled the same way as on input avatar. To reproduce try to switch your gameobject toggles into skinned mesh component toggles in hierarchy and in animations, aka you toggle lower checkbox instead of upper one: Unity_2022-11-03_15-29-04

Asovrix commented 2 years ago

Problem seems to occur when a gameobject where (skinned) mesh renderer is enabled gets merged to a different gameobject where renderer is disabled. Result of it is that on optimized copy that merged mesh which was disabled stays disabled and toggling it on manually doesn't yield proper results when it comes to animating parts of it on or off.

d4rkc0d3r commented 2 years ago

I fixed the SkinnedMeshRenderer component being disabled when other stuff get merged into it. I also changed how I save the optimized materials. Would be nice to know if that fixes it. You can get the newest version right here.

Apparently toggling skinned mesh/mesh components is way more performant than toggling the entire gameobject with mesh on it.

Yes technically it is. However if you use the optimizer you won't have either of those toggles left over so it doesn't matter in this case. Also unless you toggle your meshes rapidly this is also a non issue.