Difference between revisions of "Clothing Items Documentation"

From Nexus Mods Wiki
Jump to: navigation, search
m
m
Line 149: Line 149:
  
 
Clothing Item in our game consists of several properties like name, model ('''.skin''' file), material, blendShape, archetype, race etc. To create such Item and save it to the database you will need Wh Clothing element Editor   [[File:ClothingItemsImage13.jpg|1000px|RTENOTITLE]]   None of your exported meshes will be used in game, until you define an Item in this editor.
 
Clothing Item in our game consists of several properties like name, model ('''.skin''' file), material, blendShape, archetype, race etc. To create such Item and save it to the database you will need Wh Clothing element Editor   [[File:ClothingItemsImage13.jpg|1000px|RTENOTITLE]]   None of your exported meshes will be used in game, until you define an Item in this editor.
 +
  
 
=== Item Definition ===
 
=== Item Definition ===
Line 156: Line 157:
 
[[File:ClothingItemsImage14.jpg|1000px|RTENOTITLE]]  
 
[[File:ClothingItemsImage14.jpg|1000px|RTENOTITLE]]  
  
#Press "'''New item"''' button - this will automaticly prefill '''Name''' property in the right upper corner of the panel. (MyFirstSomething1) #Change "<span>MyFirstSomething1" </span>name to something more readable e.g. Shirt_001 or '''Shirt_short''' #From'''Gender''' dropdown select the right one. ('''Male''' in our case) - ''If you'll select male NPC entity later in the Editor, Clothing System will show you list of just "male" items'' #From '''Archetype''' dropdown select from first few starting with underscore. '''_UPPER BODY''' in our case. If you have something from second (chainmail) layer for example - select '''_UPPER BODY 2 '''etc.''- Archetype defines how this item will behave in RPG system and also how it sounds after hit from weapon etc.'' #Browse model&nbsp; '''s1_p2_l1_v0.skin''' in our case #Select '''Morph target''' (blendShape) if you are dealing with [https://wiki.nexusmods.com/index.php/Clothing_Items_Documentation#Base_geometry_with_blendShapes Base geometry]. Otherwise leave it as it is. '''V_001''' in our case #Select '''Material '''- to select right one press '''"Open material editor and select material"''' button. Editor will pop-up and browse to your material and select it. Than go back to Clothing element editor and press '''"Get name from material editor"''' button #Leave everything else untouched and press "'''Apply changes'''" #New item should appear in the list of existing ones #press '''"Save database"''' - ''top-left corner''  
+
#Press "'''New item"''' button - this will automaticly prefill '''Name''' property in the right upper corner of the panel. (MyFirstSomething1)
 +
#Change "<span>MyFirstSomething1" </span>name to something more readable e.g. Shirt_001 or '''Shirt_short''' #From'''Gender''' dropdown select the right one. ('''Male''' in our case) - ''If you'll select male NPC entity later in the Editor, Clothing System will show you list of just "male" items''
 +
#From '''Archetype''' dropdown select from first few starting with underscore. '''_UPPER BODY''' in our case. If you have something from second (chainmail) layer for example - select '''_UPPER BODY 2 '''etc.''- Archetype defines how this item will behave in RPG system and also how it sounds after hit from weapon etc.''
 +
#Browse model&nbsp; '''s1_p2_l1_v0.skin''' in our case #Select '''Morph target''' (blendShape) if you are dealing with [https://wiki.nexusmods.com/index.php/Clothing_Items_Documentation#Base_geometry_with_blendShapes Base geometry]. Otherwise leave it as it is. '''V_001''' in our case #Select '''Material '''- to select right one press '''"Open material editor and select material"''' button. Editor will pop-up and browse to your material and select it. Than go back to Clothing element editor and press '''"Get name from material editor"''' button #Leave everything else untouched and press "'''Apply changes'''" #New item should appear in the list of existing ones
 +
