[1680] VRChat crash when using avatars with extremely large blendshape position deltas on certain worlds
tracked
bd_
- Open world https://vrchat.com/home/world/wrld_163ea60b-50da-42f0-92a1-ba1137722178/info
- Wear (private) avatar https://vrchat.com/home/avatar/avtr_ac63acb2-191a-4b01-9514-75659e2faa16
- Crash
This avatar contains a gimmick which hides a portion of a mesh by using a blendshape with a very large displacement - in this case (float.MaxValue, float.MaxValue, float.MaxValue), but I've also tried with PositiveInfinity. This triggers a crash, but only on certain specific worlds.
This technique, if the crash could be resolved, would be very useful for hiding portions of a mesh without needing specific shader support. Indeed, Modular Avatar 1.13.1 is already using this technique (see https://github.com/bdunderscore/modular-avatar/blob/main/Editor/ReactiveObjects/MeshFiltering/NaNimationFilter.cs); due to only certain worlds (and meshes?) triggering the issue, I did not notice this crash before releasing it into the wild. Oops!
I'm considering alternative approaches to erase portions of a mesh dynamically, but they have significant performance impact (eg creating a bunch of constraints to allow me to create degenerate triangles reliably) or require specific shader support, and therefore don't work for fallback shaders or on Quest. If VRChat could support this (admittedly slightly deranged) use case, it'd be very helpful!
Log In
nekobako
I was finally able to reproduce the crash in the Unity Editor as well.
It seems to be a Unity-side bug rather than a VRChat issue.
The conditions for it to occur are:
- The Game View is open
- Occlusion Culling has been baked
- The Directional Light’s Shadow Typeis set to eitherSoft ShadowsorHard Shadows
- The Skinned Mesh Renderer’s Update When Offscreenis set totrue
- The Skinned Mesh Renderer has a Blend Shape that sends vertices to Vector3.positiveInfinity
- Some unclear conditions related to mesh weights or tilt
By the way, why is the
Update When Offscreen
on Skinned Mesh Renderer being forcibly enabled locally?Keeping it off prevents the crash, but would leaving it off cause any issues?
nekobako
I was able to reproduce the crash with following steps:
- Create a world project
- Set the Floor in VRCDefaultWorldScene to static
- Bake Occlusion Culling
- Upload the world and enter it
- Wear the avatar avtr_f8ea5364-662f-41bf-8a84-c2f5c01997a5
On the world side, the requirements seem to be that Occlusion Culling is baked, and the Directional Light’s Shadow Type is set to Hard Shadows or Soft Shadows.
On the avatar side, the exact conditions are unclear, but it occurs when the avatar has two bones, with some polygons weighted to a single bone and others weighted to two bones, the mesh is tilted, and there is a blendshape that sends some vertices to
Vector3.positiveInfinity
.Here is a video of the crash occurring.
You can see that when the avatar is changed, the floor becomes darker, and then the crash happens.
nekobako
I create two avatars that are almost identical, except one reproduces the issue and the other doesn’t.
Below are the IDs for both avatars. Both has only 3 triangles. The one that reproduces the issue has its mesh tilted by 10 degrees.
No Crash:
avtr_922e291a-7d13-48d7-af49-1f5e52c5eb98
Crash:
avtr_f8ea5364-662f-41bf-8a84-c2f5c01997a5
If needed, I can provide a unitypackage that contains only assets with no copyright concerns.
StormRel
marked this post as
tracked
Nidonocu
Most game engines really don't like dealing with infinity sizes. Maybe you should shrink the elements down inside the avatar? That's what most people do with elements of an avatar they need to hide.
bd_
Nidonocu Shrinking down elements doesn't fully hide the mesh, in general. In particular, when a polygon has different bone weights on its vertices, it's not possible, in general, to shrink it down to a degenerate triangle using a simple blendshape, because the bone deformations will stretch it back out.
As a workaround, one could use constraints to effectively detach the polygon from the armature, then blendshape it into a degenerate polygon. There's still rounding issues there that might result in the polygon remaining visible, however, and it consumes more performance budget, as you're now using multiple constraints on top of a blendshape. Nevertheless, if this cannot be supported by VRChat, I'll probably have to resort to that method.