Mapping Textures

Introduction

For recent versions of Trainz, gmax will not handle the standards for new material types and options such as Specular and Bump or Normal mapping. The Trainz forum has published techniques to update gmax capabilities, and PEV is developing a plugin to implement the new standards and possibilities, which may prove useful. Nevertheless, models made using the basic gmax 1.2 are still suitable for, and function in Trainz TS12.

Mapping a texture to an object for use in Trainz is not difficult. I assume you have some knowledge of creating basic objects in gmax, and will concentrate on mapping two different textures to a building object. The texture for the roof will be tiled, and the wall textures are taken from a complete texture file for the building, selecting relevant parts for the walls. You would make these textures in Paint Shop Pro or Photoshop, to the correct recommended size, and save them as tga files.

 

There are two basic ways to apply more than one texture to one object:

  1. Using standard materials as separate materials, applied and mapped to specific surfaces.
  2. Making a multi-material and designating each face of the object with an ID that identifies the sub material to be applied.

Part 1: Standard Materials

This part will cover the first option, using a material for the sides – using the Unwrap UVW modifier, and a different roofing material that will be tiled, using the UVW Map modifier.

  1. First make a box on the origin, two segments high. In the front view move the top vertices together on to the Y axis, and weld them together to make a pitched roof.
  2. Open the Material Editor
  3. Select New.
  4. Select Standard.
  5. Select OK.

 

You can now choose a material to load in the dialogue screen that opens.

  1. Double click in the black Bitmap square to open the file menu.
  2. Find and select the wall texture.
  3. Click Open to load into the editor.

 

