Character Customization Assets

Hello everyone,

From what I’ve read on the forums, the best way to create wearable assets for a character that can be dynamically swapped is to include all the assets in the model. For example, Diablo’s Barbarian model would be a base model that’s in his underwear but will also include all helms, chestplates, bracers, belts, boots, etc… Now there are a couple of ways that the assets can be made : 1) split the model into regions that can be completely replaced by the asset. For example, one helm asset would be a bare head (no helm) while the others would be the helm and whatever parts of the head that remains visible. 2) keep the model intact as one big piece and model the assets to cover the appropriate certain regions. For example, each helmet would be modeled on top of the head, each chest-armor piece would be modeled on top of the chest, etc… Approach #1 seems to take more time but reduces poly count while Approach #2 seems to take less time but increases poly count. All of these items would be bound to the rig and are therefore a part of all animations. Assets such as weapons and shields need not be included since they can be mounted on to a mount-point dynamically. Wearable assets can be swapped by simply toggling the active state for the current asset to false and toggling the active state for the new asset to true. When exporting the model, the main mesh and rig should be exported to one FBX file while each animation should be exported to their own individual FPX files without the main mesh. They should conform to Unity’s ‘@’ sign convention so that Unity will automatically link each animation to the main mesh.

These are all my assumptions so far based on what I’ve gathered on the forums and experimentation, so please correct me if I’m wrong; it’s important that I know where I’m going off the deep end :stuck_out_tongue:

Okay, so here are my questions :

  1. Which approach should I take to modelling the assets : #1, #2, or some other approach?
  2. If there’s 100 of each asset (ie. 100 helms, 100 chestplates, etc…) then I assume that instantiating the Barbarian would take a VERY long time and hog up a TON of resources since each individual asset would need to be in memory. (I assume that they are in memory even though they are inactive). Therefore, I must be missing something since this is obviously the wrong approach, and putting all of the assets into the model is definitely not the way to go. However, everyone seems to claim this is the way to go, and the Unity Character Customization example uses this approach (but then again they only have 2 of each asset).

Help me, all-mighty Unity Community; you’re my only hope!

El Diablo

Model the body parts individually, then combine them to one model via script during runtime:
http://forum.unity3d.com/threads/16485-quot-stitch-multiple-body-parts-into-one-character-quot

Hello Anomalous,

Thanks for responding. I’m not sure if that link you posted helps me though; they’re trying to use one set of animations for all of their characters while I’m trying to figure out what the overall processes are in creating a customizable character. If I’m missing something please let me know.

El Diablo

Now I have a few people asking me if I found a resolution. This seems to be a hot-topic so if I find answers I’ll post a how-to guide.

Blizzard’s World of Warcraft follows method #3: Model all the pieces of armor and such and bring the individual mesh’s together to “look” like its all one piece. They go one step further and use the model’s base texture with overlays to make skin tight outfits. This to me is a million times more acceptable than one model with a thousand pieces. I figured this out a while back when I was tinkering with the Wow Model Viewer and the file format of the big files they use to store objects.

This is exactly what I do with my game.
Details in pages 4 5 of the WIP thread in my sig.

I separated a body in 4 pieces : head, torso, legs and arms.
Then each part has a unique computed texture, generated from 4 different layers : naked skin+cloth base color+cloth color 1+cloth color2.
You can find a tutorial for this texture computing here : http://forum.unity3d.com/threads/66179-Super-fast-method-to-create-1-texture-from-multiple-textures?highlight=super+fast

It loads in no time, and opens to a ton of different configurations and cloth/color mixups.

The hard part is to make all the meshes fit together, and all the different texture layers being able to overlay with each other seamlessly.

Ok, it depends on the situation. Doing your approach #1 (complete replacement of body part) would be a hassle for replacing a character’s head when he equips different helmets. You’d have to create all combinations of his face on all helmets as meshes. Better to attach the part on top of the head instead (think of the character’s hair as a “helmet” that gets unequipped when your character equips an actual helmet).