#press '''"Save database"''' - ''top-left corner''  
  
 
[[File:ClothingItemsImage15.jpg|RTENOTITLE]]&nbsp;
 
[[File:ClothingItemsImage15.jpg|RTENOTITLE]]&nbsp;

Revision as of 10:13, 15 November 2019

Asset creation pipeline

Our character and animation pipeline is based on Autodesk Maya at the time of writing this wiki.  However it does not matter where you will create the geometry for characters (3Ds Max, Maya - whatever)  - every geometry has to be skinned, rigged and exported in Autodesk Maya (other software possible but untested).  

General workflow for creating assets for Characters

  • Hipoly mesh in ZBrush / Marvelous Designer
  • Retopology in ZBrush, Maya or 3Ds Max
  • Binding to skeleton and skinning in Maya
  • Export to Cryengine from Maya
  • Texture and material definition in Photoshop, Substance painter/Designer or Quixel Suite
  • Create the Item in Wh_Clothing_Element_Editor  

Maya pipeline

Clothing system differentiate characeters by skeleton. Each skeleton has its own maya scene from which you can create new scene for exporting items. It's a good idea to keep items in one scene for each skeleton. For example characters in KCD have one clothing scene for all male items and one for female. You can find skeleton scenes in perforce KCD folder structure.

  • male (Data\Objects\characters\humans\skeleton\male.mb)
  • female (Data\Objects\characters\humans\skeleton\female.mb)
  • child (currentlyunsupported)
  • horse (WH\Data\Objects\characters\animals\horse\horse.mb)  

For more information about the skeleton go to here

Preparing geometry for export

There are two types of geometry you can use for an item

- used for both types of body slot (see Body Slots ) as an unique geometry, which does not have any blendshapes as a variant (see NPC Character ) like hats, glowes, plate armor etc.   This item could be just binded to the skeleton and exported as it is.  

- this geometry is a container for storing more than one clothing item in one geometry. This is used mostly for 1st ,2nd and 4th layer of body and legs body slot.   Since those items like shirts, pants, gambesons or waffenrocks are very simple shapes we're using just one geometry while variety of shapes and silhouettes is achieved with blendShape targets. 

Item properties

Unique or Base geometry has to have certain properties to work properly in Clothing System. These properties are blendShapes of a various type 

BlendShape Types

  • Proportion blendshape 

- it is used to add different proportions to the characters. We have 3 of them so far

  • Fat
  • Normal (Default)
  • Slim  

- name of this target always begins with prefix "P_" followed by actual proportion. Since the "normal" proportion is default, we have just two of them P_Fat and P_Slim - this target is always Additive to the Variation target. It means that P_Fat or P_Slim will be added on tom of V_ targets and is generic - one for all - there is a possibility to make custom variation target for P_Fat or P_Slim. For example P_Fat is not working well for V_006. So we can create custom V_006_Fat which will be used instead of V_006 automatically in game.

  • Adapting blendShape

- it is most important blendShape target for "Raycast" deformations in game. Without this target Item will not be deformed by other clothing layers - its name is A_Shrink (it is basically item geometry shrink-wrapped to the body

  • Variation blendShape 

- this blendShape could be only on Base Geometry with blendShapes - defines shape of the Item - its name always begins with prefix "V_" followed by number. For example V_001 

Unique geometry Items

  • Open up an existing scene from which we are exporting items (for example s1_clothing.mb) or create a new one from desired skeleton scene (for example male.mb) It should look similar to this:

RTENOTITLE 

  • Import low poly geometry and name it correctrly. *Bind it to skeleton

- general rule of thumb is to use as less joints as possible. So it is good to set " bind to:> Selected joints " RTENOTITLE 

- Max influences parameter has to be equal or less than 4

  • select the mesh and create cryExport Node.

- if you've named it correctly all you have to set is file type > Character Skin (.Skin) and correct name will be prefilled  RTENOTITLE 

now you have this hierarchy

 RTENOTITLE 

  • check number of vertex and UV maps. CryExporter supports just one vertex and one UV map per
    skinned mesh

- according to this page, we have to set the right vertex color. If you're not sure just make all of the verticies white (RGB 255, 255, 255) 

  • assign material

cryexporter can't read material from mesh for some reason (i believe it's a good reason) so we have to set material group before export  

