TUTORIAL - Gmax (version 1.2)       Updated Sept. 15, 2008.   By Jytte Christrup.

Lesson 2


We need to talk a bit about polygons and polycount. In Trainz, a model is seen as a series of polygons.

Look it up, and you'll get a very long description of what a polygon is in geometry. Not interesting. All you need to know is, that nowadays it relates to the way a shape is stored and manipulated within a computer.

Why should you even care? Because, like I said, Trainz sees a model as a number of polygons, and the more there are of them, the more power it takes to draw or show them. Aha! Now I've got your attention, right? Because the more power Trainz spend on drawing houses or whatever on your screen, the less frame rate you are going to get.

Have you ever seen assets on DLS, described as "low poly" or "high poly", and wandered what on earth they were talking about? I did.

Now we are going to look at polys and how they're related to our present project.

Open Gmax
 (meaning Asset Creation Studio)

You should be starting in main Toolbar,
and the create tab, when you first open up,
but if you're not, go there now.

We are going to make something different
this time.

Click on the button called "plane"
it will turn orange.

I don't know what your's does, but
my Gmax defaults to 4 segments.

We need to change that to 1 in both,
so type 1 into length and width.

Just like you drew the box in lesson 1,
in top view, draw a square.

It does not matter where or what size.

This time you won't be "pulling it up",
since you are drawing a plane now.

It is only one segment

As you can see the the square or rectangle
is made up of 2 triangles, 2 entities if you will,
which is 2 polys.

Now we go to another interesting tool.

At the far right on your tab row you see
a hammer, that's "utilities", click on that.

It brings up a column of buttons.

Click on "polygon counter"

A "polygon count" window pops up.

And it tells you that you have 2 polys.

If you had drawn 2 planes, and one of them
was selected, it would say
    selected: 2
    total (all): 4

This poly count window you can keep
"floating" on your screen, whenever you
feel the need to do so. Just drag it into
a corner to get it out of your way, and
you can keep an eye on your poly
consumption if you want.

For now, leave the poly counter up.

Turn your attention to the perspective panel

Rotate your plane, so you can see the bottom of it.

Well, actually, there IS no bottom to see.

Reason being, that in Gmax (and Trainz) a plane has a
face (which is visible), and a backside (which is not).

This is important for you to remember.

Now turn your plane right side up again.

Now turn your plane into an editable poly.

Remember from lesson one, that you had to change the object
to "editable" before you can make any changes.

You could pick the "select object" tool and then go to the box,
but if you just right click on your box twice, it will have the same effect:
your menu comes up.

Click "convert to", then "editable poly".

See what happened?

Your plane does not consist of triangles anymore, it is now only 1 entity,
and thus only 1 poly.

Now let's try something else.

Go to "file", click "new"

You get the usual warning if you want to save,
click "NO"

In new scene options, make sure
"new all" is selected,
click "OK"

We are now back to square one.

You will notice, that your poly counter staid up.
That's good, leave it up, just drag it up in the upper right
corner, where it's out of our way, but we can still see it.

In the create tab, make a box,
just like you did in lesson 1.

Your box has 12 polys.

Makes sense, right? A box has 6 sides, each is drawn from 2 triangles,
so that makes 12.

You see now, that whenever you add a shape
(box, plane, or other shapes) to an object, you add polys as well.

The more complex your project gets, the more polys,
and the "heavier" on Trainz .

We can all agree, that less polys is better than more polys.

Let me show you a way to reduce that number as much as we can.

Convert your box to editable poly.

All the planes are now single-entity-planes, and you're down to 6 polys.

Now rotate your box, so you can see the bottom of it.

When you converted your box to editable poly, a familiar panel turned up in the modifier tab.

This time I want you to click on the little red square, called "polygon".

Now click on the bottom of your box to select it
(you can double check on left and front view, that you did in fact select the bottom).

Hit the "delete" key on your keyboard.

Yikes, looks like you just lost most of your model, right?
Actually you did not.

Rotate the box around, and you will see that everything is there
except for the bottom.

Your box has been reduced to a series of interconnected planes,
and as you now know, they are invisible from the backside.

Now rotate your box back to a more normal position,
and it will look quite normal, since it's sitting "on the ground"
so to speak, you can't see the bottom is missing.

Did you notice that your poly count dropped to 5?

And do you realize now, that by getting rid of "useless" planes,
planes that aren't in view anyway, you can reduce your poly count,
thus improve performance, without any impact on your model.
It will still look as solid as ever in Trainz.

