Locked thread | Replies: 4 (Who?), Viewed: 21749 times.
Admin of Randomnessretired moderator
#1 9th Feb 2006 at 7:40 AM Last edited by tiggerypum : 23rd Jul 2007 at 8:30 AM.
Hair: Basics and Beyond ArticlesHair: The Basics
Modifying Hair is similar to modifying a body mesh, except that it gets complicated in a couple of different places; here I'm going to give an overview of the differences, and then there are some more in-depth articles by Dr. Pixel and Pinhead that follow.
If you haven't successfully modified a body mesh, the first place to start is with the Unimesh Body Editing Tutorial.
Now the truth is, that tutorial only scratches the surface of what is needed to do advanced edits - there are TWO MORE tutorials for Unimesh, and I strongly suggest you do them all. That will get you familiar with the tools, although they won't turn you into an expert. You can also read Dr. Pixel's tutorial about adding shoes to a mesh to learn about adding parts.
There is also a Beginning Hair Mesh Tutorial that will take you step by step through some simple hair edits, again only covering the basics. Some of the articles here give info for more advanced meshing, and is as 'easy' to explain as we've been able to make it.
Now on to the info about how hair meshes are constructed
A hair mesh, just like a body mesh, has the 4 parts -
Geometric Data Container (the good old GDMC that we get the mesh from)
Geometric Node (GMND)
Resource Node (CRES)
When you build your new mesh file, you gather the 4 parts and fix integrity *once only* and then associate it with a bodyshop recolor.
Maxis named the meshes with their usual naming convention - meshes starting with 'a' are adult, 'c' child... then 'm' or 'f' for male and female. Note that elderly sims use the adult hair, so you will not find any reference to 'e' hair meshes.
You should create, edit and test a mesh for one age first. Once you have done that, you can repeat the process for another age, using the same recolor file, until you have made all the meshes you are going to change.
Hair Mesh Groups
Here's the first thing about hair that is more complex - it tends to be built in several pieces. There's a base 'hair' group, and then there are alpha groups, in pairs, which maxis named with a number - the number corresponds to the transparency code for that layer of hair.
Below is a typical hair mesh inside of Milkshape, using the Unimesh plugin. You can see this hair mesh has 5 parts to it, by looking at the groups tab. Each layer of the hair has an inside and an outside part (the back side of mesh faces do not display in the game). For beginners making changes, the big rule will be to edit those parts so that they stay lined up with each other. Sometimes it's best to hide the other groups and work with one pair at a time.
(Btw, if you want to be able to see how your hair looks with a body or face, you can grab copies of them here: http://www.modthesims2.com/article.php?t=135300 )
While we're talking about alpha groups/layers, we'll touch on the transparency values. If all you do is slightly modify your mesh, and you use the unimesh plugin, the transparency values should be retained.... and they should match the values that maxis used in each alpha group name. Here's a screenshot of what that part of the mesh looks like in SimPE. You can find more details about how transparency should be assigned in Pinhead's section of this article. The important thing to know as a beginner is that the order and layering matters, and you must be careful if you change it.
Attaching the Hair to the Recolor File
Once you have gathered your GDMC, GMND, CRES, and SHPE files, and 'fixed integrity', you need to save out your modified CRES and SHPE files, and insert them into your hair recolor file to point to your new mesh.
The hair recolor file in your Saved Sims folder is much more complicated than a recolor file for an outfit - because all the different ages are in that one hair recolor file. First time you look at this file, you might feel overwhelmed, I did. But never fear, there is a method to the madness.
The Property Sets (in the new simpe) show the name of the mesh - pf is a toddler female mesh, cf - child female, tf - teen female, etc.
Each property set has an instance number in the third column of numbers. That instance number is the same for both the property set and the 3DIR that goes with it. The location of the pieces can be scrambled all over the place, in some recolors they will be neatly located, others the order might make no apparent sense. So just look for those instance numbers. See the pic below.
Once you find the 3DIR for that mesh, that is the spot to insert your modified shape and modified cres, so that now it will point to YOUR mesh, instead of the game mesh. You only need to replace the mesh references for the meshes you are changing, and you will use the *same* modified shape and modified cres for both the adult and elderly references.
** remember to delete the modified shape and cres from the main area each time after you have inserted them into their proper spot in the 3DIR... and remember to 'commit' and save!
Replacing the GDMC with Your New Mesh
Once you are done editing and are ready to put your new mesh/gdmc into your mesh file, there is an extra step not used in body mesh editing.
When replacing your gdmc, it's important to retain the name your mesh was assigned during the 'fix integrity' step. This is covered in Dr Pixel's Hair Tutorial but part if it is written in text. Lunke made this graphic to show exactly where the change needs to be made. Thank you Lunke!
Other bits of Information
If you are using a recolor file from the other sex and switching it over, you need to change the gender reference in every Property Set and in the Hairtone XML. You will also need to make new meshes for at least the adult and teen styles.
When choosing the hair recolor to attach your hair to, be sure that it has the same amount of parts all named the right way - you'll need one texture and alpha for each layer group your hair has. You can change the name (by changing the comments) of your groups to match the hair recolor if necessary.
The Unimesh plugin for Milkshape will get you excellent results, with smooth animations when the sim turns their head, if you assign things well. You can use the Milkshape export, although that has only one bone assignment per vertex, so is best suited for hair that is not long, because it will not animate smoothly as the sim moves their head. You can also use SimPE's SMD Export - each group has to come out and be saved as a seperate file.
Fix the Eyebrows:
Make sure your eyebrow color matches the hair color in your recolors! Info for how to fix it if it doesn't is here.
49 users say thanks for this. (Who?)
#2 9th Feb 2006 at 11:43 PM Last edited by tiggerypum : 25th Mar 2006 at 10:03 AM.
Converting Hair Meshes for Different AgesConverting Hair Meshes for Different Ages
First, some general info about converting hairmeshes to different age groups -
Adult, Young Adult, and Elder for my purposes here will be considered the same age, since they share the same bones and hair meshes, but every other age is different.
Each age group must be exported and a whole new mesh .package created based on it's own age because each uses different bones.
Now here is the simplest method I have found to convert a hairstyle from one age to another - I will explain a simple one, with a matching set of "groups", because it gets much more complicated if the meshs of the two ages have a different number of groups.
I made a new hair mesh from the Maxis "wavy" hair, for the adult first - tested it and got it all working correctly, etc.
Now I want it to work for the teen and the child also - here is what I did:
1} Checked the .bmp images in the hair "project" file I had originally exported from BodyShop to make the adult hair mesh. Good, I see the teen and child also have all the same "alpha" groups and names, so this won't be extremely hard - I see that the toddler's "alpha" images have less groups, so I decide to skip making a toddler version (maybe later if people request it I will)
So, I create two new mesh .package files from the child version, and from the teen, just as I did for the adult. Each must be "fix intergretied" and saved with a different name.
I don't want to repeat all the editing again, so next I open my final version of the adult's mesh in MilkShape. I delete the "hair" group, which in the case of this mesh is simply the top of the Sim's head. I also rename each of the remaining groups by simply adding an "a" to the beginning of the name .Then I export this as a wavefront .obj file Why did i delete the "hair" group? Because I am going to keep the original "hair" group of the other meshes to avoid tricky alignment problems. The "hair" group MUST be aligned EXACTLY as Maxis has it, or there will be problems with the mesh. Slight mis-alignments of the other groups won't hurt anything.
Now I import the teen's hair mesh using the Unimesh Plugins.
I then import the .obj file of the adult hair mesh -
I use the original teen alpha groups as a reference to re-size and re-locate the adult hair mesh parts
Next, I copy each comment from the original "alpha" groups into the adult "alpha" groups.
I delete the original "alpha" groups, and re-name the new groups, taking off the "a" I added before.
All set, except for re-assigning the vertices again.
After doing that I export the finished teen's mesh, and repeat this on the child mesh.
#3 11th Feb 2006 at 2:48 PM Last edited by tiggerypum : 25th Mar 2006 at 10:02 AM.
Making One Mesh Package for Multiple AgesMaking One Mesh Package for Multiple Ages
Originally Posted by EternalxLove26
I'm making a hair mesh and now I need to make it usable for teens. I've downloaded hair meshes that have been for different ages but only use one package file (instead of like 3 packages for each style) How would you do that or is there a tutorial somewhere for it?
Here is how I do it -
1} Make up each mesh .package for the different ages as a separate .package, and do all the editing and testing with them separate.
Be sure each has a different name, and use "fix integrity" with a different name on each. For simplicity, what I do is add the age into the name, like this:
Adult mesh = "MESH_DPXL011006adultWavyHair.package"
Fix integrety = "DPXL011006adultWavyHair"
Teen mesh = "MESH_DPXL011006teenWavyHair.package"
Fix integrety = "DPXL011006teenWavyHair"
This will make sure each component has the age in it's name, it will make it easy to know what parts are what later on if you get confused.
Link each to the correct age group in the same original BodyShop hair color .package.
2} Once you are sure that everything is working right, for all the different ages, it is simple to combine them all into one mesh .package -
3} Decide which .package you want to use as the main .package - I always use the adult's, but it really doesn't matter.
4} Create a new folder for the other age groups - I name these "child_parts\, teen_parts\ to make it easy.
5} Open Child's mesh .package in - one at a time, I right click on each of the 4 parts, then Export it into the child_parts\ folder
6} Open Teen's mesh .package - export all 4 parts into "teen_parts\" folder
7} Open the Adult's .package - immediately save it with a new name - I simply remove the word "adult" from the name, or replace it with "all":
DO NOT use "fix integrety" on this .package - this is extremely important, just save it with the new name. Using "fix integrity" will unlink all the files and you will have a real mess!
8} Right click on the file list, and choose "Add"
9} Open the "teen_parts\" folder and add all 4 parts - DO NOT USE "FIX INTEGRITY" or any other features in SimPE, just add.
10} Repeat for the Child's parts.
You should now have a set of 4 files showing on the files list for each age.
Save the file, you're done.
Remove all the separate mesh_ .package files from your game, and replace them with this one mesh_ .package
#4 7th Mar 2006 at 2:47 AM Last edited by tiggerypum : 25th Mar 2006 at 10:04 AM.
Thanks: 1414 in 9 Posts
Hair Layers and TransparencyHair Layers and Transparency
It the simplest form, if you have not rearranged the layers or added new parts to your hairmesh:
After you click on Geometric Data Container, go to "Items 3" tab.
There you will see the group names (hair, hair_alpha3, hair_alpha5,.. and so on)
Select one of the alpha groups. I will try to explain how this works,
but it's a little complicated.
If the number of the alpha group is 3 you need to change the opacity
(third box) 0xFFFFFFFF to 0x00000003.
hair: Opacity= 0xFFFFFFFF
hairalpha17: Opacity= 0x00000011
hairalpha15: Opacity= 0x0000000F
hairalpha13: Opacity= 0x0000000D
hairalpha11: Opacity= 0x0000000B
hairalpha9: Opacity= 0x00000009
hairalpha7: Opacity= 0x00000007
hairalpha5: Opacity= 0x00000005
hairalpha3 Opacity= 0x00000003
You can use a little tool in to convert the
decimal numbers to hexadecimal. Menu "Tools/Hex<->Dec converter"
remember, after 0x will be always 8 numbers. No more and no less.
The hair group will always have the opacity 0xFFFFFFFF
Now, if you are doing substantial editing on your hair mesh, the layers might not always correspond anymore to the original arrangement, so here is the complete explanation:
Well, my english is not too good. But I will try to explain the "rules" that I learned for layered hair meshes and the opacity.
For example: After the hair group the first layer set will be "alpha3" (with texture set inside) and "alpha5"(with texture set outside)
The alpha 3 uses a value (0x00000003) for opacity and alpha 5 is 0x00000005.
If there is another layer set that covers the alpha3 and alpha5 group, it will use other value higher that both (alpha3 and alpha5) groups for the group that has the texture outside but have to use a low number for the layer that has the texture inside. So, you will need to change the alpha3 and alpha5 to be higher value that the next layer with textures inside... The external groups will use 00000003 for inside texture and 0x00000009 for outside. and the alpha3 will be changed to 0x00000005 and alpha5 to 0x00000007.
So, in fact you need to pay attention on the layers and not in the name of the group (if you aren't just changing positions of vertices of a maxis mesh). If you have or create one layer on top of another, you need to add a value higher for the top layer.
Make sure that you are splitting each layer in a separate group, to use a separate opacity value for each layer. You will need that to prevent transparent edges and set a correct value on all layers.
The layers with inside textures will have values starting from the top layer to the lower layer. And those layers have to use a value lower than all layers with textures outside.
if your mesh has 4 groups;
alpha 3 - textures inside - top layer
alpha 5 - textures inside
alpha 7 - textures outside
alpha 9 - textures outside - top layer
alpha 3 is the same mesh as alpha 9, but both differs from textures inside/outside
alpha 5 is the same mesh as alpha 7, but both differs from textures inside/outside
to set the opacity values you have to start from the groups that have textures inside the mesh. The lower opacity value (0x00000003) will be used in the most external layer (above all others)with textures inside.
so, if you understand this example, alpha 3 is above alpha 5.
so, alpha 3 covers alpha 5 and have to use a lower opacity value that alpha 5.
*set alpha 3 to 0x00000003
*set alpha 5 to 0x00000005
Now that you finished the "textures inside" layers, you need to start the layers with "texture outside" and the first value to set will be "0x00000007", since the layers with "textures inside" finished with "0x00000005". You will need to use a higher value to the layer that is above all other layers with "textures outside".
alpha 7 is below alpha 9.
So, alpha 9 is above of alpha 7 and have to use a higher value that alpha 7.
*set alpha 7 to 0x00000007
*set alpha 9 to 0x00000009
Resuming: The best thing is split each layer in a separate group and give opacity values looking in the original mesh, to make sure what layer is above or below the other. And don't care about the name of the groups but the location in the mesh itself.
It's really hard for me to explain better. sorry.
Admin of Randomnessretired moderator
#5 18th May 2006 at 11:57 PM Last edited by tiggerypum : 23rd Jul 2007 at 8:35 AM.
Adding GROUPS to your hair meshAdding GROUPS to your hair mesh
By far the easiest way to work with a hair or body mesh is to choose a base hair/body that has the _number of groups_ you need.
You can regroup parts of your hair mesh to become one piece, although you will do well to construct your hair in ways similar to how Maxis hairs are created.
There is the hair repository which has info about some of the Maxis mesh hairstyles and how many groups they have which can help you pick a good base mesh to work with here: http://www.modthesims2.com/showthread.php?t=149677
Melodie9 has created some meshes for other ages, including toddler and child meshes - that have the same number of groups as their adult counterparts. She graciously allows people to clone her meshes as a base for your new meshes.
Here is an article about how to add groups to a hair mesh (or body mesh). Complicated, but certainly possible to do.