Search Unity

Having an issue with my clothing clipping.

Discussion in 'General Graphics' started by NickPercent, Jan 12, 2021.

  1. NickPercent

    NickPercent

    Joined:
    Aug 17, 2020
    Posts:
    1
    I'm trying to get an animation working in my Unity project, but whenever I apply the animation that I need, it seems that his body is clipping through his clothes. Does anyone know a good solution for this?


    upload_2021-1-12_10-3-34.png
     
  2. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Okay. The parts on the clothes that the body clips through, animate those parts/sections of the clothes, to move in tandem and match with the characters body movement animations.
     
    Last edited: Jan 23, 2021
  3. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Depending on your art asset pipeline, there are some optimizations that you can do to the art which prevent clipping by eliminating the skin that would be hidden by clothing. Some of these methods are:
    • If your characters do not need multiple outfits, simply pre-clothe them in your modeling tool so the clothing is part of the skinned mesh, and there are no polygons underneath opaque clothing. Those wouldn't render anyway, so they might as well be deleted from the model.
    • Use modular mesh systems such as UMA that can define "slots" for clothing, and the clothing article replaces the body parts it would cover. If the character will never be seen without that clothing article, there may simply be no unclothed equivalent of that body area. For example, if you are making a kid-friendly game where there is no genital nudity, the base model would replace the hip area with generic undergarments, and whatever pants, robes, dress, or other garment is chosen at runtime for the lower body replaces the undergarment-covered hip area and possibly the legs and feet. Areas such as the hands, which are in most cultures not considered taboo to be seen in public, have a nude variant as the default but that part of the mesh is replaced by gloves or gauntlets if these are equipped onto the character.
    • If your game needs highly-realistic cloth behavior and will run only on higher-tier platforms, you can add advanced cloth simulation to the clothing, coupled with more detailed compound colliders on body parts (e.g., capsules for the upper arms, upper legs, lower arms, lower legs, etc.). This is very performance-costly but can be used in situations such as offline rendering where frame rate is not such an issue.
    • As the other reply suggested, animate the clothing models to match the character animation. This may have a downside of introducing more skinned meshes, which are somewhat performance-costly. (I don't use this technique, so it is entirely possible I am not aware of something the other person knows about optimizing it -- in which case I invite them to enlighten and correct me so we can both learn something new).
    • If the number of outfits is greater than one, but a finite and small number, you can pre-model the full character with each of their outfits and then swap the skinned mesh at runtime. This might apply if your hero wears normal clothing through most of the game but has some special outfit they wear during the finale, or something they earn as a reward after completing the main quest: "As you have defeated the dreaded Ultra Dragon of Doom, you are the rightful Queen of Elbonia. Citizens, behold our new Queen in the full radiance of the Golden Astral Gown of Glory!" <cue magical SFX as the character models are cross-faded>
    I hope this helps!
     
  4. unknownsk

    unknownsk

    Joined:
    Jan 16, 2020
    Posts:
    36
    very simple! edit texture and change body texture to transparent in that place so its not gonna render. just do not forget to turn on alpha clipping :)
     
    Ignacii likes this.