Now let's apply our newfound wisdom to the house we made in lesson 1.

Unless you made (and saved ) 10 or more boxes in the meantime,
it should be right in your "recent file list"

As you can see, it has 16 polys.

Chimney, as any other box has 6.

House, we segmented lengthwise as you remember,
doubling the planes on bottom, sides and roof, so it has 10.

Select the chimney.

Pick the "select and move" tool.

Now move the chimney upwards to float over the roof.

Use zoom, drag, and rotate to get a closer look at the chimney
and make sure you can see the bottom of it.

Convert the chimney to editable poly,

click the polygon tool,

click the bottom of your chimney,

delete the bottom,

and watch the polycount drop to 15.

Click the polygon tool again (to unselect it)

then you're back in "move" mode

now gently lower your chimney back on the roof.

Now select the house.

This time I'll show you a different way of doing things.

Notice, that when you selected the house, the modifier tab opens up
pretty much where you left it in lesson 1.

See the window. Every time you use a modifier tool, it adds to the stack.
It's a good thing to "clean up your messes" (in this case, the stack) as you
go along, but you had enough to deal with in lesson one, and I knew we'd
be back in here.

(It was the same thing for the chimney, I just wanted to show you,
that there is more than one way to skin a cat, in Gmax too.)

"unwrap UVW" should be highlighted, if not click on it,
right click, and choose "collapse all", click "yes" in the warning.

You are now back in "editable poly" where we want to be,
and your selection panel is up

Zoom out and rotate the house, so you can see the bottom.

Click the polygon tool, and click the bottom.

Wait, it's a little hard to see in perspective, but if you glance at your left panel,
you will see that only half of the bottom turned red (is selected).

It's segmented, remember. Now, hold down the CTRL-key, and click the
other half of the bottom, they should now both be red (selected).

Now delete the bottom.

Turn your house back to upright position.

See, fine as ever, and none the worse for wear.

But your polycount is now down to 13.

Granted, 3 measly little polys isn't much, but I'm sure you can imagine,
that when you have a complex model with lots of boxes or other shapes,
a few polys here and there add up to quite a bit of savings.

Unselect the house.
Save the file.

Now the only thing wrong with this house is the roof.

When did you last see a house with a roof like this? No, I didn't think so.

Last I looked, roofs have eaves and overhangs and that kind of stuff.
And this one looks more like it belongs in the toybox, not in our virtual Trainz world.

So, how are we going to make a roof?

Imagine, if you would, that we were to make another plane, somewhat bigger than the size of the 2 roof surfaces, that we have already, put together. Then bend it in the middle and "wrap" it over the house. That would work, no? Problem with that is, as you just found out, that a plane will only be visible from the top. If you were to look under the overhang, well you'd see nothing, not so good. Also, roofs are generally not flat. So let's make another box for a roof.

In create tab, click box, and draw a new box, never mind where or the size

First of all, name your new box "roof"

Lenght (front to back) I set to 20'. It does not matter too much, you'll see later why.

Width (side to side) matters. I decided that I want it to be 6" wider than the house on either side, so put 19' here.

Height (thickness) matters too, let's put 4" in here.

Now, we need the roof to be segmented (just like we did with our house) lengthwise, so we can shape it.
So enter in "length segs"

We need this roof to align precisely with our house. We know our house is centered, so if we center the roof as well it will be aligned to the house.

Click "select and move". Then the little x,y,z boxes at the bottom come alive. Remember, that was how you centered the house.
Enter 0 (zero) in x and y, and watch you roof pop right into place.


Now we need to get the roof to the top of the house. We know that the pitch of the house is 25', because we made it so, so enter 25' in z
And that's raised the roof to where we want it.

We need to change the roof, so convert it to editable poly, then click "vertex" in the modifier tab (the 3 red dots)

The next part can be a bit tricky, especially if you have a skinny roof (or other surface). In this case your best view is left panel and perspective.
You need to select the two lower points (vertex) of the roof in the front of the house. You will have to zoom and drag a bit here and there to get them picked.
Remember, they are blue and turn red when you select them, and you need to hold down the CTRL-key to be able to pick more than one.

Once you do, click "select and move" and you can start dragging the bottom surface of the roof (front segment) down into place.
For this particular project, there is no need to get too picky, just eyeball it.