The Material Editor should still be open.

  1. While you should name the material (instead of the Map #6), to be easier to recognise later, I have found that immediately typing in a name now, often crashes gmax, and it has to be reloaded. Come back later and name the material.
  2. With the model building selected, click on the Apply button.
  3. Click the blue and white cube so the texture will show on the model.

 

  1. The building is showing wire frame mode, so press F3 to show the basic brown on the object (true texture will show when mapped).
  2. Press the up arrow to expose the top level Material Editor.
  3. You can click the 2 sided button if that is required.
  4. If you need to go back to the material for reloading etc, click the M button, (our material has been loaded into the Diffuse slot).

 

  1. The Material Editor is still open so press the New button for the second texture, while the screen will change to show a blank orb and Mtl #2 in my case, it did not open the black Bitmap box, it happens.
  2. Click the square button to the right of the Diffuse, to open the bitmap load box.

 

  1. Double click in the black Bitmap square to open the file menu (see steps 6 to 8 above).
  2. Find and select the roof texture.
  3. Click Open to load into the editor.

Do not apply this texture to the building at this time.

  1. Open the Navigator to check the loaded textures
  2. It will likely show no materials, just some standard symbols. Click the Entire button to show all the loaded Materials.
  3. Notice I have now named the wall material “wall”, and the [building] at the end of the name says it has been Applied to our building.
  4. I have not named the roofing material yet (Mtl #2) nor applied it.

 

I applied the wall texture to the whole building first, because it has the most surfaces (walls). Time to map the texture.

  1. Select the building and then the Modifier menu.
  2. Open the Unwrap UVW modifier – immediately the building should show the texture on all faces.
  3. Click the plus sign on the Unwrap UVW heading to expose the Select Face option.

 

  1. Click the Select Face button.
  2. Click on one side face of the building – press F2 to show the selection in red to verify.
  3. Click Planar Map.
  4. Click Edit, the Edit UVW screen opens.
  5. Click the triangle at the bottom (to Red) to limit the vertices showing to only the surface selected.

 

The corner vertices of the wall have been selected and show red, we need to select a pair of vertices at a time and drag them around until they surround the part of the wall we require for the side wall.

  1. Drag the mouse around the two vertical ones on the right, to select them.
  2. Select the Move tool  from the Edit UVWs screen , hold the shift key down and place the mouse pointer over one of these vertices, drag it sideways to where we want it – because we initially selected two, they both follow the movement. The Shift key makes them move orthogonally – horizontally in this case, (the first direction of movement of the mouse).
  3. Drag the mouse around the bottom two vertices, hold the Shift key and push them up the page as before.

 

  1. Close or iconise the screen to the bottom task bar for the time being.
  2. Press F2 to turn the wall from red to normal texture and we can see the selected part is now showing on the wall.
  3. To do more walls, press the Select Face and repeat all the above steps, 29 to 37.
  4. When the walls are finished, you can Collapse the modifier. Right click on the Unwrap UVW and select Collapse All.

If we have to re-open it later, the mapping co-ordinates we have just determined will be preserved, the textures will appear on the walls just as we left them. Don’t forget to periodically save the work, increment on save is useful. Time to place the roof texture and map it using the other modifier, UVW Map.

  1. Select the building.
  2. Select the Modify menu if not already open.
  3. Expand the Editable mesh view so we can choose the Polygon sub object.
  4. Click on one of the roof slopes, and press F2 to verify this selection. Press F2 off.

 

  1. Open the Material  Editor  and the Navigator .
  2. If the last added texture (the custom_orb) is not showing in the Editor, double click the material orb in the Navigator, it shows in the Editor.
  3. In the Editor, click Apply.
  4. Click the blue / white cube to show it on the roof panel.

 

Note the texture covers the whole roof poly we selected, and corrugations run the wrong way. We can rotate the texture 90 degrees in PSP or PS and resave it, or we can deal with it in the Mapping process with a Gizmo. Note also the wall mapping is undisturbed by applying the texture to the selected roof face.

 

To make the mapping simple I will rotate the texture 90 degrees in PSP and resave it. Make sure it is saved as an uncompressed tga file. I will go back to the original orientation later and show how the Gizmo can correct the orientation in gmax, a bit more work. This rotation will make the tiling straightforward. The rotated texture should automatically be reloaded into the Editor.

  1. If the rotated texture were not reloaded, open the Material Editor, make sure we have the correct material showing and press Reload. The grooves should now run down the roof.

 

  1. Select the roof plane again if not already selected.
  2. Click the UVW Map Modifier (for tiling).
  3. Select the Box option – this maps in the vert and horiz axees, not up the slope.
  4. Type in some tile values in the U and V boxes, say 3 and 8. Work out how many horizontal tiles would suit the building and the corrugation sizes, try not to just guess. The vertical tiles of three would show up well if the bottom edge of the tile (sheet) were dirty or rusty.
  5. Collapse the modifier when finished – if you re-open it later, the mapping info will be lost, so get it right, and make a note of the values for later use if necessary.

 

We have applied two textures to the building, and mapped them using different modifiers. We should explore the problem when the grooves run the wrong way. You might have easily used the texture on a number of surfaces as above, and then find that you have an end surface that runs the wrong way. Rotating the texture in PSP or PS now would destroy the earlier work.

For this example, so I do not destroy the existing roof we have mapped, I will rotate the texture back, in PSP or PS, colour it differently and give it a different name. I have added some dirt on the bottom of the sheet so the sheet ends show on the roof. The new material will need to be loaded into the Material Editor as the third texture. Follow the same steps above to do this.

I will place it on the other sloping roof face and map it. Again,

  1. Select the building.
  2. Select the Modify menu if not already open.
  3. Expand the Editable mesh view so we can choose the Polygon sub object.
  4. Click on the second roof slope, and press F2 to verify this selection. Press F2 off.
  5. Click the UVW Map Modifier (for tiling).
  6. Select the Box option – this maps in the vert and horiz axees, not up the slope, all these steps as above.
  1. Click on the plus sign in the UVW Mapping name to expose the Gizmo name. Click on this name (goes blue).
  2. You will see a yellow box surrounding the roof plane showing the gizmo is active.
  3. At the top menu, select the Rotate tool, we will rotate the Gizmo 90 degrees.
  4. At the bottom menu line, select the angle snap tool.
  5. Go to the Top View.

 

Make sure the Gizmo is still active (blue name and yellow box) otherwise we will be rotating the object not the mapping Gizmo and texture.

  1. Place the cursor over the centroid of the box, it will change to a rotating symbol because of step 62 above. Left click and hold and drag away from the centroid, so the yellow box rotates, release when it rotates 90 degrees, the angle snap toggle we chose makes this easy to achieve, verify the angle value in the bottom co-ordinate box.
  2. At the top menu, left click on the Scale symbol and hold down until the non uniform scale symbols show, choose the middle of the three. This allows us to scale on the X and Y axis separately, so we can make the yellow box again surround the roof shape.

 

  1. With the non uniform scale tool chosen (66 above) place the cursor over the green Y axis and the cursor changes shape.
  2. Left click and hold down, and drag the mouse up or down the page until the yellow box touches the top and bottom edges of the roof line.
  3. Place the cursor over the red arrow as before.
  4. Left click and hold down, and drag the mouse up or down the page until the yellow box touches the sides of the roof line.

 

You can drag or push the cursor up or down the page to rescale the yellow box, and if it goes off the top, it will re-appear down the bottom. If you do this in one push, you can read the correct scale change percentages in the bottom co-ordinate boxes. If you raise the mouse halfway through and replace it down on the page to continue, you loose the absolute value of the scaling in the co-ordinate box.

  1. Now go to the tile box and enter in the tiling values, but note that because we have rotated the texture using the Gizmo, the U and V values have flipped (U and V are the local axees of the Gizmo plane, and they rotate with the plane, unlike the global axees X, Y, Z which are constant.

 

Collapse the modifier when satisfied, remember if you reopen it, you will have to start again with the gizmo rotation and scaling, so write the values down.

You could have left the gizmo alone after rotating it (not rescaling to fit) and “guessed” tile value to type in, the yellow box is of course in the ratio of the sides, so you can mathematically work out the correct values.


 

Part 2: Using Multi-materials and Material IDS

Make a new box and load the Materials into the Material Editor  using the following.

  1. Select New to open the material type box.
  2. Select Multi-Material
  3. Click OK

 

A new screen showing the default settings for the materials will open.

  1. The default number of materials is 2, you can change this for more.
  2. Two materials are at present unnamed, with material ID 1 and 2 to the left.
  3. Open the Navigator  and choose Entire to show the materials.
  4. Find the new Multi-Material, two blank slots are shown for the new standard materials.

 

Now load the first material as ID 1.

  1. Double click on the orb for Mtl #0 to open the Editor at the correct level to load the wall material.
  2. Click the square button to the right of the Diffuse label to open the Bitmap load box.
  3. Double click the black square of the Bitmap.
  4. Select the file for the wall.
  5. Select Open to load it – note the following image is a composite from different screens.

 

Now to load the second material as ID 2.

  1. In the Navigator, click the orb of the Multi-Material to show the following screens.
  2. Mtl #0 has the material Mtl #11 loaded as the wall.
  3. This material now shows in the ID 1 slot of the Editor, note ID 2 is still blank.
  4. Double click the orb of Mtl #1 in the Navigator to open the Editor at the correct page to load the correct material.
  5. Repeat the above steps 10 to 13 to load the second material as ID 2.

The two materials are now loaded for the model.

 

  1. Select the building and make sure the Editor is still on the top level (screen above), the Multi-Material.
  2. Click on the Apply button to place both materials on the building at the same time.
  3. Notice that the Show button (blue /white cube) is not active, we need to select each material and Show separately.
  1. Double click on the orb in the Navigator for Mtl #0, and Select the Show button (21) in the Editor. You will notice that the blue orb next to the Mtl #0 will change from blue to red when the Show button is activated. This tells you if a material show be showing on an object.
  2. Repeat step 22 above for the second material, Mtl #1. In the following picture I have named the materials, the Multi-Material is called Composite material, the sub materials are Wall and Roof .

 

Select the new box and convert it to an editable mesh, delete the floor poly as not needed. We need to allocate material Ids to each of the surfaces, to match the wall and roof material. Scroll the Modifier menu upwards to expose the Material ID selections.

  1. Select all the wall polys of the box, and use the F2 key to verify selections.
  2. Type in 1 in the material ID box for the walls, press Enter.
  3. Select the roof polys, and type in 2 in the material ID box.

 

We have now allocated the correct IDs, and notice how the roof takes on a green shade and the walls a brown one. The correct textures will appear after mapping is complete.

Select the box and in the Modify menu select the Unwrap UVW modifier. Notice how the texture now appears. Map the walls using this modifier, just as we did in Part 1 of this tutorial, and collapse the modifier.

 

Select one of the roof polys and open the UVW Map modifier, and tile the roof as in Part 1 of the tutorial, using the Gizmo if needed, collapse the modifier, then do the second roof poly.

You should be able to finish the mapping. The use of Multi-Materials can save slots in the Navigator. You will have noticed that after using a lot of standard materials, the Navigator combines them into different Multi-Materials, and you end up with many entries to sort in the Navigator for later selection. Material IDs can be used to select polys quickly, for instance:

  1. Click the Select by ID button.
  2. Type in 1 and click OK, because the F2 key was on, all the walls show red as selected.

 

Summary

We have mapped the building using two different materials, and using two techniques for combining materials. Once you have practiced the procedures a few times you will find the mapping quite easy to do.

Ian Manion (Vulcan) May 2008

Amendment Notes and Comments

19/05/08 Initial issue.

26 September 2011 updated.