For something like long robes for example, if the legs aren’t seen, it makes sense to remove the legs completely while the robes are equipped. Just make sure that the robes conform to the character’s skeleton properly during animations, as if the legs are still there.

Once the robes are removed, put the legs back.

Depends on you if you just want the legs to be hidden when not needed, or really removed. Perhaps for NPC’s who rarely change their clothing you’d want them to really remove the not visible parts. For player characters who can change their clothing anytime, perhaps just hide them from view when not needed so showing them again will be fast.

Hey guys,

Thank you so much for replying!

@Nomad : I’m going to look into your links when I get to the office; I briefly glanced at your WIP thread : nice!!!

@Anamalous : Approach #2 (what you were just talking about) is what we have in place right now for a test model, but we want to make sure our approach is right before using it for all of our models, which mean we’re stuck! :confused: However, the problem we have is that if there’s 100 different helms, 100 different armor, 100 different boots, etc… then I assume that whenever I instantiate that model not only will the base nude character be instantiated but also each and every one of those assets (ie. helms, armor, boots, etc…). Therefore, this must not be the right approach, or perhaps I’m missing a step or two in between? If someone can shed a light on this I would greatly appreciate it.

The thought just occurred to me… considering that what I want to do should be handled via streaming Asset Bundles, should I write a design-time (editor?) script that takes each model, removes each asset (helms, armor, boots, etc…) so that the model is naked, save the nude version of the model on its own and save all the assets as Asset Bundles? Is it even possible to do this? I’m a programmer so writing scripts is not a problem, but given my unfamiliarity with Unity I was wondering if it’s possible to programatically strip a model of its assets and save the model and assets for streaming via Asset Bundles.

If I’m completely going over the deep end, please let me know, I’m very much open to constructive criticism. Perhaps there’s a myriad of other approaches I’m not considering that are much better.

Thanks in advance!

El Diablo

Hey guys,

@BigMisterB, N0mad :

Would someone please go into just a little more detail regarding the workflow for the model and individual pieces/meshes?

For example, we use ZBrush to create a high-res model of, let’s say, a nude human. Now let’s say we need to create 5 of each wearable asset such as helms, armor, braces, boots, etc… We start with helm1, modeling it straight on to the head. Then we make it invisible and go on to the next helm. We keep doing this with every asset until we’re done. At this point we have a high-res base model + high-res assets. We then low-poly everything (targetting the PC) and pass it on to our animator who rigs the base model, binds everything (model + assets), and creates animations for it. Another alternative is to separate the base model into several regions (head, torso, arm, legs, feet, etc…) and create 6 different heads (one with regular hair, the others with different helms), 6 different torso, etc… and then do the low poly, rigging, binding, animations.

What you guys seem to be suggesting (and please correct me if I’m wrong) is to model each asset *individually", which I think means creating a new ZBrush project for every single asset and modeling them separately. If I do this for, let’s say, a helm, how will I be able to model the helm to the exact contours of the human base model unless I have the model in the same project as reference? That would be like trying to create a bolt to fit a nut that you can only look at from a distance : it will never be a precise fit. Therefore, I don’t think this is what you’re suggesting and I’m simply confused, lol. Or perhaps you mean to export each individual asset as an individual mesh. But then, how will they get back onto the model at exactly the right places? How will they bind to the rig?

Would you be kind enough to offer a quick and dirty walkthrough from modelling to animation? It doesn’t have to be that long, just a paragraph like the example of how I currently do it.

Thank you guys very much for your assistance and patience; I really appreciate it.

El Diablo

Thanks for your compliment El Diablo :slight_smile:

Ok, now for the explanation :

Everybody his own method, but I chosed this one you mentionned :

Management : I got a file, in which I got different folders, based on those different body parts (heads, haircuts, torsos, arms, and legs). Each time I want to edit a head for example, I turn on invisible all the others.

