Part 3 Meshing Around
Using the gold coin mesh again lets look at the trishape data. This is where the the 3D info is stored.
A 3D mesh is made up of vertices, triangles, normals, UV cooridinates, and sometimes vertex colors.
A vertex is like a point on a graph, but in 3D. It has an x-y-z coordinate. If you’ve used the landscape editor in the CS then you are familiar with vertices. The difference is in the landscape editor all of the x and y coordinates are fixed and you only move the z axis. With a mesh the vertices can be anywhere and everywhere.
Next are the triangles which are a group of three vertices. Also known as polygons, but some 3D apps can use 4 sided polys, MW uses only 3 sided, hence the name triangle. Duh. Polygons face the direction of the order of vertices listed in a clockwise or counterclockwise direction around the polygon. Milkshape3D users will be redundantly familiar with this (hee hee).
Then there are the normals. Normals create the appearance of curved surfaces rather than flat, faceted sides. They’re imaginary rays pointing out perpendicular from the flat surface of the polygons and the vertices where they meet.
Most of the time polygons will have only one side, and one set of normals, but double sided polys will have 2 sets of normals as they render on both sides.
And textured meshes will also have a UV Set. The U and V is simply the X and Y on the texture map. The UV array matches the vertex array and assigns a coordinate on the texture to the vertex.
And finally are the vertex colors, which shade the area around the vertex to the color assigned to it, just like the landscape editor in the CS does.
This mesh does not have them so lets add them.
First I change Has Vertex Colors to yes, then I click the green arrow icon to update the array.
With that done I can expand the array and set colors to the vertices. Click the color wheel icon for the color menu or double click over the hex number to manually input red-green-blue and brightness.
Now I’m going to do some “landscape editing” on the mesh. I select the center vertex of the top part of the mesh. It is number 11 in the array. I set the z axis up 1 unit. Now it’s a cone.
Now for the heck of it I’ll move it’s Y axis over -1.
Now the texture is stretched, I’ll try to edit the UV map to fix it. I set the Y (technically the V) in the 11th vertex of the array to 0.75.
The texture map now looks more like it should.
Nifskope has a special spell for non-uniform scaling of vertices. In other words it can scale the vertices for the x y and z individually.
Let’s say for example I want to make the coin wider in diameter without making it thicker. Using the scale vertices function allows me to do this, without editing each and every vertex coordinate manually.
Starting over with a fresh gold mesh I right click on the first trishape in the block list, select transform, then scale vertices.
A handy window pops up and I set the x and y to 1.2 leaving the z at 1. To reduce scale use decimals, i.e. 0.5 would be half size.
Now I do the same to the other trishape so they match up. If I want to scale it back the way it was I’ll set the X and Y to 0.8.
Another cool thing nifskope can do with mesh shaping is mirroring. It’s a 2 step process.
First you scale the vertices to -1 on an axis. This makes a mirrored image of the mesh, but it will be inside out, the faces will render the opposite direction.
Second you flip the faces around. You could go through the triangle array and reverse the numbers listed in each triangle to fix it, BUT, nifskope has a cool little spell to do this automatically.
As an example lets say I want to put some armor on a skeleton creature only to find that body part meshes have only one side, as the game engine mirrors the mesh when worn on the opposite side of the NPC. Creatures don’t “wear” armor so I’ll have to mirror each mesh my self to make it look proper.
I open the A_Netch_M_pauldron_CL.nif and scale the x axis vertices -1. It’s now mirrored the opposite way but faces inside out.
In the block details of the TrishapeData block scroll down and right click on Triangles. Then in the pop-up select Flip Face.
It now faces outward as it should, and can be pasted onto the skeleton.