1
\$\begingroup\$

So I want to note that I am a beginner at game dev but an okay coder. I wish to make a game in which the character changes clothes.

I have a character and a few clothing meshes that all have the exact same rig with the same bone names.

Clothes and the avatar

So I equip the clothes to the character using a script to attach them to the avatar's rig and it works very well. However, meshes of clothes that are being worn on top of each other like coats and t-shirt overlap and create a bad appearance

Mesh Overlap Bug

How do I fix this? As I am new to gamedev I might not completely understand how to execute your suggestions so any youtube videos or tutorials on this issue would be really really welcome. Thank you so much!

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

The preferred solution is that each layer is designed to fit on top of the the smaller layer when designed.

If that is not possible, scale the outer clothing by a small amount, just enough to cover the inner layer.

Blender is free and mostly on par with the "big guys". There are many tutorials available.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ "If that is not possible, scale the outer clothing by a small amount, just enough to cover the inner layer." - might be better done in reverse. When new clothing is added - scale down the underlying (now covered) clothing by some amount. \$\endgroup\$
    – Kromster
    Commented Nov 28, 2022 at 9:57
  • 1
    \$\begingroup\$ Scaling may work close up, but it means you have several layers of mesh very close to one another. As the camera moves away from this model, z precision in the depth buffer falls off, and z-fighting between the layers can return, even though they're technically not penetrating. In AAA games I've worked on, we annotate vertices with integer codes for parts that can be overlapped, and use a uniform to send a bitmask to the shader representing which overlapped sections to show/hide, then we abort the hidden vertices entirely. \$\endgroup\$
    – DMGregory
    Commented Nov 28, 2022 at 13:43
  • \$\begingroup\$ I do not think scaling in design is a solution in my context as the game I am trying to make will have a lot of different choices for clothing. Thus It would be impossible to make every mesh compatible with every other mesh. For example, a jacket may work with a normal-fit t-shirt but may not with an oversize one or 20 other meshes for shirts and crop tops, etc. Thus I do not plan on solving this manually. Also scaling the inner layer may also not be feasible as they are mostly designed to fit the body and scaling might cause collisions with the body. But I will try scaling the outer layer out \$\endgroup\$
    – isa türk
    Commented Nov 28, 2022 at 18:25
  • \$\begingroup\$ @DMGregory, also sir I am sure that your solution is a very good one but as I am an inexperienced game developer I am not exactly sure how can I do that. However, I believe I am a fast learner so If you can provide me with some videos that does something similar or any way to guide me to learn it. I would really appreciate that. \$\endgroup\$
    – isa türk
    Commented Nov 28, 2022 at 18:27
  • \$\begingroup\$ I have no videos to offer you. If there's a particular step you need help with, you can post a question specific to that step. \$\endgroup\$
    – DMGregory
    Commented Nov 28, 2022 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .