CREATING YOUR OWN CUSTOM WEARABLES TO USE WITH THE MODULAR SYSTEM
Using Unity Version 2021.3
One of the most common questions I get asked about the Modular Character System is whether it is possible to create custom wearables to use with it. The answer is yes!
This tutorial will show you how to create your own Wearables, and use them with Base Characters from the Modular Character series.
This tutorial will not cover how to use modelling software or the fundamentals behind creation, rigging, or texturing of a mesh. It assumes a basic level of modelling proficiency and comfort using the software of your choice. Rather, we will go through how to configure that mesh, and how to make it work well with the system.
About this Tutorial
This is a more detailed version of the video tutorial on my Youtube channel. You can watch that and use this as a reference if you like.
The process for creating Wearables varies, depending on the type you are creating. There are three different types and each is treated differently by the Modular System. As such, they require different data and references, and the meshes need to be created somewhat differently depending on the type you're making:
Wearable Attachment An unrigged mesh, which will be parented to the characters' left or right hand.
Wearable Clothing A rigged item of clothing, jewelry, or eyewear.
Wearable Cosmetic Rigged hairstyles, adornments or faces.
This tutorial will cover attachments and clothing. Cosmetics will be included in a future tutorial.
Click the links below to skip to the most relevant section for you (though I recommend at least scanning all of it if you intend to create your own Wearables).
There are currently 17 slots total (with two more coming in the near future). The slot index is referenced by each Wearable so the Modular Character System knows where to put it. The following table will show you the mesh requirements for each slot:
Within these categories, some Wearables are easier to create than others. Read on as we go through the process in more detail.
Getting Started
Before we can get started, you need to make some decisions:
What material(s) will this Wearable use? Clothing can use up to two materials: One for the Wearable itself, and one for any showing skin.(NOTE: In an upcoming update, clothing can use as many Materials as you like, but for now, this is the case in the live version).
Will you include morphs on this Wearable? Modular Characters all have a selection of Character Morphs available. If you want to take full advantage of the system, your Wearable will need to also include the same shape keys. If you don't intend on using the morph settings, you can skip this step.
Will this Wearable have a variant available? A variant is an alternative mesh that can be swapped in if another slot requires it. For instance, the tops available in the Female Base Pack have "tucked in" variants available for use with high-waisted lower body items.
With those decisions made, you can get started.
Preparing your Custom Wearable Mesh
The first step is to download and import the base character you want to use into a Unity project (preferably a clean one). I'll be using the Stylized Female Base for this tutorial, which is available here:
NOTE: This is an affiliate link. You can also navigate straight to the product page by searching for it on the Unity Asset Store.
In the Assets/Stellar Game Assets/Modular Character System/Content/Characters/(Character Base Pack)/Art/Mesh folder, you will find an FBX file containing the entire Modular Base Character. This is the one you need can import into your modelling software to use as a base.
Use your modelling software of choice (I'm using Blender) to import the file and delete every mesh aside from the base parts and one face mesh. Do NOT delete the armature.
Creating a Wearable Attachment
Attachments are the easiest custom Wearables to create because they don't need to be rigged, they don't include an option for Variants, and they don't contain Character Morphs. There are so many cool prop packs available on the Asset Store and integrating them into the Modular System is a breeze.
Step One: Prepare your attachment mesh:
Import the FBX into your modelling software with the Base Character
Ensure the sizing is consistent
Set the origin to an appropriate place
Apply the scale, rotation, and location so the model is zero-ed out
Export the mesh (you don't need the armature) to your project
Other than that, attachments don't need any extra work. They aren't weighted to the character armature.
Step Two: Create Materials for your attachment
Create the Materials you want to use for your attachment. Currently, the system assumes your mesh's Material array only holds one Material at a time, but a future update will allow as many as you want.
Save these Materials in a place that makes sense for your project. I usually organize them by slot type.
Step Three: Configure attachment instantiation
Drag a character prefab and your attachment mesh into the scene and parent the attachment to the hand you want it to be held in. If you want it to be offered in either hand, you'll need to create two Wearable assets (one for each hand slot), so set up the transforms for one now and repeat steps three through five for the other hand.
Adjust the position and rotation of the attachment mesh so it is exactly how you would like it to be instantiated. Now leave this aside and go to the next step.
Step Four: Create a Wearable Asset for your attachment
In a location that works for you, right-click in the Project window and select Create -- Modular Character System -- Wearables -- Attachment.
You'll now have an asset file like this:
Fill in the fields. Your attachment mesh will go in the Linked Mesh field. At a minimum, the system requires a Name, the Linked Mesh, the Item Materials and Item Placement. The Description and Icon fields can be left blank. They're just for your own use with UI systems or otherwise. If you want to use the demo scenes to equip your attachment, you'll want to include icons.
Now lock the inspector window if you haven't already and select your attachment mesh in scene, which should still be parented to the character's hand bone. Click the "Capture Selected References" button and the fields will automatically populate. This provides the system with the exact placement you want. The character and mesh in scene can now be deleted.
Step Five: Add your new Wearable to the Wearable Database
Select the Database asset for your character, or create a new one if you want. This will be located in Assets > Stellar Game Assets > Modular Character System > Content > Characters > (Base Pack Name) > Database. Drag and drop your new Wearable Asset file into the database array.
Congrats! You now have a new attachment available, which will show up and can be equipped in any of the demo scenes!
Creating Wearable Clothing
Clothing and Cosmetics take a bit more preparation than attachments because they need to be rigged, can include an option for Variants, and some of them will require Character Morphs.
I'm not going to go into detail about creating a mesh itself -- that's a different type of tutorial entirely -- but I will outline below the main considerations to take when you are creating your custom clothing.
Including Character Skin
IMPACTED SLOTS: CHEST, LEGS, HANDS, FEET
When certain items of clothing are equipped with the Modular Character System, they replace the entirety of that clothing slot. Even when the character is unclothed, the slots are occupied by unclothed meshes. So those are replaced by the Wearable you equip to that slot. That means meshes are assumed to include the entirety of that slot, so your Wearable must include any visible skin that is part of that slot.
Rigging the Mesh
IMPACTED SLOTS: CHEST, LEGS, HANDS, FEET, FACE, HEAD, NECK, EARWEAR, EYEWEAR, BACK, SHOULDER, WRISTS, WAIST, ADORNMENT, HAIRSTYLES
The easiest way is to transfer the weights from the base mesh to your new mesh. Here's a quick video about the process:
If you aren't familiar with rigging, this step may take a lot of time to get right. The most common issue is clipping if you have overlapping geometry. I regularly revisit meshes to refine the weighting and geometry on the wearables I create to eliminate these issues. You also want to pay particular attention to the vertices where the slots are separated (e.g. from arms to wrist, upper to lower body, neck to head, etc.) to make sure there are no gaps when the mesh is deformed by the rig. This needs to be checked thoroughly, and for each morph you apply to the character body.
In the first image below, the hand mesh has different weights assigned to the joining seam vertices. When the hand bone is rotated, the gap is clearly visible.
Including Character Morphs
IMPACTED SLOTS: CHEST, LEGS, HANDS, FEET, FACE, NECK, SHOULDERS, BACK, WRIST, WAIST
If you want to include Character Morphs on your Wearable, you will need to model all of the shape keys you want to add. In Blender, Shape Keys are what we call Blendshapes in Unity.
NOTE: Chest meshes must include all of the Blendshapes for body morphs, even ones that don't impact them, like nail length or flat feet.
Start with a Basis key, then create a new key.
Copy the shape key names directly from the base parts so you ensure they are the same and conform your mesh to the base body shape, when the shape key value is set to max. Repeat this step for each Character Morph you want to include.
Refer to this table for the precise morph naming and use the Base Character you've imported as a guide.
If you aren't familiar with shape keys/Blendshapes, you can find some great resources online. Here are a couple of videos that explain the basics:
Shape Keys in Blender:
From Blender to Unity:
Creating Variants
IMPACTED SLOTS: ALL
A variant is an alternative mesh that will be swapped in when needed. For instance, if you have a high-waisted pair of pants and want the shirt to appear "tucked in", your shirt can supply a variant mesh to be used instead of the original. In the image below, you can see the Basic Tee variant, which automatically equips a tucked in shirt when the skirt is equipped.
(NOTE: The variant system will be expanded in an upcoming update to allow for more options)
If you want to create a variant for your Wearable, now is probably the best time to do it, since you can likely retain some of the weighting and shape data. Keep in mind that if you modify the mesh too much from the original, the shape keys may need to be redone because they'll completely freak out.
Remember to ensure that your variant mesh can use the same materials, in the same index order, as the original.
There will be a more detailed tutorial coming on creating variants. For now, this tutorial will focus on creating the main custom wearables. So stay tuned!
With all of that in mind, let's go through the steps involved to create a Clothing Wearable.
Step One: Prepare your mesh:
Import the FBX into your modelling software with the Base Character
Using the considerations above, create your new clothing mesh
Make sure it is weighted and parented to the Base Character Rig
Export only the new mesh and the armature to your project
Step Two: Create Materials for your mesh
Create the Materials you want to use for your clothing. Currently, the system assumes your mesh's Material array only holds one Material at a time, but a future update will allow as many as you want.
Save these Materials in a place that makes sense for your project. I usually organize them by slot type.
Step Three: Create a Wearable Asset for your clothing
In a location that works for you, right-click in the Project window and select Create -- Modular Character System -- Wearables -- Clothing.
You'll now have an asset file like this:
Fill in the fields. Your mesh will go in the Linked Mesh field. Make sure you don't drag the entire armature/FBX into this field. Just the mesh visible when you expand the file. At a minimum, the system requires a Name, the Linked Mesh, and the Item Materials. The Description and Icon fields can be left blank. They're just for your own use with UI systems or otherwise. If you want to use the demo scenes to equip your clothing, you'll want to include icons.
Step Five: Add your new Wearable to the Wearable Database
Select the Database asset for your character, or create a new one if you want. This will be located in Assets > Stellar Game Assets > Modular Character System > Content > Characters > (Base Pack Name) > Database. Drag and drop your new Wearable Asset file into the database array.
Congrats! You now have a new piece of clothing available, which will show up and can be equipped in any of the demo scenes!
Quick Resources
Used in this article:
Kommentare