it is good idea to use as less materials as possible to keep scene clean. In our s1_clothing.mb scene we have one material group calledwh_geometry which currently holds 6 materials.It corresponds to the mesh with highest amount of materials. 

In case you are using scene which already has material groups and you have mesh which needs just one material , assign first one from wh_geometry group (facialShader) 

If you are exporting from your own scene, create material group with Mat.Ed tool from Crytek Shelf and hit Add Shaders From Selected Geom   RTENOTITLE 

if the mash has material which is not in any of your material groups, exporter will not export the mesh

  • Export the mesh

- make sure, that 8 weight skin is unchecked (however we're supporting more than 4 weights per vertex ,even if you have more than 4, don't check this. It's crytek's feature and we are bypassing this in code since we are compressing vertex informations somehow - ask lead programmer how it works in code;))  - meshes are exported to the maya scene folder by default. So if you are using s1_clothing.mb it will be exported to ..Data\Objects\characters\humans\cloth\  RTENOTITLE 

  • now you're ready to create clothing item in WH Clothing Element Editor 

 

Base geometry with blendShapes

It has been said, that first two layers on each body part is probably very simple shape. We're using one geometry with blendShapes for those cases. For example p2_l1 (liner on body). There are all shirts and gambesons stored in one geometry. We can definitelly create tons of shirts from single topology - we call that topology "base geometry" for given layer and body part. Let's say we heve new base geometry without any blendShape yet. In other words no shirt or gambeson. Lets create one.  

There is an image below showing base geometry for p2_l1_v0 without blendShapes 

RTENOTITLE 

As you can see mesh is going all the way down so it can store blendShapes for long shirts as well as short ones. If you're working on short one, everything outside of the hipoly boundaries will be masked off in the diffuse texture and clothing system will cut unused polygons automatically in the game. So as an example we will create variation blendShape for short-length shirt. Simple step summary below. *bind base geometry to the skeleton and skin it properly (see Unique geometry Items)

  • import decimated hipoly mesh into Maya *make a copy of base geometry and wrap it around hipoly
  • make a Variation blendshape on the base geometry *bake textures from source hipoly to new blendShape geometry (normal map, optionally diffuse or other channels - see Texture Baking for Clothing Items) *export base geometry  

Import decimated hipoly mesh into Maya

We have Hipoly mesh (created by Michal Hoz) which has almost 13 milion verticies. Decimate this mesh in Zbrush to something around 100k verticies to keep the work fast and easy enough</div>

RTENOTITLE
 

Make a copy of base geometry and wrap it around hipoly

It is not a good idea to make blandShape Target on the original skinned geometry, so make a copy of s1_p2_l1_v0 just by pressing Ctrl + d (duplicate) and name it somehow. Than make the hipoly mesh "Live" (see image below) RTENOTITLE  

