unity – How do you have the clothing mesh hide the body mesh underneath?

This is a pretty common problem many people run into and the solution depends largely on what you are trying to do in your game.

If your character is unable to change clothes in game, or has a very limited selection of clothing, what many people will do is flatten the character mesh and clothing meshes to a single character model. After doing so you can delete any geometry that would be inside the clothing that might risk clipping through. This should also give some small performance increases as there is less geometry to render overall. Since most games only offer 1-3 clothing options per character exporting one character model per clothing option usually isn’t too bad.

If your character needs to be able to change clothes constantly (such as equipping armor in an MMO), what I would do is create a shader for your main character that, in addition to your usual textures, takes in a special clothing mask texture that controls the alpha channel of your character based on what they are wearing. For example if you want to equip a T-shirt to your character you masking texture would show all of the bodies UVs except the torso and shoulders as white and the rest as black. If you want to equip a three piece suit, show everything as black except the hands, neck and face. You may need to allocate more than one texture slot of clothes can be mixed and matched, but this should basically set everything that should be covered up as visible so you don’t have to worry about clipping except in areas where the body should be visible (neck line and wrists).