Milkshape Modeling Tutorial for Return to Castle Wolfenstein Part VI -Advanced Skinning

Advanced Skinning using Ultimate Unwrap 3D

Let me tell you there are two ways to do things in life: the hard way and the easy way.

Although the way that is described above about skinning in Milkshape is 100% correct and will work 100% of the time it is not neccessarily the easiest way to skin a model. A better way is to do something called UV unwraping.

What is that?

Imagine a cardboard box. It has 6 sides. In milkshape to texture this object on all 6 sides you would need to regroup the box into 3 groups. Why? Because, as you know from skinning, Milkshape skins an object in the left, right, top, bottom, front and back directions. So you would need to regroup the top and bottom and skin them in the top or bottom view. Regroup the left and right and skin that in the left or right view. Finally make the front and back group and skin that in the front or back view. If you tried to apply the texture to the box as a single group the texture would stretch across four of the faces (try it).

But lets look at the box a different way. What if we could just cut open the box and unfold it so all six of its sides where showing in 2D? Then we could just make one group in milkshape and then unfold the entire group and skin it. Wow that sounds easy! This is what is meant by UV unwrapping – your unwrapping the faces of the model for texturing.

Now some terminology is in order. A UV map is the same as a texture map. What is a texture/UV map? It a map. Think of a regular map. It defines where the hills and valley, rivers and lakes are. Here the texture map defines where the texture is going on the model. This is what you are manually defining in Milkshape when you place groups in a certain orientation onto the texture in the Texture Coordiate Editor.

Now with this in mind, go over to Unwrap 3D‘s website. This is a kick ass inexpensive texturing and unwrapping tool which is compatible with milkshape called Ultimate Unwrap 3D. Go ahead and download the demo version. It’s about 1.3 megs. Also,on the download page go ahead and download the plugins for Quake 3 Arena, Milkshape 3D, and Return to Castle Wolfenstein. Notice there are a lot of compatiblity plugins for this tool.

The demo version is completely functional except for saving. To register it, you’ll need to shell out $30 bucks. They will send you a registration key that gets added to the registry. I would, however, recommend doing this, as it will prevent sleepless nights trying to texture your model.

I know. I know.

 

Exploring the Interface

O.K. Once youv’e downloaded Ultimate Unwrap 3D let’s take a look around. You’ll notice that there are two screens that pop up. The top screen is the “display” screen where you can manipulate the model. The lower screen is the texture map screen, where your texture map will appear.

Let’s look at the menu in the lower texture map window. On the top is the menu bar. To the left is a tool bar with some more commonly used tools. On the right is the “scene” window. This window contains info about groups and materials (like the tabs in Milkshape). In the middle is the big blue screen. This is where you manipulate the texture map. If you go to the Windows -> Hotkeys in the texture window you’ll see all the hotkeys and how to define new ones. Lets look at an example so we can become familiar with what this program does.

Before we load up a model, under the menu go New -> Box. This creates a box in the display window and a few squares appeared in the texture window. Also notice in the scene window is a new group called “box”. Go to the display window and move the box around. Notice that this is a lot like Milkshape in the 3D view. In fact the movement is very similar.

Now right click on the display view. Wow. There are a lot of options. Let’s go over them. The first three are pretty self-explanitory.

      Reset View – recenters the grid

 

      Full screen – goes to full screen

 

      Always on Top – the display window is always the top window.

 

      Next comes undo/redo.

 

      Then you have a set of “interactive” functions. These functions are unwrapping tools. We’ll look at them later.

 

      Camera – lets you manipulate your view of the model a little.

 

      Then comes the animation buttons. There is some cool stuff here. Go to Autorotate -> CW. Your box should be rotating clockwise. Cool. To turn this off just do Autorotate -> off. There is some other stuff on animation here that we will not deal with now, but most of it you can figure out.

 

      Now comes the texturing buttons. This is like Milkshape’s Flat shaded, Smooth shaded, Wire frame, etc. This allows you to view the model in the display view according to what you like. There a few more options here then in Milkshape, though.

 

      The next set describes some vertex coloring stuff. Don’t worry about it.

 

      Then comes delete….

 

      Then comes a few hide options.

 

      Next are the face/vertex manipulation tools. Here you can manipulate faces or vertices on the model in the display. To use the face menu press “S” on the keyboard. The cursor turns into a crosshair. Now select a face in the display window – it should turn red. Right click to bring up the menu again and now look at the face options – the should be enabled. Don’t worry about the vertex menu stuff.

 

      At the bottom are some various tools for showing and hiding stuff.

 

Feel free to play around with these menus to see what they do.

Now go to the texture map window. Click one of the squares that appeared in the texture window. It should turn red. This means you selected that square. Notice that a face in the display window lit up red too. Each of these squares represents a face on the cube. (There are 6 of them). You are by default selecting faces of the box. You can select faces, vertex points, groups or surfaces assigned to a material. To change what your selecting you can go to the menu under Select and change what your selecting.

