UV Mapping Your Model Using LU

UV Mapping

UV Mapping is the process of mapping every polygon on your 3D model onto part of a flat square. This flat square is jbiwb as UV space. It represents whatever texture you have applied to that particular polygon. So if you map a polygon onto the top left hand corner of UV space the polygon will be textured using the top left hand corner of the texture applied to it. Here's a worked example:

Let's meet the Drakh Raider model:

And here is Lithium Unwrapper:

Click for larger picture

The main window shows UV space. UV space is in fact the square with the grid inside. The grid is just for our benefit and can be turned off. If we load in the Drakh Raider model we can see how every polygon is mapped into this square.

Click for larger picture

Pretty messy huh? This is because there are two textures being used on the Drakh Raider model. Each of the polygons has one of those 2 textures applied. Some of the polygons will be using the same part of UV space but with different textures applied. That white window to the right of LU is the model explorer window. It allows you to select what polygons you want to see in UV space based on the geometry they belong to or the material (colour or texture) they have assigned to them.

You'll notice there are 3 materials listed in the materials part of the model explorer window. There are 2 distinct materials really. It's the same materials used on two different pieces of geometry. That ball at the front and the main ship acts as a destroyable turret so it's geometry is seperate from the rest of the ship.

Let's show the polygons by material, just to see how they're assigned.

LU Showing Material 1

Click for larger picture

LU Showing Material 2

Click for larger picture

LU Showing Material 3

Click for larger picture

Like we said, note how material 3 is actually the same material as material 1. It's just that those polygons on the "ball" are part of a different piece of geometry. This can become quite annoying if you've got a model with 60 turrets, all (obviously) with seperate geometry. They may all use the same material but you'll still end up with 60 different materials when you load the model. One thing you can do whilst working on your model's uv mapping is save and load as LU's native .lum format. This format allows polygons from seperate geometry to use the same material no problem.

Basic Strategy

Lithium Unwrapper does the lot. You can use it to select individual polygons or groups of polygons, map them in a particular way, adjust their position orientation and size in UV space, assign them to specific materials, even create blank template texture files based on the uv space you have set up. The only thing it won't let you do is paint the template textures you create. So you'll need to drop into Paint Shop Pro or some equivilent paint package to do that.

The keys to uv mapping for FS2 are to use the right number of materials and to make good use of the uv space on those materials that you use. FS2 handles texture files up to a size of 512x512 pixels.

Bear in mind that you can overlay groups of polygons on the same part of uv space. So that they use the same part of the texture file assigned to them. They'll appear identical. In this way you can use one part of uv space to make the left side of a ship look identical to the right.

Tools

This is the select tool. It allows you to select polygons from the uv space. To select a polygon, drag a box over one of it's vertices.This will actually select all polygons which are connected to that vertex. So you'll need to hold down CTRL and unselect the polygons you don't want. You can also hold down SHIFT to add to your selection.
This is the move tool. It allows you to move the view using the mouse.
This is the zoom tool. It allows you to zoom in by pushing the mouse forward and zoom out by pulling the mouse back.
This is the box zoom tool. It allows you to zoom in on a part of uv space by drawing a box around it.

Sooner or later you'll forget to turn it off, try and select a polygon by dragging a tiny box over one of it's vertices, and end up zoomed in 35,000x on that vertex. It's _so_ funny.

Menu Options

File -> UV Map -> Save Allows you to save a template texture file based on the UV space you have created. The template texture file only contains the visible polygons.
Groups -> Hide Allows you to hide polygons based on the geometric group they belong to.
Groups ->Unhide Guess

UV Mapping Menu Options

On the Tools -> UV Mapping menu
Decal Applies a flat plane uv mapping to the selected polygons. You can choose which direction you want the plane to be projected. So if you're mapping the top of a ship you'd project the plane top -> bottom. A useful trick is to select the polygons on two sides you want to have the same uv mapping. It'll overlay the polygons for both sides of the ship on the same part of UV space.
Face An interesting one. Maps each face flat individually. Useful if you're thinking about overlaying individual faces one on top of another. It can actually be told to do that by ticking the overlay box. Supposing you have 5 engines with 1 polygon at the back each. Select all 5 polygons. Do a face overlay mapping. Bob's your uncle.
Plane Similar to decal mappign but tries to seperate opposite sides. So if you project top -> bottom it'll try and seperate top and bottom, rather than bundling them together. Generally less useful than decal.
Box Looks at the model from 6 sides. Top, bottom, left, right, back, front. Does a flat projection at each side and puts polygons in the group it thinks they fit best. Useful for getting a general view of a model when you start uv mapping.
Cylindrical A touchy one this. Tries to project cylindrically along a given axis. Useful for mapping... erm... cylinders, and little else. Tick the capped tick box to have the top and bottom of your cylinder mapped seperately. A good idea.
Sphere Built any spherical ships lately?

The UV Space Co-Ordinate System

