Tutorial: Adding a pregnant morph (and more)
** Please note I've posted a more complete and improved tutorial on this subject in the "Clothing Meshing for Dummies" thread, including a solution for the problem of CC maternity wear not being used in the game:
http://www.modthesims.info/showthread.php?t=397260
What this tutorial will do:
Show you how to add a pregnant morph to clothing using Milkshape and BodyMorphMaker.
Show you how to use the same technique to modify the other morphs for new clothing meshes
as long as their vertices are numbered properly and exactly the same for the base mesh and the morph mesh.
What this will not do:
Teach you how to use Milkshape or any other meshing tool.
Teach you how to add morphs in more complex circumstances such as Frankensteined meshes or entirely new meshes without the proper vertex numbering. I'll make a future tutorial on those situations once I've had a chance to figure out how to do it!
What you'll need:
Milkshape with Wes's plugins or another meshing tool that can export morphs:
http://www.modthesims.info/showthread.php?t=357403 (make sure you have the latest version)
BodyMorphMaker, available here:
http://www.modthesims.info/showthread.php?t=376753 (again, get the latest version)
CAS Texture Unitool (CTU), available here:
http://www.modthesims.info/download.php?t=364926
Postal, s3pe, Sims3PackageExplorer, or any tool to search, extract from, and import into package files.
Background:
The basics of morphs are fairly straightforward. The CAS part file contains flags defining the age group and gender for the clothing, the category or categories such as Everyday, Sleep, etc., and a set of links pointing to the meshes that define the shape. It also has links to bodyblend files for the four game morphs: fat, fit, thin, and special (pregnant). The bodyblend files have a few more flags and a link to a BGEO file which contains the morph data - coordinates describing how to move the mesh vertices for each morph. The BGEO data is a compressed form of the information in the morph meshes for each morphed shape. Every clothing mesh in the game for teens to elder have a bodyblend and a BGEO for the special morph, including the ones for males, but for clothing that has no pregnant morph the BGEO files have no data.
I'll demonstrate adding a pregnant morph, a task that's not at all difficult even for my beginner's meshing skills. Except for the actual meshing and the modification of the CAS part category, the same steps apply for any of the morphs.
Step 1. First, find and extract the mesh for the clothing you want to add the pregnant morph to. In this case I'm going to use
CTU to extract the tfBodyShirtLong mesh. As long as you're here, also click on the Parts Category tab and tick off "Valid for Maternity" in the Extended Category box. (Note that in order to work, maternity clothing also has to have "Valid for Random" checked.) Click the Apply button and save the package with an appropriate name. Using your favorite package explorer, open the package you just created and extract the CAS part file. (In s3pe, Resource/Export/To file)
(See screenshot 1 below)
Step 2. To make the morph, import the clothing mesh into Milkshape, then go to the Group tab and hide it. Import it again over itself as a second group, open the comments for that second group, and change them to:
FVFItems: 3
TableType: 0
References: 1
TGIRef00: 00000000 00000000 00000000 00000000
This tells Wes's export plugin to export that group as a morph mesh. You need the first group because the exporter needs to calculate the difference between the original and changed positions of the vertices.
Modify lod1 of your mesh by pulling the vertices of the stomach into a pregnant shape. (If you're only doing this as an exercise, don't get too involved in making it perfect.) Keep in mind that what you want is the fully pregnant belly - the game will phase the morph in as the pregnancy advances. Be sure NOT to change the original mesh you imported first - that's why I told you to hide it. When you're done, do the export. Skip the first group (Geom 00) and save the second group (Geom 01) - that's your morph. It's a good idea to save it as a separate file and keep the original mesh - if you want to make changes later you'll need to import the original mesh (and hide it) and then the morph on top of it.
If you want to do a complete job, do the same morph for lod2 and lod3 as well. They are less detailed and are used in the game when the view is zoomed out. For any clothing mod that's going to be uploaded, all the lods should be done since anyone playing using low Sim detail will definitely see them. You don't have to be very careful with lod3, which will only be seen from a distance, and in fact it has so few vertices that it's going to look lumpy no matter what you do.
(See screenshot 2 below)
Step 3. Now, start BodyMorphMaker.
Give a descriptive name for your morph, this case I'll use "tfTShirtLong_special". For LOD1, LOD2, and LOD3, use the 'Select File' buttons to browse for your three morphed meshes. Note that the extra spaces in each lod are for clothing that has more than one mesh per lod. You should enter them in order: lod1, lod1_1, lod1_2, etc.
(See screenshot 3 below)
The Instance ID is a little more complicated and involves two possibilities.
Case 1 - If you're adding a pregnant morph to game clothing, as we are, it's easiest to use the Instance ID that is already in the game. Remember that clothing that doesn't have a pregnant morph has a bodyblend and an empty BGEO; replace the BGEO file with your new one and you have your pregnant morph. There are a couple of ways to get the instance ID. In this case probably the easiest is to click the 'Edit CAS part file' button in BodyMorphMaker and open the CAS part file you extracted from the package
CTU made. Copy the instance number (the number after 'I:') for the Special morph and paste it into the project instance ID. (The same instance ID is used for the bodyblend and the BGEO.) Do NOT click the 'Link to project bodyblend' button.
(See screenshot 4 below)
Another way is to look at the clothing in
CTU - in the Part Details tab you'll see 'TGI Index Blend Info Fat', repeated for each morph, with a number. If you look for that number in the TGI list, you'll find the link to the bodyblend (bblend) file, and the instance is the last hexadecimal number in the key.
Case 2 - If you're making new, non-replacement clothing and want to add a pregnant morph that doesn't affect the original game clothing, you'll have to generate a new bodyblend and a new BGEO, and modify the CAS part file to link to them. Use the 'FNV hash' function in the BodyMorphMaker menu bar and enter a unique descriptive name for your morph - this can be the same morph name you used before as long as it's not the same as the original game clothing name. It will generate a new instance ID for you to use, which you can easily copy to the project instance ID by clicking the Copy button. Then click the 'Edit CAS part file' button and click on the 'Link to project bodyblend' button for the 'Special' morph, and save. This will give you a CAS part file linked to your new bodyblend and BGEO.
Speaking of which, now click the "Create BGEO" button at the bottom. The BGEO file it produces contains the morph mesh information for all three lods. If you need a new bodyblend file for new clothing, click on "Create Blend". This will make a bodyblend file which links the CAS part to the BGEO file.
It's a good idea to save your project to save having to enter all this again if you need to tweak your morphs. The save option is under 'File' in the menu bar.
Close BodyMorphMaker and on to the last step.
Step 4. In this case, since we're doing an added pregnant morph for game clothing, all we need is the BGEO file you made in the previous step and the CAS part file that classifies it as valid for maternity. Use a package explorer to import them both into a new package. (You could try using the package made by
CTU but I've had problems with the instance IDs being changed when I import into them, and they won't work for me.) Put the package into your game and the pregnant morph should work.
(See screenshot 5 below - not the best meshing in the world, but that's not the point of this tutorial.

)
So, to sum up:
If you're adding a pregnant morph to existing game clothing, you need a new BGEO file which will override the game BGEO file and a modified CAS part file to enable it for maternity.
If you're adding a pregnant (or any other) morph to new non-replacement clothing, you need a new BGEO file, a new bodyblend file, and a new CAS part file that enables it for maternity (if necessary) and links to your bodyblend.
A note about VPXY files and the Group ID:
VPXY files are collections of pointers to other files; in the case of clothing they point to meshes. The game files include VPXYs and morph meshes for all the morphs in the game, but they appear not to be used. As far as I know, including them in your package is entirely optional. If you do want to create a VPXY, BodyMorphMaker will do it. You'll need the group ID of the clothing and will have to assign appropriate instance IDs as well as the group ID to your morph meshes. The usual practice is to use an FNV64 hash of your clothing name with the morph name and the lod, for example: cmar_tf_BodyShirtLong_special-lod1, etc. for each lod. If the meshes are named in TGI format, BodyMorphMaker will find the TGIs automatically.
And a few notes about changing or replacing the other morphs:
First, be sure you even need to make a new morph. If you've made new clothing by taking a game mesh and modifying it, as long as you haven't added or removed vertices or changed the vertex numbering or made really drastic changes in the shape, you probably can use the existing game morphs. The morphs consist of how the vertices should be moved to make the body fat, fit, thin, or pregnant - since they will move in the same direction relative to their position as for the original mesh, in most cases it will still work for your changed mesh. This is how
CTU makes new non-replacement clothing with working morphs - it links it to the bodyblends and BGEOs for the original mesh.
If you do decide you need to modify the morph meshes and make a new BGEO, the procedure is basically the same as above. You would generate a new instance ID from a descriptive name, create your new bodyblend and BGEO, and link them from the new clothing CAS part file
CTU created for you.
For the slightly more advanced mesher, Base1980 has written a tutorial on how to make a pregnant mesh by copying vertex information from a game morph:
http://www.modthesims.info/showthread.php?t=398865
Good luck and happy morphing!