Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Admin of Randomness
retired moderator
Original Poster
#1 Old 8th May 2006 at 8:32 AM Last edited by tiggerypum : 20th Jun 2006 at 11:12 PM.
Default Everything You Wanted to Know About Meshes But Were Afraid to Ask

Everything You Wanted to Know About Meshes But Were Afraid to Ask
or
Meshes, UV Maps and Normals, OH MY!


When delving into the guts of a 3D game, there are all sorts of things one must understand about how the different parts work together and new terminology. This document will take you from the very basic understanding of how a character in the game Sims 2 is constructed to the details of all the little bits that make a body mesh work.

Give the page a few seconds for the graphics to load - the graphics are vital illustrations of whatever's in the text.


Parts of a Sim

In the game, our sim looks like a solid object, all in one connected piece. The reality when we get into the game data, is that the sim is created with parts. These parts each have a mesh (a 3D shape) and a texture (a graphic) that gets applied to the shape.



The data was broken into these pieces to allow us to have a sim with their specific face that can swap hair and clothing at will. The game takes the data (which is stored in separate mesh files) and combines it into the one sim you see in the game. While we are looking at this - you should note that I did not show any sort of body separate from the clothing. That is because the entire sim from the neck down is one piece (or two, in the case of separate tops and bottoms). The sim changes clothing or becomes nude by changing the entire body to another. By keeping the proportions in the body meshes exactly the same, we have the effect as if it is clothing added to the same body, but in reality it's many different body meshes.

We can edit and create new hair shapes and new body shapes. The face/head data is particular to the in-game sim, and generally speaking we do not edit that separately, that is edited using Bodyshop or CAS to create a sim.


A Body Mesh

Just like there are special programs to edit graphics, there are special programs made just to edit 3D shapes. We use SimPE in conjunction with plugins and 3D editors to change the meshes and build new ones for the game.



You will find a lot of information about constructing meshes at MTS2, including about constructing object meshes for the game. Object meshes and body meshes have many things in common, and you can learn how to use your 3D editor to make shapes, and use the UV Mapping utilities while working on either body or object meshes.


Vertices and Faces

A mesh consists of vertices (or points) that are connected together to make flat polygons (faces) in a 3D space. We can see these in our 3D program in a fairly straightforward way, and the 3D program has commands to select and move vertices, and create new vertices/faces.

A face has a front and a back side to it. Only the front side of the face will show texture in the game, the back side is invisible.




Skeleton

Every body mesh has a skeleton. The base skeleton cannot be changed - there is one common set of skeleton values for all adult males, another for teens, another for children, etc. You cannot make your sim taller or shorter, or make the knees bend in a different location; your mesh must adhere to the predefined skeleton, which the game's animations routines will use to animate your sim.



Every single vertex on a body mesh is assigned to animation points (called "bones", "joints", or "envelopes"). These values allow the game's built in animation to move and change the mesh and create the effect of the sim walking, running, sitting, etc. It's important when modifying a mesh that the right assignments are made, or the sim will not display correctly in game. There are special commands in the 3D editor to assign the bones to the various vertices; if you are modifying a mesh extracted from the game, those values are already assigned for you, but you might need to change them depending on the changes you made to the mesh.



Just a bit more about bone assignments - an individual vertex can be assigned to more than one bone, this allows for the smooth bending/blending as the sim moves. For example a short hair mesh would simply have all the vertices assigned to 'head'. Now, if we had long hair: Hair that sits on the shoulders would have the bottom part set to 100% to spine2 (shoulders). The top part near the scalp would be assigned to 100% head. In the rows of vertices between the shoulder and the head, the different rows might be given different values - closest the shoulder might be 75% spine2 and 25% head, in the middle 50% spine2 and 50% head, and near the scalp 75% head and 25% spine2. As the sim turns their head, the hair will stretch smoothly with that sort of assignment.


UV Map

The UV Map is a guide that controls how the flat graphic texture gets wrapped around the mesh for display. Most Maxis body meshes use the same basic UV Map layout, following the layout of the nude skin. When you modify a mesh, you might need to adjust the UV Map, so that new textures can be created for your mesh that will not be distorted. Because the UV Map is _part of your mesh_ it is important to make sure it is working as well as possible also before releasing your finished mesh.



If you are editing a mesh, chances are high you might need to adjust the UV Map for your changes. here is an article about that: http://www.modthesims2.com/article.php?t=135139


Normals

Each face has attached to it smoothing information, called "normals". We can't see the normals data in the 3D editor the way we can see the faces of the mesh; but we can see the effects of the normals, we see arms that look smooth and rounded, when we know they are made of flat polygons. Often when making simple modifications to a mesh, we will not do anything with the normals at all, but sometimes they might need adjusting.



Below you can see normals that need fixing - in the first shot, Dr Pixel had modified a shirt mesh to remove a bow - but that back area looks odd, there are changes in shading making a very visible rectangle. He selected those vertices and used a tool for adjusting the normals, and now the mesh looks totally smoothed out. None of the vertices were moved, only the normals were changed.




Construction

