Hi there!
I've recently taken a serious dive into the world of game development, trying to make my dream come true and make a game. I've been doing what I can, trying to learn skills to cover the holes that I can and hiring people for jobs that I can't do myself.
Now I find myself at my first big technical issue that I have no idea how to tackle. I was hoping someone else with a bit more experience would be able to answer some questions to help me take this beast down.
So the core problem is switching pieces on a rig. In many games, equipping different clothing or armor pieces will switch out the mesh on the character with a different asset. I come from an animation and modeling background, so I understand how that would work from that perspective: toggling visibility on mesh pieces to show what you want and hide what you don't.
My problem and questions arise when doing this in regards to Unity. Do all of my clothing meshes go into the same file with the rig? Will they all share a giant texture map? How are they switched in the engine? Is it possible to add more clothing options later? What is this kind of technique even called? I know very little on the subject.
I would like to at least attempt to do this on my own: I have already done a few rigging tutorials through successfully. However, all of these tutorials only refer to a single piece of geometry per rig. They also don't cover fingers or facial rigging. I have rigged fingers and faces for 3d animation using blend shapes and set driven keys. Are these sorts of options available in Unity? Or are the other techniques I need to learn?
At the moment, I am tweaking my model and trying my best to prepare it for rigging and texturing. Anyone who has some pointers on what to do or avoid, please let me know! I am eager to learn what mistakes I am making.
Replies
If they deform, it helps to bind them to the same skeleton as the skin, so you can fix/avoid interpenetrations. But Unity doesn't care if they're imported via separate files or not. Whichever works best for your pipeline.
Obviously they need to share the same animations as the skin underneath. Same pivot/origin would also be nice.
You'll probably want to split the skin off, so you can disable the chest skin when a character has a shirt on. Avoids drawing more surfaces than necessary, which in games is important.
Usually no. Depends on a lot of things though. Hardware the game is running on, how well it manages texture memory.
If clothing has transparency, this is relatively more expensive than non-transparent parts... both in texture memory (alpha channel costs more usually), and in fill rate (alpha blending costs more time to render). So hair for example usually goes on another texture from the rest of the body. Different shader too.
Often you add empty nodes to the skeleton, then use code to instantiate meshes onto those nodes. So for example you have a right-hand-weapon-node, and you instantiate different gun models there when the player switches weapons. Same can be done for clothing.
Blend shapes are morph targets, Unity can use them just fine. I don't think set driven keys can be imported into Unity, but I haven't tried either. I think you'll need a special export system to convert that data to Unity. But usually game animators use a more complex rig to animate, which is set up in Maya/Max/Whatever to drive a simpler FK-only game rig, which then drives the meshes. Then you export just the simple rig + meshes, because that's all the typical exporter can understand.
My advice is to export early and often, testing constantly what works vs. doesn't. This will help you avoid a lot of re-work.
There are also a lot of good tool resources in the Unity Asset Store. Worth a good chunk of time searching and testing things.