Change clothes on characters from MakeHuman in Unity3d

The goal of the article is to transfer the character from Makehuman to Unity3d so that his clothes can be taken off and put on right during the game.





For this we need Makehuman , Blender3d , Unity3d and its UMA plugin (they are all free). The article was written based on this YouTube channel, repeating after the author, I filled a lot of bumps, and now I'm ready to state my vision.





Stage 1: Character Creation in Makehuman

This is the easiest and most enjoyable stage, here you need to model the character. Makehuman is a fairly simple program, so I won't describe how to work with it.





But there are three important points. First: you need to add a skeleton to the model (added in the Pose / Animate tab). In this tutorial, I am using the Game Engine rig. Secondly, if the character has clothes, then you need to disable the option to remove polygons under clothes (this can be done in the Geometris -> Clothes tab, and uncheck the Hide faces under clothes checkbox ). Thirdly, you need to export to fbx and specify the units of meters. Also, just in case, you can save the model.





A few additional points

There is no need to change the pose of the character.

Clothes can be exported piece by piece. That is, you do not need to put on all the clothes at once, you can, for example, first save a character who has only pants and a shirt. In a blender, export them, then return to makehuman, remove old clothes and repeat the export operations, for example, for hat and boots.





Units of measurement are meters, which means that ten cells in makehuman will mean a conventional meter





Stage 2: Processing it in Blender3d

There are three things we need to do here:





  • Normalize Model





  • Add a global bone





  • Cut body parts





Launch Blender3d. First we need to remove the light, camera and cube and import our model. Then we import our model: File -> Import -> fbx (and select our fbx file)





The rake I stepped on

, makehuman, ( fbx , ). .





. , , , , . , . .









Switch to pose mode

, ( a)





pose ->clear transform -> all





Clear transformation

, , . .





90 ,





.





Switching to object mode

. R , X . -90 Enter





, .





, , , , . scale 0.500, 1.000. , scale, , . .





0° 1.000 ( ).

, ( ) ctrl + a, rotation & scale.





, UMA. .





Global (Head= 0,0,0 Tail=0,0,0.1) //  
  Position (Head= 0,0,0 Tail=0,0,0.1) //   Root 
       ( pelvis)
      
      



Root Position. Transform .





( Game_engine) . add -> single bone





bone, Global , Position.





Global Position. Position.





Global, shift, Position. 3d ctrl + p, keep offset.





UMA - / - . , , .

















  • ( )

















(seams mesh). , ( , ). .





seams mesh

( ). (, ) .





seams mesh
seams mesh

shift + d, RMB





.





seams mesh ( ).





, .





( seams mesh).

.





alt ( , ).





UPD: ( c) , ValeryIvanov :





( h), L ( ), , Alt + L. P Selection. , .





Hide the stripe on the neck (H)
( H)
Press L to select the head (the cursor should be on the head)
L ( )
Show the strip (Alt + L) and select the selection (P -> Selection)
(Alt + L) (P -> Selection)

.





. . .





.





, seams mesh . .





fbx ( makehuman )





3: UMA

unity, , unity. UMA - Unity Multipurpose Avatar, . UMA/Getting Started/UMA_GLIB .





, characters. (fbx ). , . fix now.





UMA ( characters), . . , .





fbx , Convert Units, Apply. rig animation type, Humanoid Apply.





UMA -> Extract T-Pose ( fbx ). TPoses -.





UMA -> Slot Builder, . fbx seams mesh seams mesh Slot Builder. UMAMaterial UMA_defuse ( ). slot destination folder .





automatic Drag and Drop porcessig. , , ( ). , seams mesh None , .





. , UMA, , , , , ( ). , , Create -> UMA -> Core -> Overlay Asset. Overlay name ( head), material ( UMA_defuse) 1, _MainTex . .





TextRecipe RaceData

Create -> UMA -> Core -> Race Data, Create -> UMA -> Core -> Text Recipe. - . - / . . , Race Name , TPose - . Base Race Recipe .





Wardrobe Slots, - , . Wardrobe Recipe. Wardrobe Recipe . Wardrobe Recipe ? , () . , , ( , ). Wardrobe Recipe , , ( ), , . Wardrobe Slots :





  • None





  • Hair





  • Shirt





  • Pants





  • Shoes





BaseRecipe, Slots. Race Data (, ). ( ). . . , shared overlays.





UMA -> Global Library, .





. UMA/Getting Started/UMADynamicCharacterAvatar ( ). Dynamic Character Avatar Active Race .





( , ). , . Race Animation Controllers Race Animators , Race , Animator IdleTest-w-head.





Play. .





Create -> UMA -> DCS -> Waredrop Recipe, , Wardrobe Slot . , . , . . , Customization -> Default Recipes .





, . Create -> UMA -> Misc -> Mesh Hide Asset, , , Begin Editing , . Waredrop Recipe Add Mesh Hide Asset, .





. Dynamic Character Avatar, Customisation -> Default Waredrop Recipes .





DynamicCharacterAvatar. SetSlot ClearSlot , BuildCharacter. SetSlot . . Waredrop Recipe. ClearSlot .





SetSlot ()

, . , SetSlot Waredrop Slot Waredrop Recipe.





, - AddWardrobe RemoveWardrobe.





using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UMA;
using UMA.CharacterSystem;

public class Program : MonoBehaviour
{
	//     Dynamic Character Avatar
	public GameObject DCA;
	private DynamicCharacterAvatar avatar;
	
	void Start(){
		avatar = DCA.GetComponent<DynamicCharacterAvatar>();
	}

	public void AddWardrobe(string wardrobeSlot, string wardrobeRecipe){
		avatar.SetSlot(wardrobeSlot,wardrobeRecipe);
		avatar.BuildCharacter();
	}
	
	public void RemoveWardrobe(string wardrobeSlot){
		avatar.ClearSlot(wardrobeSlot);
		avatar.BuildCharacter();
	}
}
      
      



Thanks for reading to the end, I hope this article will be another step for you to create your dream game.








All Articles