U is horizontal.
V is vertical.
The top left hand corner of UV space is U=0, V=0.
The bottom right hand corner of UV space is U=1, V=1.

Tutorial 1: Basic UV Mapping

Let me introduce you to the Cobra Mk 3 lone trader vessel. Star of the famous space trading game Elite.

Download this little baby here:

Cobra Mk 3

Load her up into Lithium Unwrapper. This is what you'll get.

Click for larger picture

As you can see I screwed up the UV space good and proper for you. Not that it'll make much difference. UV mapping this ship will take only a couple of minutes. The bulk of the work will take only a couple of mouse clicks. Make sure you've clicked on "Groups" in the material explorer window so you can see all the ship's polygons. Go to the "Select" menu and choose "All". Alternatively use the mouse and drag box select all the polygons. Whichever you're happiest with. Go to the tools menu, choose "UV Mapping" and "Box". Just "Ok" the window that appears. This is what you have now.

Click for larger picture

Lithium Unwrapper has looked at the model from 6 directions. Top, bottom, left, right, front, back. It's grouped the polygons based on which of those directions they face most. As you can see, this is a simple model. LU decided it only needed 3 directions to cover all the polygons. Top, bottom, and back.

One nice thing to note here is that it has made the mapping of each polygon proportional to the size of the polygon on the model. A lot of people who uv map don't generally stick to that principle though. It's popular to give areas which the viewer of the model sees most often (in this case the top and bottom groups) more of the uv space at the expence of other less often seen groups.

The groups by the way are loose. You can pick out any one of those polygons and move it somewhere else. It's probably worth doing for fun. If you make a mess you can always remap all the polygons using box and get back to the above state.

As the uv space stands there's a lot of unused space. Let's see if we can improve that.

Left click on the magnifying glass icon. That's the one with just the magnifying glass. Not the one with the magnifying glass and the box. Hold the left button down and pull back on the mouse. This will zoom the view out a bit. Do that until you've got some nice grey space around the edge of your UV space like this:

Click for larger picture

You can use this empty space as a work area to play with. What you're trying to avoid is getting groups of polygons entangled together. If that happens it'll be difficult to select one group of polygons without selecting the other. Click on the white arrow icon to leave zoom mode and go back into select mode. Select the group of polygons from the back of the ship (the top left group). Right click on your selection. Choose "Rotate" and then "90o CCW" (90 degrees counter clockwise). Right click your selection again. Choose "Expand" and then "All Uniformly". Drag your new expanded polygons down to the empty area off the bottom of uv space.You should now have this:

Click for larger picture

Select the group of polygons from the top of the ship (at the top of the screen). Rotate them 90o CW. Right click your selection again, choose "Scale" then "Arbitrary" Put 1.5 in as both the U and V values, and click Apply Move the group to the top left hand corner of UV space. You should now have this:

Click for larger picture

Select the group of polygons from the bottom of the ship (in the middle of the screen). Rotate them 90o CW. Right click your selection again, choose "Scale" then "Arbitrary". Put 1.5 in as both the U and V values, and click Apply. Move the group and squeeze it in between the top group and the side of uv space. You should now have this:

Click for larger picture

Finally, select the group of polygons from the back of the ship. Drag them to the bottom of uv space.

Click for larger picture

So there's the polygons rearranged to make better use of the uv space available. You can create a template texture by going to "File" -> "UV Map" -> "Save". Give your template texture a name and choose how you want it to look. You can have outlines, coloured groups, or coloured groups with outlines. Then double click on the ship's one and only material in the model explorer window to the right. When the "Material Editor" window appears, click on the "Maps" tab. Pull down "Map Type" and choose "Bitmap". Click on the "Properties" button under the map type pull down menu. Click on change. Point it at the template texture you just created. LU should now show the texture in the background:

Click for larger picture

You can now save your model complete with uv mapping. You have changed the only material on the model to use a texture map with the name you provided. So all the polygons on the model will now use that texture file. If you paint the texture file with a graphics package you can paint up your ship.

Tutorial 2: Mirroring

Keeping with the Cobra Mark 3. Let's assume we don't mind having some symetry in the textures used on this ship. If this is the case we can make the left and right sides of the top and bottom and back of the ship use the same parts of the texture file. This means we'll have more space to play with and can increase the size of all out polygons. Getting better resolution out of our texutre map.

Go to the material editor for our one material, go to the "Maps" tab, "Properties" and "Clear" the bitmap. Otherwise it'll just get in the way. Select the right hand side of the top of the ship wing, as shown below:

Click for larger picture

Flip your selection horizontally. Move your selection over the similar polygons at the otherside of the group as shown below:

Align the vertices as closely as possible. Select all the vertices from the top of the ship. Right click your selection, choose "Weld" and then "Apply". LU will weld the vertices together like so:

Repeat the operation for the vertices from the bottom and the back of the ship so that you have this:

You can then rearrange these new groups to make better use of the space like this:

This is much better use of the available uv space.