UVs : Each mesh is UVmapped to a universal UV map (based on naked skin, for obvious reasons) for each member group. Then I adapt each texture to this map. If it happens that some models got more or less vertices than the naked mesh, then I do my best to fit the new vertices in a way that keeps being proportional to naked map.
For example if I decide to put a bracer on the naked arm for a new arm mesh, I will organize the new UV points in a way that will visually exactly fit the old naked UV arm map. This way I can keep a good eye on homogenity between my textures, without having to spend countless hours of drawing, then checking under 3D tool, then drawing, then coming back to 3D tool, etc.
This can even let me put a texture from one mesh to another completely different one, seamless (just in case of).

Rigging : traditional rigging of every vertex, for each different mesh.

Export : I put everything in one big FBX (cleaned from folders and useless conception stuff), take away all the textures, and export it.

Import : I create as much prefabs as there members, and drag-n-drop each FBX members into them respectively. This way I can update each prefab seamlessly by re-importing the original FBX.

Ingame :

  1. At start, I instantiate a boneset with proper animations,
  2. then create the mesh with different instantiated prefab parts,
  3. Combine meshes into one with Unity CombineInstance class,
  4. then reassign the bones to it
  5. create the proper texture with the method I linked earlier
  6. et voilà.

You have to write down some resource “loader” of your own. Unity was never meant for building huge games and asset bundles are not sollution for multigigabyte projects with thousands of items, shared materials, textures, LODs…I would reccomend you to design model ideal for your game and then make appropriate loading engine.

Like I said, if you have 100 different helms, its too much to create 100 different heads (each head having that helmet), and that’s 100 for each character that can use such helms.

So I would rather just have one head that doesn’t go away, and you just put the helmet on top of him. However you remove the hair when you add that helmet, so that you can be sure that the hair won’t show up on the helmet.

You have the base nude mesh, but the different possible clothing that the character can equip are not loaded yet. You just then load the ones that are needed.

However like I said, parts of the base nude mesh will be removed when you start equipping. When you equip boots, you remove the feet from the base nude mesh, since its being replaced with boots (there’s no reason to have the bare feet still loaded since the boots are equipped, plus it ensures the bare feet mesh won’t poke out from the boots meshes). This means your base nude mesh is segmented and some parts of it can be removed.

Hello again,

@anomalous : I’m currently looking into n0mad’s workflow, but I wanted to reply to you real quick. When you say that I have the base nude mesh, you forget that it’s not the only thing I have. Remember, I have the base nude mesh + all wearable assets that are rigged, bound, and animated, all of them in one file. This all gets exported from Maya to FBX and imported into Unity. It now appears in Unity as, let’s say, Humanoid. Inside Humanoid there’s the nude mesh and all the helm meshes, armor meshes, boot meshes, etc… If I drag Humanoid into the world editor, I’m creating an instance of this Humanoid which contains a nude mesh plus all his gear and I will see the Humanoid covered head to toe in a blob of every single asset I created. You see my problem now? Obviously this is bad, and I’m missing some step in between, obviously some pre-processing. This is what lead to me thinking the following, which I posted earlier but will re-post here for convenience :

I never received a reply as to whether this is feasible or not, but it may answer my question.

El Diablo

You don’t really have to design an editor script, just do that :

For example, you have this huge FBX file in your asset library, and you just want to make head prefabs : Create as many prefabs as there are different heads in your FBX, and then drag n drop your FBX head meshes into each prefab.
Then at runtime, you select the head type you want to load by instantiating the right prefab :slight_smile:

On a sidenote, the naked + progressive dressing up is quite similar, except that in this case you waste some precious resource by loading a mesh that you won’t necessarly use (naked mesh).

@n0mad :

Really?? I didn’t know you could do that! I’ll try that when I get back to the office and post what I find!

El Diablo

Wouldn’t that break the animation data on each of the meshes?

I have a very large FBX that I paid an artist to make for me, that in addition to the skeleton rig under the fbx there is 6 heads, 6 bodies, 6 hands, 6 legs and 6 feet.

I can’t even move the transform on any of them, let alone move them out of the fbx, which I don’t really understand, but I assume it has something to do with the animation data.

That said, I have no issues instantiating the model and enabling/disabling the different body parts of the fbx at runtime.

Yeah that’s simple :slight_smile:

