Clothing, colliders, and clipping conundrums

Hi folks. I’ve been struggling a lot recently with ‘flowy’ clothing (skirts, coats, capes, etc.) and trying to keep it from clipping through the body mesh when moving. Figured it wouldn’t hurt to post here and make sure I’m not missing something fundamental and/or that I’m keeping my expectations realistic.

Pretty much all the clothing I’ve been working with is already rigged and weighted to its own armature (aside: wow there’s a lot of great free clothes on Booth), and in most cases, they come with a unity .prefab with physbones and colliders already set up (albeit sized for whichever avatar base the clothing was originally designed for).

My process is roughly:

  • Pull the clothing/armature fbx into Blender with my avatar
  • Use scaling and elastic deform to fit the clothing to the avatar body, adjusting the location of any clothing-specific bones along the way
  • Move clothing-specific bones from the clothing armature to the avatar’s armature with the correct bone-parent relations
  • Re-parent the clothing mesh to the avatar’s armature
  • Either rename vertex groups or use something like robust weight transfer to make sure any ‘static’ parts of the clothing mesh stay put in relation to the avatar (usually hips/spine/chest)
  • Export the modified clothing + armature, copy to Unity assets, drag the fbx into the avatar’s hierarchy, and attach it using VRCFury/ModularAvatar armature link
  • Using the original prefab as a template, create the colliders and physbones attached to the appropriate transforms in the clothing’s armature, adjusting positions/sizes of the colliders to match the avatar’s body
  • Build & Test several dozen times to adjust everything in hopes of preventing clipping and inevitably give up or call it ‘good enough’ and try not to let adhd get triggered when walking past a mirror in-game and seeing things clip into the body

I guess my biggest questions have to do with expectations. In a lot of cases, I can get the clothing behaving in a way that I’m reasonably satisfied with, at least when standing still or moving slowly, but if I run, jump, use a chair/station, or activate an animation (ie, goloco sitting poses), it almost seems like the colliders just cease to exist. For example, putting a long skirt on the avatar, regardless of the size/position of colliders on the upper and lower legs (and the collision radius on the physbones), it feels like it’s impossible to not have the knees clip through when running, or the thighs clip when jumping. Making the colliders too big results in the clothing being pushed away from the body mesh even at rest, and limiting the physbone movement with ‘polar’ or ‘hinge’ (and adjusting pitch/yaw so the bones never get any closer to the body mesh) doesn’t seem to have any effect.

  • Is that the expected behavior and just something I have to live with? Are my own expectations unrealistic? Do actions like jumping or activating goloco animations disable/ignore colliders?
  • Do I need to make absolutely certain in Blender that any vertices weighted to the clothing bones have zero weight overlap with ‘primary’ bones (hips/spine/legs/etc)?
  • Do I need to make sure any colliders are directly attached to the avatar’s armature and not the linked armature?
  • I prefer to put my physbones and colliders into their own GameObjects in the avatar hierarchy with the appropriate root transform set. Would it make any difference if I put them into the transforms within the armature hierarchy directly? It doesn’t seem like it but maybe?
  • Do I need to look into using some form of VRC___Constraint on the armature/bones/meshes somewhere?

Also just for the sake of noting it, this is all just for PC versions of avatars. When I make Android/iOS versions I usually just get rid of any extra bones entirely and weight the clothes directly to the main armature since something like a skirt is almost guaranteed to blow past the physbone (and regular ‘bone’ count) performance limits.

tl;dr: Am I doing something fundamentally wrong or just expecting too much?

PhysBone colliders don’t tend to collide with the avatar’s skinned mesh. They only affect PhysBone chains configured to interact with them. This means that even if your skirt bones are being pushed away from your leg colliders, the actual skirt mesh can still clip through the knees because of its skinning and vertex weights.

I’d recommend treating this as a combination of weight painting and secondary physics rather than relying entirely on colliders. For example, you could have the upper portions of the skirt follow the hips and thighs more closely, while using additional clothing bones and PhysBones for the lower, more freely moving sections. There’s also something interesting regarding your question about VRC Constraints. I found a VRChat feedback report concerning PhysBone colliders becoming desynchronized when Parent Constraints are used. A VRChat developer explained that constraints execute after PhysBone simulation, which can cause unexpected behaviour when used to move PhysBone chain segments. I’d therefore try a test without constraints first. Put the leg colliders directly under the corresponding avatar leg bones and make sure their Root Transform references the actual animated bones. Keep the skirt’s PhysBone chains on their own dedicated clothing bones, and explicitly assign the leg colliders to those PhysBones.

For your vertex weights, I wouldn’t aim for zero overlap between clothing bones and the main skeleton. Some blending between hips, thighs and clothing-specific bones can actually help the garment follow the body more naturally.

I think some clipping is unfortunately unavoidable with long skirts, especially during extreme animations. PhysBones aren’t a complete cloth simulation system, and their collision system doesn’t guarantee that every section of a skinned mesh will remain outside the body

It’d certainly be nice if we could set collision on meshes, but I’d imagine that’d be absurdly computationally heavy. I hadn’t even considered the weighting influencing how (for lack of a better word) ‘strongly’ a collider would act on the parts of the physbone chain, but that does make sense. I really need to pay more attention to how these meshes are weighted on their supplied armatures before I start stretching and scaling to fit other avatars.

It’s also interesting you mention the idea of dedicated bones like that for the colliders. Going back and looking at the original prefabs, I see that, yeah, in some cases there are extra bones on the same level of hierarchy as the physbone root transform, but beneath the humanoid bone (ie, SkirtCollider.L and Skirt.L.001, both directly underneath UpperLeg.L). Again, I need to pay more attention to the original armatures, as up to now I’ve either ignored or just overlooked those extra bones and stuck with putting the colliders on, say, UpperLeg.L.

Thanks a ton for the insight, lot of stuff I hadn’t really thought about before. Also a good reminder to me to trust the creators of these things to have done a lot of this work already; there’s a dang good reason they’re distributing their stuff as prefabs inside unitypackages and not just raw FBXes.

One last thing that I’m hoping you might know: Is there a significant difference in performance/behavior of Physbones/Colliders when using VRCFury’s Armature Link vs. ModularAvatar’s? I tend to use VRCF for everything out of inertia at having learned to do this stuff using it, but a lot of the prefabs (especially from Booth) use MA instead.