With that square selected press the “C” key. Now there is a green outline around the shape. Grab one of the corners with your mouse and size the square. The C key is the hotkey for uniform sizing (the sizing is proportional). Now press the “V” key. A yellow outline appeared. Drag the corners around. The V key is the hotkey for rotation. Now press the “X” key. The red outline appeared again. This allows you to move the shape around. So these three keys – X, C, and V are important.

 

 

How to Unwrap

I don’t like the way the cube is unwrapped. Let’s change this. Under the tools menu select Tools -> Unwrap Model. A new box pops up. The first set of buttons ask for the way in which to unwrap the cube. The second set of buttons asks about wheter to separate out the groups when you make the map. The third set asks about the size and shape. Try each of them out and look at the differnce. Try this with some other shapes too so you get an idea of what’s going on. Go to File -> reset and then File -> New. Select a torus and try this.

Notice that you can unwrap the whole model or just a few selected faces with the “unwrap faces” command.

Go back and make a torus from the File -> New menu. Now go to the menu and Select -> All. Everything should now be red. Go to the tools menu again and select Tools -> UV mapping. Before we were unwrapping the whole model. Now we want to unwrap a selection (in this case the whole model but this could apply to groups or faces).

Select “camera” in this menu and you see that the a texture map which corresponds to the display window appears.(For all of these you can select the default “Scale to mapping space”. It’s not that important).

Go back and with everything selected do Tools -> UV mapping ->planar -> one sided. This will generate a texture map from a single side. A box pops up asking you which side you want to make the map from.

      Now try Tools-> Uv mapping -> planar ->two sided. This gives you both sides of the object mapped either side by side or on top of each other.

 

      Now try Tools -> Uv mapping -> box. This will map all 6 sides of the object (like a box).

 

      Now try Tools -> UV mapping -> face. This will attempt to map out individual faces onto a texture map in the way you assign. A box pops up when you do this asking how to separate the faces for mapping. You can map individually separated faces. You can map the faces by making them all equal sized. You can map the faces according to their groups, or materials assigned to them. You can also map faces by their normals. If the face’s normalized vector points in the same direction they’re treated as a group.

 

      Now try Tools- -> UV mapping -> cylinder. This will attempt to map the object cylindrically. Notice that the torus maps pretty well when you check the “capped” box and you map in the Z axis.

 

      Now try Tools -> UV mapping -> sphere. This tries to map the torus as a shpere.

 

Obviously you’ll need to experiment to find the best fit. For the torus I liked the cylinder mapping in the Z axis with a cap. The box maps great with the box map. Because your groups will not be touruses and boxes you just need to play around to see what’s best.

Interactive Unwrapping

When we made all these maps the computer did the “dirty” work for us. But we can gain more control over how the map is created if you use the “interactive” tools in the display window.

Go back to the display window. Make a torus again. Now make sure that you select the torus by doing a Select -> All. Now with the torus selected go to the display window right click and then bring up the menu. Go to “interactive”. Now under this menu there are a number of options. We are intersted in 3 of the options there called “cylindrical”, “planar”, and “spherical”. These options allow you to make a texture map just like we did before with the Tools -> UV mapping -> etc… but now we can control the “look” of the map. This is especially helpful when it comes to weird shaped objects. (Like a head).

With the entire model selected go and do Interactive -> Planar from the right click menu. Notice that a big flat plane showed up on the display window. Notice also that the texture map has changed in the texture window.

Try moving the flat plane around a little. Notice that as you rotate the plane around the texture map changes in the texture window. Very cool. You can change the shape of the plane and how it moves. Go right click again and under Interactive -> you’ll see below the planar, cylindrical, etc. a few more options. These are:

      Move, Scale, and Rotate

 

      Free, X, Y and Z axis

 

These of course allow you to move, scale and rotate the plane you created. The free, x, y, z axis buttons allow you to restrict rotation or movement along those axis’.

O.K. Now that you’ve seen the plane, try the “cylindrical” option. Ohh….. neat.

The cylinder (just like you saw previously) is better for mapping cylinder shaped objects. Try moving it around and rotating it while looking at the texture window.

By the way if you get too out of wack moving the ‘interactive’ around just do a Interactive -> Reset -> All.

Now there is one more thing about the cylinder which is important. That is the seam. Notice the yellow line on the cylinder. That’s where the computer ‘cuts’ to unwrap your object. When unwrapping complex objects cylindrically you want to put the seam where it’s not so visible.

Try the spherical interactive. Notice the yellow line again. This is the seam where the sphere is opened up. Obviously the torus doesn’t map well when using the ‘spherical’ option. Try a sphere instead to see what happens.

The lesson is then, to experiment as there can be many methods of unwrapping an object and some work better than others.

Making and Using a Texture Map

So I hear you say, ‘but how am I to use this with Milkshape models?’. Well lets make a texture map for a model. Get a good model that you like in .ms3d (Milkshape) format. Now in Milkshape export the model as a .md3 (Q3A) model. In the .qc file leave all the textures as their default behavior. The only thing you need to modify is the $model tag. Just give the model a name. The path doesn’t matter. Something like ‘$model “models/players/model/x.md3″‘. Now if you used this .qc file you would export your model as x.md3. Great.