Now we just have to wrap low poly around the hipoly to match the shape of the hipoly mesh. It is easier to snap verticies to the live object with "Modeling Toolkit" rather than trying to match it manually.  You can also try to use deformers like ShrinkWrap but its more difficult to achieve good results. On the image below (click on it to see the animated gif) we are snapping verticies to the live object with tweak mode. (Press ` while "move tool" is active - also set some soft selection range by holding "b" while draggind with "left mouse" pressed)  You can also use "Quad Draw" tool to snap verticies onto the live object or relax them. But ...!!! be aware of clicking outside of the verticies because it will create new vertex and if you forget to delete it, blendShape will not work than !!!  RTENOTITLE  
 
Next image is showing wrapped lowpoly. Note that last edge loop of the sleave is slightly outside the hipoly boundaries. Do that if have not enough geometry to wrap it all the way inside the sleave or any other part and you have to mask the end of the sleave in diffuse texture.   RTENOTITLE  

Make a blendshape on the base geometry

Once the mesh is wrapped you can create the blendShape Target.  If you are creating new blendShape deformer like in this case, your target name should be "V_001" because it is the fitrst one. So you can rename wrapped geometry to V_001. Select V_001 than add s1_p2_l1_v0 to the selection and create blendShape deformer. Name it to something like s1_p2_l1_BS for better finding among other deformers. Now you have base geometry with your first Clothing Item target ;)   RTENOTITLE  

 

Bake textures

see Texture baking of Clothing Items (Site not exiting yet) 

 

Export

This step is the same like exporting Unique geometry If you don't have cryExport node created yet, create one and export the mesh.  You have to check number of Vertex and UV maps and set them correctly like for Unique geometry. 

 


Game Editor pipeline

To start putting clothes on the NPC you need some clothing geometry (.skin file see Maya pipeline) from which we'll create Clothing Item in Wh Clothing Element Editor  

Wh Clothing Element Editor

Clothing Item in our game consists of several properties like name, model (.skin file), material, blendShape, archetype, race etc. To create such Item and save it to the database you will need Wh Clothing element Editor   RTENOTITLE   None of your exported meshes will be used in game, until you define an Item in this editor.


Item Definition

To create new Clothing Item you have to open up Clothing element editor and follow simple steps. As an example we'll use Shirt from this chapter.

RTENOTITLE  

  1. Press "New item" button - this will automaticly prefill Name property in the right upper corner of the panel. (MyFirstSomething1)
  2. Change "MyFirstSomething1" name to something more readable e.g. Shirt_001 or Shirt_short #FromGender dropdown select the right one. (Male in our case) - If you'll select male NPC entity later in the Editor, Clothing System will show you list of just "male" items
  3. From Archetype dropdown select from first few starting with underscore. _UPPER BODY in our case. If you have something from second (chainmail) layer for example - select _UPPER BODY 2 etc.- Archetype defines how this item will behave in RPG system and also how it sounds after hit from weapon etc.
  4. Browse model  s1_p2_l1_v0.skin in our case #Select Morph target (blendShape) if you are dealing with Base geometry. Otherwise leave it as it is. V_001 in our case #Select Material - to select right one press "Open material editor and select material" button. Editor will pop-up and browse to your material and select it. Than go back to Clothing element editor and press "Get name from material editor" button #Leave everything else untouched and press "Apply changes" #New item should appear in the list of existing ones
  5. press "Save database" - top-left corner

RTENOTITLE 

Now we have new Item saved in database and ready to use it in NPC Editor. It is not visible anywhere still, but we're pretty close. Read next chapter.  

NPC Editor

Once you've saved an Item to the database you're one step from putting it on the character. We've just created an Item in database, but we have to create an item also for NPC Editor. Why we are creating two Items on different places? Well it's a little bit confusing. The reason for it is variability of a single Item. What we have just created is something like new car, new and shiny, but without any accessiories, paint etc. We can customize it. Same as for cars where we can have one car model but one will be red painted, one green other will have leather seats etc., shirt could also have different colors or textures or even attachments.  

Create Clothing Item in NPC editor

RTENOTITLE  

First of all select some male NPC in the opened level or create one.  Than do following steps:

  • Open NPC Editor and select "body_cloth" slot. Than press "New Item"
  • Change the name e.g "Shirt_short_default" - since we would like to have more color variants for most of the items created from one source item (Shirt_short), we 'll add postfix describing its variant.
  • From "Clothing" drop down select Shirt_shortsource item
  • Press "Save presets & Items" Now you should be able to put your new item into the body_cloth slot and see the result on your selected NPC. 

RTENOTITLE

Kingdom Come: Deliverance: Forum | Before you start | Tutorials & Instructions | Basic Mods | Tools | Documentation | Glossary | EULA