Meshes are constructed in pieces. The edges of the pieces are usually designed to have exactly the same number of vertices. The vertices are aligned, and are given identical bone assignments - thus the mesh behaves seamlessly as if it is one piece. This construction allows for good UV Mapping of pieces of the mesh, and can also allow for sharp edges to be created on the mesh. For simple mesh edits much of the time this will not effect you, but it's good to be aware of. When constructing new pieces to add to your mesh, it might matter where the seams are.



Usually the normals smooth over the seams (or make them sharp edges, depending on the settings). When creating entirely new pieces to add to your mesh, you will want to create them and UV Map them (doing this while creating makes the most sense) with planning. There are times it is very handy to have some parts of the mesh in separate pieces - see this little tutorial by Dr Pixel about adding some custom shoes to a mesh and how he mapped the pieces. http://www.modthesims2.com/showthread.php?t=145153


Morph Data

Most body meshes have morph data associated with them, which cause the mesh to change shape when the sim is fit, fat or pregnant (pregnant morphs are only in selected meshes). This morph data is not actually stored inside the game as another mesh, it has its own special format in the gmdc. In order for us to be able to drastically change our meshes and create matching morph data, many of the mesh editing tools will extract the data and create a second mesh shape for us to modify. Then when we're done, the editing tool will reconstruct the gmdc to include that second mesh's data in the appropriate morph format.



Most of our newer (as of Jan 2006) mesh editing tools allow for support of the morph data. It does involve extra editing to also make the modified morph data, but it is best to include that data - then your new meshes will have the correct shape for fat sims, and they won't look fatter or thinner depending on what outfit they are wearing. Creating a proper morph is vital for separate tops and bottoms; if it is excluded your new mesh will not match up with the other tops and bottoms when the sim is fat.


Bump Map

A bump map is an additional texture file which _some graphics cards_ can use to give the effect of more texture depth on the mesh. It is a grayscale graphic in which the lighter areas will be displayed with the effect of seeming to stick out more. This is just a visual effect that changes the way light shines on the mesh. The abilty of the mesh to have a bump map attached to it is part of the mesh. Some Maxis body meshes were created without bump maps. Some of our editing tools create meshes with working bump maps, and some do not.

In some ways, a bump map is a bit like the normals - it changes how the light shines on the mesh. The difference is that the normals function to smooth over the edges of the faces, and each mesh has only one set of normals with it; the bump map is is a texture file, and can be changed from one outfit to the the next on the same mesh. Bump map data generally should be subtle, and you must be aware when creating your recolors that not everyone's computer displays bumpmaps the same way, if at all.



Again, the abilty of the mesh to display a bump map is part of the mesh file. The actual bump map is stored in the Bodyshop texture file. The file is named "Normal Map" in your Projects folder (to add to the confusion). You will recognise it because it's all grayscaled.

Want to know if your game and/or Bodyshop displays bumpmaps - see the bumpmap tester. Note, if your game does NOT display them, play it safe and always gray out your bumpmaps to one solid color. Bad bumpmaps will ruin a beautiful outfit.

Assigning a Texture to a Mesh

Creating a texture for a mesh is often called 'skinning'.

UV Maps and textures are closely related -- because the UV Map defines *where* the texture will be displayed on your mesh. Each mesh has only one UV Map. Each mesh can have many texture files creating differently colored outfits.

The texture file for a body (or hair or accessory) mesh can be created using Bodyshop to make a recolor. The recolor file contains references that specify which mesh to display that graphic on, along with the age and category information. Note that while a mesh will be designed for a certain age, there is nothing in the mesh file that contains that information, it is in the recolor file.

If you make a new mesh, you MUST include one Bodyshop package with the texture file so that others can also recolor your mesh. If you do _not_ include a texture file, nothing will show up in the game.

Textures can have alpha data with them. The alpha shows where to apply the texture and where not to. This is used on clothing textures - where the alpha is white, the clothing texture shows, where the alpha is black, the skintone texture shows. Alphas are also used with hair meshes -- look at how the hair mesh below is shaped like a solid bowl. This is good, because it's a simple shape. To create the effect of hair strands requires a good texture and a good alpha to go with it. Where the alpha is white, the hair will show up wrapped on the mesh. Where it is black, nothing will show. Yes, that means that for some meshes, you can give the sims a 'haircut' by simply changing the texture files with Bodyshop.



You will find a lot of tips and info for how to make good textures in the Bodyshop - Skinning Forum.


Groups and Material Defintions

Just a couple more advanced bits of information to finish this up: Hair meshes, glasses, and some body files have more than one part to them (sometimes called 'groups'). Hair meshes use separate groups to create a layered hair structure that looks more natural than if the hair was made with a single solid shape. The separate groups also allow for individual material definitions (matd). Materials definitions are settings that control how shiny or not that part of the mesh displays, how alphas are treated, and all kinds of other little things. The matd settings are stored in the recolor files, and can vary from one recolor to the next. You can find a set of articles with specifics about hair meshes in the FAQ/Infocenter, and there's an unpolished but interesting discussion of MATD settings here.


Did you make it this far? Good for you!
If you're just beginning and any parts were confusing, do not worry. You can always come back to review this article when you get to the next level of editing and/or you have some questions.

Was this helpful? Remember that the tutorials and help articles on site have a 'thank you' button below the first message.
764 users say thanks for this. (Who?)
Locked thread
Back to top