Now you must use "select object" again to be able to pick the next 2, the upper points. Then back into "select and move" to be able to drag them down.
You can zoom in and get as picky as you want in lining up your roof, decide the angles and so forth, but as I'm just showing you how to do these things,
I'm not spending time on that now.

Next, you do the same thing for the other half of your roof. (You can check the y-values for the lower poins if you want to make sure they line up with each other.)

Then uncheck the vertex button, you are done with shaping the roof. ( By the way, if you feel like it, you can raise the chimney up a bit later on)

Don't forget to save your file, whenever you have completed a task.

Now we need some texture on the roof. It's already selected, and it's already editable, so you just go into material editor (red ball), and since "myskin.bmp" is already in there as well,
all you need to do is click "apply". Make sure you use "select object" now.

In the modifier tab, click the "unwrap UVW" button,  click the little
plus-sign in front of "unwrap UVW" in the stack, then click "select face".

Select the top surface of the roof on whatever side is turned towards you,
then click "planar map" then "edit.

You did this enough times in lesson 1, so you should remember how to
map the texture by now, don't forget to use the filter (red triangle).

Repeat on the other side.

Now rotate your house, so you can get a good look at the underside of the roof.
For this surface, pick the dark brown box, and since it's a solid color, there's no need to place your rectangle precisely, as long as it's inside the brown area, you're good to go.

When you go to pick one of the end pieces, you will get a big yellow rectangle,
don't be confused by that, you can tell from the part of the roof (in left panel)
going red, that you have indeed selected that face.

I know that mapping texture is old hat by now,
but wanted to show you this different shape>>

The rectangle (or other shape) in edit window is
automaticall picked for you in the same shape as
the face you selected.

And again, as you are picking the solid color,
it's a snap to scale and move it in there.


So, texture both ends on either side of the house,
and then front and back.

Once you're done with that, clean up your stack.
(right click on "unwrap UVW" and click "collaps all")

Then click outside the house to deselect it.

Save your file.

Not bad, eh.

Your poly count should now be at 23.

But wait, I forgot something, didn't I ?  The "old roof" is still under the new one, and that's a waste of polys.

Not to worry, that's an easy fix, and we don't have to pull the house apart or anything else dramatic to change that.

Just open your file, select (select by name) the house, go to modifier tab, click polygon, and click on the top of the roof.
You can see on the other panels that the "inner" roof is indeed the one selected. Since you only have "house" selected,
only "house" will be impacted by what you do. Now delete this roof part, and repeat for the other side of the roof.

You can't actually see it (without lifting the new roof, and we don't want to mess with that), but when you check your poly count,
you will see that it is now down to 21.

Don't forget to save your file again.

Just one more thing: When you save and export your file, it will revert back to "mesh" as opposed to "editable poly", and that will double your poly count.

So the 21 poly house you just made, will show up in Trainz as a 42 poly (still a very low number). Just remember that.

If you want to check your file (or others'), you can right-click on the file in CMP, then choose "view mesh technical details", and it will give you the poly count, among other details.

You can find more details on this subject in 2006 Content Creator Guide.

NOTE:  As you get into building your own houses, there are two things I'd like for you to keep in mind:

In TRS2006, the ability to height adjust a model is default, not so in 2004. So when you make your config please add the "height-range" tag, to enable 2004 users to adjust your house. Without it, it can be next to impossible to place a building on a slope.

Secondly, if you are placing a house on a slope or uneven ground, no matter how much you adjust the height, it will either appear "floating" or you will loose part of the house (sunk into the ground). For that reason, it is always a good idea to add a pretty high "foundation" onto your house (just make the walls higher, and texture the lower part with black or rocks or whatever). That way, any building can be placed on any slope, adjusted for height, and look perfectly natural.


If you completed this exerise, you should have a good understanding on how to add and manipulate boxes and other shapes to your model. You can make your house, or any other project, as complex as you like. Add an extra box to the chimney for looks, add a carport, an overhang for the door, whatever tickles your fancy. Just remember to keep an eye on your poly count. It's always a balance between perfection and performance.

Now that you've made your house a little prettier, you might want to see it in Surveyor. You don't have to make a new asset for that. You can export your new version of the house right "on top of" your previously saved "myhouse.im" file. Then you open your asset in explorer, copy the new .im file into the folder (replacing the old one), and you're done. You can admire your new version in Trainz. If you saved the previous version as a cdp, you will have to save it again, to get the new version here as well.

Good Luck.