View Full Version : Hair Meshing with MilkShape and UniMesh (Beginners)
17th May 2006, 10:09 PM
Please do not post replies or questions in this thread - There is a thread here:
http://www.modthesims2.com/showthread.php?t=159824 for questions related to this tutorial.
This is a beginner's hair meshing tutorial, but it is NOT for absolute beginner mesh makers. It does not cover more advanced mesh changes, but will get you started with basics you must know.
Before attempting hair meshing, you should already know how to make up a new mesh .package and how to do a basic body mesh edit. You should also be familiar with using your 3d editor (MilkShape in this case), and know how to do a basic hair recolor. These are already explained in other tutorials here, and I will not be going over them again.
You will find the basic body meshing tutorial here: http://www.modthesims2.com/showthread.php?t=142305
There are now 3 body tutorials - I suggest doing all three before coming back for this tutorial.
And the hair recoloring tutorial here:
In this tutorial, I am going to try to explain not just the "how", but also the "why" of the various operations. I think this will be more helpful, because if you understand the "why" you will be able to answer many of your own questions and solve the various glitches that are bound to happen.
18th May 2006, 06:14 AM
Before we get started, make sure you have the latest versions of MilkShape, SimPE, and Wes Howe's UniMesh plugins installed.
I am using version 1.78 of MilkShape, v .58 of SimPE, and v 4.06 of the UniMesh plugins - make sure you have these versions or newer.
MilkShape is here:
If you are a registered MilkShape user, all updates are free
SimPE is here:
Wes Howe's UniMesh plugins are here:
The very first thing I do is create a "work" folder on my computer to keep all the files for this project. Make this somewhere outside your Sims game folders, to avoid any chance of interference with the game.
Now start up BodyShop and pick the hair you want to base your project on. Be sure to always use a Maxis hair as the starting point, don't ever use other people's hair mesh without getting their permission! You can easily recognize the Maxis meshes - they will not have the * symbol on their icon in BodyShop.
I have chosen the short ponytail hair for this tutorial - it comes with the basic game so everyone has it, and it is simple enough not to be overwhelming for beginners.
Although the color choice is up to you, I always use the blonde color when making a mesh - it will show texturing flaws more obviously than the other colors so if you get the blonde hair to work right there will be no problems with the other colors.
Export it as a BodyShop project, then import it back into the game with no changes. Close BodyShop, then go to your Saved Sims folder and copy the new .package file into the work folder. Next, create a new mesh .package for the adult version of the mesh, and link it up to the BodyShop .package as explained here : http://www.modthesims2.com/article.php?t=139819
You will want to link up the Adult Female, the Elder Female, and also the Young Adult female if you have University.
Be sure you are linking to the correct 3DIR files - you can tell by matching up the Instance numbers in SimPE. Make sure you check this carefully, Maxis was very inconsistant so you can not rely on the 3DIR files always being in the same location - in this case they are directly above my Property sets, but they could be below them.
Also note that the same age group will not always have the same instance number in every mesh - here the Elder is Instance Number 5, but it could be Instance 3 or 7 in another mesh. So always check the property set name, then match it's instance number to the 3DIR file instance number
Also be sure to delete both the Resource Node and Shape file from your BodyShop .package when you have finished linking it. It's a common mistake to leave them in, and the mesh will seem to work fine on your own computer, but it will cause problems for other people if you leave them in.
An easy check is when you copy your newly-linked BodyShop .package back into your Saved Sims\ folder, Windows puts up a message asking if you want to over-write the existing file. On this message window, it gives the filesizes of both files - they should be the same, or at least very close. If your new BodyShop .package file is larger than the original, it means you forgot to delete the Resource Node and/or the Shape...
It's a good idea, especially when you first start doing hair meshes, to check now in BodyShop to confirm that you have done everything right so far. Make sure you have put a copy of the linked BodyShop .package back into your Saved Sims\ folder, and also a copy of your new MESH .package
Then start up BodyShop, and check by going to the Create or Clone Sims section - don't try to check it by going back to the projects section and re-loading your original project, that often will not work right and you may think a perfectly good mesh is bad.
In the Create A Sim section, clone an Adult Female Sim. Now go to the hair section, and you should see your mesh as the first one in the * color section.
Put it on your Sim, then change it through all the age categories - at this point they should all look exactly like the Maxis original. If any (or all) of the ages have turned into a different Maxis mesh or a bunny head or other glitches, something is wrong with your linking or the way you made your new MESH .package and you must go back and fix it now, there is no point in trying to edit the mesh until you get this part right.
18th May 2006, 07:05 AM
Before we get to the actual mesh editing, there is one more thing I do - I make up a "work" texture image to use in MilkShape.
I start my graphics editor and open up one of the Adult Female alpha images and one of the Adult Female texture images from the original project folder.
It doesn't matter which ones you use, BodyShop will export an image for each mesh group, but on the original Maxis hair each image will be identical.
I use my "magic wand" tool with the tolerance set to 0 to select only the pure black area of the alpha image.
Then I transfer this selection to the texture image, and fill it with a solid blue.
This will clearly show which parts of the texture will be "alpha'd" on the mesh (they will be invisible on the alpha groups, and flesh colored on the "hair" group)
MilkShape uses black for showing "backfaces", and the texture mapping window in MilkShape uses red and white so you should avoid using those colors.
I chose blue here, but any color except red, white, or black will do.
I save the image into my work folder, as "WorkTexture.bmp".
Now open up your MESH .package again in SimPE
Right click on the Geometric Data Container line, and choose Extract on the pop-up menu.
I change the name to "Original_GMDC" and save this into my Work folder
Why not just leave the name SimPE wants to give it? You can, it doesn't really matter - but I find it a lot less confusing to name it like this, and much less chance of me accidentally over-writing it later, or re-importing the wrong mesh file.
My number one rule for mesh editing: Things are confusing enough already, whatever I can do to make it less confusing is the way to go.
OK, now we are finally ready to open MilkShape and get started on the actual editing of the mesh.
20th May 2006, 03:08 PM
Start MilkShape, and on the File menu choose Import/Sims 2 Unimesh Importer.
Open the Original_GMDC file you exported into your work folder.
I want to explain a few of the display options in MilkShape which can make your mesh editing easier before we get started.
Take a look at the 3d view window (if you havent altered the default setup it will be the lower right window) Notice that the inside of the hairmesh is shown as a solid black - this is how MilkShape shows the "backfaces". The faces in the Sims game are one sided, the "front" side of the face will show the texture, the "back" side will be invisible.
To see your mesh as it will actually look in the game, right-click in the 3d window and un-checkmark "draw backfaces". You can check and un-check this option whenever you like.
With "draw backfaces" un-checkmarked, checkmark "colored groups"
This will show each of your mesh groups in a different color. This is very handy with hair meshes, because it is important that the different groups do not ever poke through each other. The different colors make it easy to see if they are all layered correctly.
Go to the Groups tab in MilkShape - this is a good time to learn how the hair layers work.
At the top of the list is the "hair" group. It is colored yellow in the picture. This group is found in every hair mesh. It always has the entire top of the Sim's head (the scalp) included, it also may have parts of the hair - in this mesh it does, the main pony-tail is part of the "hair" group. The alpha on the "hair" group works in a unique way - the black parts of the alpha will show the Sim's flesh color, the light parts will show the hair texture. On the "alpha" groups, black areas of the alpha will simply be invisible. So, if you are adding new parts to a hair mesh, you only want to add parts that will be "solid" into the "hair" group - things like bows, hats, etc. Anything that needs to be able to have invisible or semi-transparent areas must be added to one of the "alpha" groups.
Now let's look at how the "alpha" groups are used.
First notice that there are two "alpha" groups for each part of the mesh. They form the inside and outside of each mesh part. The reason is because of the one-sided faces used in the Sims game. In order to show a texture on both sides of a mesh part, there are two exact duplicate groups for each mesh part - the only difference is that the faces are facing in opposite directions.
When doing any mesh editing, you will want to make sure that you are editing both of the matching groups at the same time. There will be obvious graphic glitches if you get them "disconnected" from each other.
The layering of the groups is also very important. The topmost group - the one that goes over all the other groups, will have the highest "alpha" number - in this mesh, it is named "hair_alpha9", it is the one colored purple.
The matching "inside" group will have the highest alpha number of the inside groups - on this mesh it is named "hair_alpha5" and it is colored light blue.
The next highest alpha group on this mesh is named "hair_alpha7" (shown in red) and it's inside is "hair_alpha3" (green). The layering of the groups corresponds to the name of the group, but it is actually determined not by the name, but by the Opacity setting which is found in SimPE. The UniMesh plugins keep track of the layering (among other things) in the Comments section of each mesh group. To see the Comment for a group, click on the Group name, then click the [Comment] button.
If this all seems confusing right now, don't worry - in this simple edit we don't really have to worry about any of this, I just wanted to make you aware of it for future reference.
22nd May 2006, 12:44 PM
We are going to assign the Work Texture to our mesh - This will give us the option of viewing our mesh with the texture on it while editing, and also will allow using the texture co-ordinate editing features in MilkShape.
This is done using the Materials tab in MilkShape
1} On the Edit menu, choose "Select All"
2} Click [New] in the lower section of the Materials section - a new entry, "Material01", appears in the Materials list
3} In the middle section are 4 buttons, all labeled "none". Click on the large button at the top left - you will get a window where you can choose an image, find our "Work Texture.bmp" and OK it. The button's name will change to "Work Texture" and the display section above will show the texture as it would look if stretched over a ball.
4} Click the [Assign] button in the lower section. The texture is now assigned to all groups of the mesh, although you can't see it yet.
5} Right-click on the 3d window, and checkmark "Textured". Also be sure "Colored Groups" in un-checkmarked
You now have a textured 3d view of your mesh
23rd May 2006, 06:42 PM
Although the UniMesh plugins do import the hair mesh with all the original vertex assignments, there is a problem. On some hair meshes, including this one, there are some vertices partially assigned to hair animation bones. This will not work correctly with the current version of the plugins, so we need to re-assign them.
The easiest way is to re-assign the entire hair mesh - but don't panic, this isn't difficult.
Go to the Model tab in MilkShape
To make sure the entire mesh is showing, go to the Edit menu, and choose "Unhide All"
1} Click the [Select] button
2} Click [Vertex] in the Options section, and be sure "Ignore Backfaces" is NOT checked
3} With your left mouse button, drag a box around the entire mesh
All the vertices of the mesh should turn red
On the Vertex menu, choose the UniMesh Bone Tool
The Bone Tool will allow you to change the assignments of all the selected vertices. You could go through each one and change it by hand, but there is an easy way to change them all at once.
1} Set the Weight of the first assignment to 100%
2} Set the Bone to 7 (head)
3} Click [Commit]
4} Click [Apply To All]
5} Click [Commit All]
The Bone Tool Window will disappear, and all the vertices of the mesh are now assigned to the head.
There is one more assignment correction we need to make - the 5 vertices at the very bottom of the neck must always be partially assigned to the neck, or the mesh will have an ugly gap in certain positions in the game.
Carefully select these 5 vertices at the bottom of the neck
Now use the Bone Tool to assign them 50% to the Head and 50% to the Neck
This basic assignment will work fine for this mesh, and for any mesh with short (not touching or below the shoulders) hair.
Longer hair will need more elaborate assignments, and there is also a way to get back the "swishing/bouncing" effect which is provided by the "b_hair" type assignments, but those are subjects for more advanced editing.
23rd May 2006, 07:53 PM
For this basic edit, all I am going to do is make the ponytail longer and thicker.
First I select all the vertices of the ponytail.
It's not possible to drag a box around just the ponytail without getting parts of the head too, so how do we do this?
It's easy to add or remove vertices from the selection.
First left-click and drag a box around the part of the ponytail that is away from the head.
Now hold down the [Shift] key, and drag another box around some more vertices - the new ones will be selected, and the other ones will still be selected too.
Repeat this until you have all the vertices of the ponytail selected.
If you make a mistake and select vertices you didn't want, you can hold down [Shift] and drag a box with your Right button to un-select them.
Once I have the vertices selected, I click on the [Scale] button.
I set x, y, and z all to 1.1 - this will scale the selected vertices to 1.1 times (or 110 %) their current size every time I click on the [Scale] button in the Scale Options section.
The 3d "directions" X, Y, and Z work like this:
X = left/right
Y = up/down
Z = front/back
So the settings shown will make the selected vertices larger in all directions
I click [Scale] 3 times - each time, you can watch the results in the 3d Window.
That looks about right for now, except I want to make the tail a little wider.
I lock out the Y and Z directions by clicking on their buttons - only the X button is pushed-in now.
Again I click [Scale] a few times, but now the vertices only scale in the left/right direction.
I see that all this scaling has moved the pony tail somewhat out of position, so I click the [Move] button.
I click in the Right view window, and drag the whole tail back into position
24th May 2006, 03:39 AM
Now I want to make the lower part of the ponytail less pointy - this involves just the part that is on the "hair" group, so I first hide all the alpha groups.
On the Groups tab, I click on each of the alpha groups, then click the [Hide] button to do this.
Another way would be to use the Edit menu:
* Select All
* Hide Selection (the whole mesh will be hidden at this point)
Then on the Groups tab, click on the "hair" group, then click [Hide] to un-hide it.
I also have put the Wireframe Overlay onto the 3d view window, by checkmarking it on the right-click menu. This will make it easier to see what vertices we have selected, and also make it possible to select vertices right in the 3d Window.
I now use the Scale tool, again with only the X direction selected, to widen up this part a bit.
Then I un-select the top row of vertices, and scale again.
I repeat this until I have made the whole ponytail straighter, in the side to side sense
When i get down to the very last vertex, the single one at the bottom, scale won't do anything anymore because it is just a single point - it can't move away from itself.
So, I go to the [Move] tool, and move it up close to the bottom of the tail to eliminate the pointy look.
That looks about right.
Then I go to the Edit menu, and choose "Unhide All" to view my entire mesh again.
I notice that some of the other mesh parts are sticking out too far away from the ponytail. I will move them in closer to the tail itself.
In cases like this, I find it easier to select the vertices right in my 3d view window, because I can turn the mesh around to any angle.
To do this, you do exactly the same as selecting in the other windows, except you also hold down the [Alt] key
So, to select in the 3d Window. it is [Alt] plus drag a box with Left button
Add to selection: [Alt] + [Shift] + drag with left button.
Remove from Selection: [Alt] + [Shift] plus drag with right button
This may seem a bit awkward at first, because in the 3d Window you won't be able to see the outline of the box as you drag it. But you will get the hang of it easily, and this will become a very handy feature for your mesh editing.
One at a time, I select the errant vertices, then use the [Move] tool to position them closer to the tail. You can't use "move" in the 3d window, you have to do that in one of the other windows. But keep watching the results in the 3d window as you go. Also use "Colored Groups" to make sure you aren't going so close that sections of the other groups are poking through.
When I am satisfied that everything is looking right, I save this as a .ms3d file for future use.
Then I Export it as a GMDC file to put back into my MESH_ .package. I name it as "Edited GMDC v1" so I can easily recognize it when I get back to SimPE
24th May 2006, 04:33 AM
The mesh is finished, all we have to do is get it back into the Mesh .package
I start SimPE, and open up my MESH_ .package
I click on the Geometric Data Container line
I select the entire filename line in the Plugin View section, and copy it to the Clipboard with [Ctrl][C]
Then I right-click on the Geometric Data Container again, and choose "Replace"
I find my new GMDC file, and OK it.
Simpe will replace the GMDC with the new one, and ask you if it should reload the information. Answer Yes
Then delete the new filename SimPE has given the GMDC, and replace it with the original by using [Ctrl][V]
Click [Commit] and save the MESH_ .package, we're done!
Copy the new MESH_ .package back into your Saved Sims\ folder, and start up BodyShop for a look.
Your new hairstyle should now show like this, and you have successfully done your first hair mesh edit!
This completes the basic hair meshing tutorial, you can now use BodyShop to create new colors for your mesh in the usual way.
I will post future articles when time permits, showing how to add new parts to the mesh and how to convert it for other age groups. But for now, I hope you have learned a little bit about hair meshing. And please do experiment with the various tools in MilkShape - there is always the "Undo" feature if things go wrong. Also read the other articles here, and on other sites - there is a lot of good meshing information to be found.
There is a thread here:
http://www.modthesims2.com/showthread.php?t=159824 for questions related to this tutorial.
vBulletin v3.0.14, Copyright ©2000-2013, Jelsoft Enterprises Ltd.