Manuel du Modding pour Armed Assault
Home page > Tutorials > Part IV - Advanced Modeling > 4. UV Editor

4. UV Editor

Friday 29 February 2008, by Chris Young, lodu

All the versions of this article:

UV Editor ? What’s that ?

Introduction

The UV Editor, which you can access to by the [UV] button in O2, is intended to deploy the mesh — the different polygons of a model — in a number of flat surfaces which will be used as texture templates.

So let’s open this UV Editor by clicking on this button. You should see grey squares like the following one :

These squares are representing the position of the textures. If you open BIS models and look in the UV Editor, you will see that each texture file corresponds to one square in the UV Editor.

Now let’s look at the toolbar. The purpose of each button is indicated on the screen below (click on pic to enlarge).

JPG - 147.4 kb

There also are two menus that we will be using : menu UV Editor contains a function to export the UV mapping into an emf file which will be used as a texture template.

And menu Filter will be used to select specific textures :

The function we will often use is "Filter by main texture".

Other menus are mostly redundant with the toolbar.

Example

Now let’s open a model. I use a Chernarussian Soldier, and here is how it looks like :

This is the model’s first LOD (1.000)

I assume that this model has previouly been fitted with the correct named selections and that the wheighting has already been made.

We are going to create a rectangular texture (2048*1024) on which we are going to unwrap the whole body, except head and hands which are BIS’ ones.

To do this, select all the faces that you want to work with and copy them ([Ctrl] + [C]), add another LOD (2.000) in the LOD Window, and paste the mesh in it. You should get something like this :

Now we are going to work directly on this LOD. I’m beginning with the suit so I select it, invert selection ([Ctrl] + [I]) and hide ([Ctrl] + [H]) like on the following screenshot :

Behind our model, we can see the yellow wireframe which represents our first LOD. If its annoy you, you can disable it in the Options by unticking "View background LOD".

Now go to the UV Editor and click on "Planar mapping", this brings in the UV Editor the faces like they were shown in O2 :

At this point I must make a precision about the interdependance of actions between O2 and its UV Editor. The mesh shown in the UV Editor looks like polygons, you can select points or triangles and move them, but in fact they are not polygons. The points are UV coordinates, and triangles only represents the faces like they are in the model. The points keep in memory their position in the square in order to directly map the texture on the faces when the texture is laoded. Thus you no longer need to background map your textures like what we did for years with OFP.

So we need to place these UV coordinates in order to fill a 2048*1024 pixels space : that it to say, two squares wide and one square high — in fact the size of a square is defined at the end, only proportions are important.

You can move this first bunch of UVs where you want in the square by drag-and-drop when the cursor represents four arrows.

If the cursor turns to only one black arrow, only the closest point to the arrow will be moved.

You can zoom in and out by using the mousewheel and move the view like in O2, by holding [Alt] and the RMB.

So go back to O2 and select the side faces of the suit :

In the Gouraud shading view, we can notice that the selection is not oriented like the view. It does not matter, we will correct it in the UV Editor. Press the Planar mapping button :

Now we must apply a symetry in order to orient it the right way (symetry button is shown on the screenshot) :

Now go the the other side :

You can notice that the faces are already shown with the good orientation, and in the UV Editor this side "faces" the other one.

We still have to deal with the back and the shoulders.

You can see that I have selected the shoulders, and I chose the Top view in order that a maximum number of polygons are viewed in roughly the same plane.

By the way, you can assign a number to each selection in the named selection window if you want to recall it later.

Eventuelly, you should get something like that in the UV Editor, with selections dispached in the view :

JPG - 63.1 kb

It’s a bit messy, isn’t it ?

So let’s tidy up all that stuff. Select the different parts in order to make them closer of other parts that are close to them in the mesh : the flanks on each side of the front of the suit, and the back at the very right of the rest :

JPG - 76.5 kb

At this point you will need to use the LMB to resize the selection by dragging the grey boxes. The RMB can be used to rotate the selection. To do uniform scales, just hold the [Ctrl] button while scaling.

Then it is time to merge points that need to be merged : select the two points you want to merge and press [Shift]+[D] like in O2.

Here is the final result for the shirt :

JPG - 109.2 kb

Then we need to select the whole thing and place it correctly on the map. To do this, click on the "Fit picture" button to center the view on the base square, and keep in mind that this will be 1024 pixels high.

JPG - 81.5 kb

Adjustments are made according to what you see, so don’t hesitate to zoom in to better see the border line of the square.

Let’s continue with the rest of the body and here is what we get :

JPG - 189.4 kb

The whole map fits into two squares which stand for our desired size of 2048 by 1024. As previously said, at least one point of the mesh should "touch" or be as close as possible to the border of the map.

Before going on, we must make sure that only the unwrapped mesh is present in O2 and in the UV Editor (hence the creation of a LOD for the parts we are unwrapping)

At this point we have a choice between two methods for exporting our work.

Method #1

We save the map in a emf format (Enhanced Meta File) by clicking UVEditor/Export. The following window pops up :

Tick the "specify dimension" button at the bottom, and enter the value 2048 as width and 1024 as height. It is obviously th pixel dimensions of the map we want to create. Then enter the filename you want and save where you want to.

Then, to open this emf file, you will need either Paint Shop Pro or the Draw utility of OpenOffice.org. You can also use the EmfToPng.exe converter that comes with Visitor 3 to convert them to png and then just open them in TexView and save as tga (thanks Synide ;-) ). I used Paint Shop Pro (v6). When opening the emf file, a window opens (sry, only the french version, but it’s quite understandable) :

Don’t click OK but first redefine the size of the map you want : 2048 by 1024 :

Also untick the "keep aspect ratio" button, and click OK.

JPG - 175.9 kb

If you use PSP, you can directly save the map in TGA file that Oxygen can use, an if you use Draw, you will need to first export a PNG image, which you can open in either Photoshop or GIMP to create a TGA file.

Copy this TGA file in the "data" folder of the model, then in o2, select the mapped model and go to Face Properties ([E] key or the green triangle icon). In the window that opens, choose your texture with the folder icon next to the "Texture" textbox, and then click ok and wait for the conversion of the TGA file into a PAA.

Sometimes you will need to do some small adjustments of the UV coordinates : go to UVEditor, and in the "Filters" menu, choose "Filter by main texture" and click you texture name.

Here is the result :

JPG - 155.7 kb

Here is a case that frequently happens : although we have specified the dimensions we want, we still get the previous ones, here 4093 by 1023.

After some tests, I think that the UV Editor is set up in order that the base canvas should be only one of the squares drawn in the UV Editor window.

It also seems that the samble model given by BIS uses this principle of using only one square, no matter the size and the shape of the actual texture : when you open the UV Editor, you can verify that all the textures of the BISoldier are regrouped in a single square, even those which are rectangular.

It is however easy to solve this problem. You just need to take the middle left handle and to drag it to the right until the mesh fits on the texture behind.

Same operation for the height -we need one pixel more to be ok-, and we get this:

JPG - 229.6 kb

Our texture is now applied correctly. Just go into Buldozer and contemplate the good work.

Method #2

The principle of the second method is to "compress" all the UV mesh in one square after you have unwrapped your model, before exporting it into an emf file.

After that step, you should get something like this :

I’ve drawn in blue the handle which you must use to get this result : from two squares wide to only one.

I advise to look for the good dimensions now, before really saving our work. To that purpose, choose export and look at what is displayed in the size box :

As you can see, default size is 2048 by 2048.

Change this by entering the value 1024 as Height, so we get back the rectangle we want.

Then we have our texture in an EMF format we can open with PSP, and the right size in the dialog box that pops up :

If not, just untick the "keep proportions" button ("garder les proportions" here in French), and enter the right size by hand. Usually the difference is one or two pixels. 1025 instead of 1024, or 2046 instead of 2048, etc.

You can also define more precisely the size directly on the UV mesh by pulling the handles of the UV map to perfectly adjust our map to the border of the square (with much help from the zoom in button). The advantage of this is that you don’t need to modify anything to save it into a TGA, everything is already ok.

Finishing

Go back to o2 and apply the texture to the character, as shown in method #1. Here it may be useful to check if everything is fine in the UV Editor. Press F2 to show a field with the name of the texture, click on it to make it correspond with the UV mesh.

JPG - 238.6 kb

If by zooming in, you see that it needs adjustments of one or two pixels, just pull the handles in the right direction to correct it.

When you are done with this polygon set, copy and paste it in the 1.000 LOD in the place of the same part.


Follow-up of the site's activity RSS 2.0 | Site Map | Private area | SPIP