Oh, there is one little bitty thing i forgot to mention. Your animation (if you did any) will be lost at this point. The reason being that .md3 animations don’t reimport to Milkshape once they have been exported. The motto of this story is to do animation AFTER texturing. Sorry. (once you have the texture map however, unless you modify the model significantly, any additional texturing can be done in Milkshape).

Open the x.md3 file in Unwrap 3D. Now if you take a look at your model it should be nice and smooth….. The reason I exported as a .md3 file is that Unwrap apparently tries to weld the vertices on import of an .ms3d which screws up the smoothing groups that are defined by Milkshape. If there is a better way let me know but this way does seem to work.

Go over to the right hand side of the texture window and look at the “scene”. It contains a bunch of groups that you defined in Milkshape and it also has a crapload of skin.tga files for textures. Delete all the skin.tga files by right clicking on the word “Materials” and select “Delete All”. Good riddance.

Go ahead and unwrap the model completely. Select Tools -> Unwrap Model. Pick any combination from the popup. And……. oh my * that looks horrible. The reason is because the computer is trying to do what it thinks is best. Obviously it needs some help. You’ll need to unwrap the model piece by piece. But before you try to tackle that, let’s move on a little.

Just keep whatever map the computer gave you (it probably looks pretty bad). Now click File -> Export -> UV map. A dialog box pops up and with some choices. The first set of buttons asks for the colors to put on the texture map. Choose ‘default color’. The second set of buttons refers to the colors of the lines that divide the surfaces on the model. Choose ‘Use fill color’. This means the lines become ‘invisible’ as they are colored the same as the background. The last set is the size of the file in pixels that will be produced.

You can save the file as a bitmap or a targa. Hit the ‘Preview’ button. Wow. There are so many colors….

This is your texture map. (Finally) Each group is colored differently in the ‘default’ color scheme. (if you don’t like the colors try resizing the UV map ‘Preview’ window).

Try previewing the other options. For instance select ‘Use line color’. Notice the lines are overlayed. Play around with this a little to see the options.

Now if you have registered your copy you can save the UV map as a targa file to your desktop. O.K. go ahead and do that. Now go to the ‘scene’ window and right click on the word “Materials”. Select ‘Add’. A new material pops up called ‘untitiled’. Right click the untitled texture and rename it. Once you rename the material double click the new material. The Material Editor pops up. Notice there are two tabs – Properties and Maps. Select the Maps tab. there is a diffuse map, an opacity map and an options section. Under the ‘diffuse map’ section select ‘Bitmap’ from the dropdown box. Now another popup appears. Select the ‘Change’ button and find the UV texture map you just saved.

Great. Now click O.K., and O.K. to exit. Your now back to the texture window. Under the menu do a Select -> All and then with everything selected go and right click the material you created. Now select ‘Assign’. If you don’t see any change in the texture of the model in the display window, right click the display window and select Textured -> smooth.

Holy * that is very cool. Check out the display window. All the groups from the original Milkshape model are now color coded onto a targa file!

Save your work. Go to Save As and save the model as a Milkshape .ms3d file. Also export the UV (that means the texture map you created in the texture window) so that you can reload it later for editing later. Load up Milkshape and open the new .ms3d file. WOW.

Rethinking your model

O.K. this is cool but the texture file we saved looks a little crappy. You’ll need to go back and make a good looking UV map by unwrapping the groups of the model separately. So now might be a good time to rethink how you grouped your model. Think about what you know about unwrapping, and regroup the model accordingly. If you have 112 groups on your model your in for a long night.

Once you have regrouped the model the best way possible for unwrapping go back into UU3D. Remember to export the model as a .md3 first. We’ll do it again but this time we’re going to unwrap the model by groups. Go over to the ‘scene’ window and open the ‘Groups’ tree. Right click the first group in the tree and choose Select. Your group shold light up red in the display/texture window.

Now think………………………

How do you want to unwrap this group. Go ahead and unwrap it. Now use the X and C hotkeys to move it outside the gray box in the model. (Your mouse wheel will let you zoom out). Do the next group.

Once you have all the groups it’s time to play tetris. Place all the pieces as close as you can in the gray box until you have filled up most of the space in there. Use your X, C and V hotkeys to help you.

Now export the UV. This will save your workspace. Now export the UV map. You want to export 2 maps. The first has ‘default’ selected as the color scheme and ‘Use fill color’ for the lines. For the second map make sure the ‘Fill’ checkbox is unchecked. Now select ‘Use line color’. Preview this. It has only the lines. Save this map too.

O.K. make sure you now delete the ‘skin.tga’ materials as before, load up the new texture map (use the solid color one) and assign the new texture to the model. Save the model as a .ms3d

The only thing left is now to create the texture in photshop or paintshop. You can use the solid colored targa file like a coloring book now. Try to stay inside the lines….. You can also use the file with just the lines as an overlay, in a different layer in photoshop, if you need to see where the surfaces fall.

To make the changes apparent in Milkshape just reload the texture, one you have finshed it and saved it with the same file name, and check out the model.