Also, do not drag n drop FBX parts into the scene, and then drag it into prefabs, as it would create a new instance of the FBX and lose its connection to the bones.
Just drag n drop directly the FBX parts into library’s prefabs.

Yes it would break the animation stuff on it. But basically it’s not a good idea to merge animations and meshes into one single file when you deal with character customization assets, as it means you would have to reimport all your meshes whenever you change the animation, or vice versa. It’s better to separate them, loading your animated skeleton at runtime, then your meshes, and then link the whole together.

On the other hand, as explained earlier, instantiating the whole meshes library and then activating / deactivating parts is a huge memory waste. You basically asks your game to load as much useless data as you have deactivated meshes, which means unecessary loading times.
Imagine the case when you have 10 types of heads, arms, torsos, legs, that would mean you’d load (10 x 4 - 4) = 36 unused meshes ! :slight_smile:

I think thats very similar to what I’m doing, actually. When my model is instantiated it has 30 pieces, then I deactivate 25 based on his equipment, hehe :slight_smile:

Oh well, I’m not an artist so I’m not in the position to change the way it was designed, the artist that made it for me is long gone and I REALLY love the model. But I don’t notice a performance hit with the way I’m currently doing it, and I tested it with ~30 AI bots using the model, configured with different outfits and pathfinding, and I still get about ~500 fps.

Ah, you’re targetting Desktop machines, ok I understand then :wink:
Yes in this case it’s not really important.

(if there are not that much customization assets)

Okay, I had my hopes up this morning as I came in to the office but alas!, nothing is ever that easy :frowning:

Maya

What I did was have my animator create a very simple model for testing purposes. What he did was create something that looks like a lamppost, basically a cylinder with two different bases at the bottom. One base is a cube, the other base is a sphere, and these are meant to be interchangeable; completely swap one out for the other. At the top of the cylinder are two sign meshes (sign = NYC street-sign with the name or number of street on it). One of the sign meshes has a rectangular sign as well as a cylinder base that fits on top of the lamppost which serves as the “glue” between the sign and the lamppost. The other sign mesh lacks the sign and only has the cylinder base. These signs are interchangeable as well, swap one out for the other, but unlike the cube/sphere base, they don’t completely replace a particular region of the lamppost, they simply fit on top of it like jewelry. We did this to test both scenarios. We then created two animations for the lamppost, one which bends in the middle and the other which tips over like a bowling pin. We then exported the mesh + rig to its own file called “thing” and exported the two animations (just the animations, no mesh) to “thing@bend” and “thing@tip”. I have included the FBX files as an attachment if anyone’s interested in playing around with it.

503477–17839–$thing.zip (138 KB)

Unity

I drag all three files into Unity and since they conform to Unity’s ‘@’ convention it’s able to link in the external animations to the main mesh automatically. Now I have three things in my project folder : the main mesh called “thing” which contains the lamppost + assets (cube/sphere/signs) + rig. The other two files “thing@bend” and “thing@tip” are just animations and have already been linked to the main mesh thanks to Unity.

Okay, at this point I’m able to create an instance of thing, animate it, and have it swap between the different assets. Perfect, love it, except that having all these assets in memory at the same time and toggling their active state based on which one I want visible is a very bad idea, which I think everyone agrees with. This is where I need some help.

N0mad’s tip :

Okay, so I’m excited about this! I expand “thing” in my project folder to reveal its children and find all the submeshes. I drag Cube to its own prefab, Sphere to its own prefab, and the signs to their own prefabs. But now I have a problem… what do I do with “thing”? “thing” contains the base mesh (lamppost) and rig, it has all the animations linked to it, and it still has all the assets in it (cube/sphere/signs), but I need to create a prefab for it so that I can instantiate it. However, I can’t create a prefab for it if it still contains all of the assets, and there’s no way I can delete the assets within “thing”. If I copy the base lamppost mesh (basically all the children of “thing” that are not assets) into its own prefab then I lose the animations that were linked in to “thing”.

I’m obviously doing something wrong… help!!

El Diablo