House with Lighted Windows

Home    Tutorials

Introduction:
This tutorial goes over the concept of creating windows that will "light up" when it gets dark in Trainz.

In this tutorial you will be creating a small house, and you will be doing most of the same things as you did in my first tutorial, but the difference is, you will have an actual model that you can use in Trainz.

I have included all the files you will need, including the texture, and I have split the tutorial into several steps.

There are 2 textures you will need. The first one is the building itself, and the second one is the window texture.
They are my design. I took them from the night light sample, so I think you may have them. But here they are in case you do not.
And here is the finished product with the gmax files to play with.

 

Things covered:
Creating a box
UVW Texturing
Using the Edit UVW window
Using the User Grid
Exporting a model
Exporting only parts of a model

I also suggest you get a copy of the Content Creation Guide, available from the download station, and read the pages on Scenery - Page 10.

Startup:

You may want to set your screen resolution to 1024x768, to see the entire screen.

All of the start up procedures you already know. If you don't then please complete my first 2 tutorials.

Run the Trainz Asset Creation Studio, not gmax to get your gmax environment up.

Set the units to inches like this:

From the main menu, select Customize, then Preferences.

Then, under the System Unit Scale, set it to 1 Unit = 1.0 Inches

Then set up the grid and snap settings to 1.0 Feet, like shown below in Figure 1.


Figure 1

Step 1

Now we can get to work.

In the top window, create a box that is 20 feet by 20 feet by 8 feet high. This should be big enough for our small house. (A very small house).

Let's rename our box to house like I have done below.

Now that we have our house renamed, we can texture it.

Open the gmax Material Editor and choose new to create a new texture. Click the Pick Map File Button on the Diffuse tab.

Choose the file name house_highset2_sides.tga, I found mine
in c:\gmax\gamepacks\Trainz\Source_files\Scenery\Nightlight_sample\house_oz_hiset2

If you downloaded my zip file, you will find it in there. Just create a folder in your gmax\gamepacks\Trainz
folder and unzip them there.

Make sure your house is selected, and apply the material to it as shown below.

Now that was not too hard, was it? It's all down hill from here.

Part 2

Now we need to set up the UVW mapping. Choose Unwrap UVW Map under the Modifier panel.


Then choose Select Face

Select a side (face) of your box and press the Planer Map button located at the bottom of the modifier panel.

Now scroll up a bit and press the Edit Map button.

Click the button at the bottom to filter the selected faces, so you don't have to see all the faces on the box. You see only the one you are working with.

If the corner nodes are not selected, you can use your mouse and draw a box around them to select them.

Choose the scale tool and "grab" the corner of the selection window and scale it down to size.

Now choose the move tool, and move the selection window into position.

If you click and hold the move tool, it drops down more tools.
Use these to constrain the movement to left-right, or up-down.

Now that you have the part of the picture you want to use in the selection window, you can close the Edit UVW window, and your box has one side finished!

Do this for all of your other sides, and when you are finished, I'll be here waiting...

Here is my finished house - all textured.

Part 3

Some theory. This is how lit windows in Trainz works: Make a building, texture it, add windows objects, and select all but the windows and export it to a folder the same name as what the building is called, using Export Selected. So far - nothing new.
Now for the windows: create another folder inside the first folder and name it night_windows and choose the objects you want to "light up" in Trainz and export only those objects to that folder with the same name as the folder using Export Selected.
You'll see as we do this.

Now I want to show you how to make your windows. You can make them in many ways, but the window object must be a separate object from your building. I am going to use an object called a Plane. A Plane is a flat sheet model used for anything that you need only 2 sides for. Picture a piece of paper, and you have the concept of a sheet.

The Plane needs to be drawn in the exact size of the window because the entire plane will glow after dark so we go to our front view of the house and right click the words Front in the upper left corner of the window, and a menu pops up like the one below.

Choose Smooth + Highlights to see the side of your building. You should be able to see the textured side of your building.
Now press the W key to zoom our window to the full screen so we can see what we are working on.
Make sure Create is selected and press the Plane button to create a plane. You create the plane by drawing directly over your window in the Front view. Note creating Planes is exactly like creating a box except there is no height to worry about.
Make your plane the exact shape of your window's glass. (Wood does not light up well).

When you are through drawing your plane, right click your mouse to exit draw mode. Your window is located at the center of your house on the grid. Now we have to move it to the outer wall of the house.
Before we lose our focus on our window, let's rename it to Window. See where I put the arrow in the picture above? Wipe the word Plane01 out and replace it with Window.
And set the Length Segs to 1, and the Width Segs to 1.

Press W again to go back to the 4 views.

Right Click the Perspective view. I use Right Click because that is how you select a view without loosing your selection.
If you lost your selection, just reselect it in one of the windows or use the Select By Name Box.

This will bring up the window below where you can select any object by it's name. That's why you should get into the habit of naming all of your objects.

Now you have your window selected, we are going to use the Align tool to bring it to the front of the house.
Click the align tool.

The mouse cursor changes. Click on your house. It does not matter where.
Make sure you have the Perspective view selected, or the X Y Z coords will not be correct. You may use any window for this but take note of the X Y Z positions.
We want to move the window in the Y direction so we click Y Position at the top of our Align Selection window. We also click where it says Minimum in the current object and the Target object. Our window comes to the front of the house.

Click OK to continue. The align tool is used for many things. (I still have not mastered all of it's uses).

Now we need to move our window a little bit farther out from the wall of our house. If it was a box, it would be flush against the house, but since it's a Plane, it may be sitting too close to the wall, and in Trainz it will show dropouts.

I'm going to show you a cool method of moving it without touching it with your mouse. Click the Select and Move tool, then Right Click the Select and Move tool. This brings up the Move Transform Type-In window.
Here you can make fine adjustments to your model. Most of the tools have a box like this.
We want to move our window 1 inch out from our house so we will use the Offset World side of the box in the Y position. (Remember we just moved it in the Y position). And we want to move it out so we use -1" not 1".

Our first window is almost complete. Now to texture it.
We are going to use another texture for our windows - one that will look better when lit.
Keep your window selected and Open the gmax Material Editor and choose new to create a new texture.

In the name box type windows, then click the option for 2 sided textures (yellow arrow). This is so both sides of the Plane will have the same texture and you can copy the window to the other sides of the house without having to re texture them.

Then click the Pick Texture button on the diffuse tab.
Choose the file name night_window.tga, I found mine
in c:\gmax\gamepacks\Trainz\Source_files\Scenery\Nightlight_sample\house_oz_hiset2

If you downloaded my zip file, you will find it in there. Just create a folder in your gmax\gamepacks\Trainz
folder and unzip them there.
Make sure your window is selected, and apply the material to it as shown below.

If your box is still not textured, then click the Show Material Maps In Viewport button a few times (blue arrow).

Now we are going to copy our completed window to the other window's place. Note: the texture of the window should fully cover the Plane.
With the window selected in the front view, choose Clone from the Edit menu and pick OK. Then move your mouse over the X arrow on your window, and when it turns to a plus sign, then drag the window over to the other spot as shown below.

Grabbing by the arrow is a great way of moving something in just the direction of the arrow.

Now let's export our model, then you can finish placing the rest of the windows, and I can get cracking on another tutorial. ;)

Click your house to select it. Be careful to only select your house and not your windows.
Choose Export Selected.. from the File menu and create a new folder in Trainz\Custom\Scenery called lit_house.

Save your model as lit_house.im in the lit_house folder.

From the Utilities tab, choose the Resource Collector button.

Now a bit farther down the same tool tab, under the Parameters heading, choose the Browse button.  This will bring up the Choose Output window. Just click Use Path.
Now a bit farther down the same tool tab, choose the Begin button, and press OK if you get a dialog box that says “No valid gmax File Path”.
This will copy all of the textures to your new folder.

Now select only your windows and choose Export Selected.. From the File menu and create a new folder in Trainz\Custom\Scenery\lit_house  called lit_windows   This will be your windows folder. Save you windows model in this folder and call it lit_windows.im   

Don't forget to run the Resource Collector (above) again on this new folder, or you will not be able to see your lights.

Here is the folder structure:

Trainz
   Custom
       Scenery
          lit_house        <--- This is your main folder
            lit_windows  <--- This is your windows folder

Now we set up our config.txt file. Create a text file in the lit_house folder and call it config.txt.

Here is the contents:

kuid <KUID:12345:28001>
KIND scenery
TYPE Trackside
region USA
NIGHTMODE lamp
NIGHT lit_windows
light 1

kuid-table {
}
obsolete-table {
}
trainz-build 1.3
category-region-0 US
category-era-0 1990s
category-class BR
asset-filename lit_house
username My Lit House
thumbnail
author Gary Parkin
organisation --
contact-email garyp@snip.net
contact-website
license "EULA"

 

<--- Your kuid number


<--- Where to find it
<--- This tells Trainz to turn off the lights after a while.
<--- This is the folder you put your windows into.
<--- Without this, your whole building will glow.
        Makes a cool effect on skyscrapers. :)
<--- Put all pieces' KUID numbers into this if it's a multi piece project.

<--- Nothing needed here either as you won't be uploading this.

 

 

<--- Make sure asset-filename is the name of your folder/asset name (.im)

Save the config.txt file and open Trainz. Start a new map, and choose your house under USA, Trackside, lit_house:

Now lay some track and go into Driver, set the time of day to nighttime like 18:00, and enjoy your creation.

Now go back and copy those windows to the other side, rotate them and copy them to the other sides while I start on my next tutorial.

Have fun!

Any questions, post them, or e-mail me at the bottom of this page.

Good Luck, and happy modeling.

Lookout for more tutorials....

Version 1.1

I am keeping graphics to a minimum, so I have room on the site for important stuff.
          
Created with Macromedia Ultradev