Wednesday, January 23, 2013

3DC to Railworks - Making a Speed Warning Sign

Ever wanted to make your own speed warning sign? Chances are someone already has done one for your route already and its just a download away, but I was curious all the same. In this tutorial I will cover the basics, and then explain how the number works which is where the real magic happens. If you haven't made a TextureSet of number textures you should do that first since we will need them later on.

Lets get started...

Put a cube down and scale it so its 12 inches wide (X) and 6 inches tall (Y).


Select all the faces, unselect the front face (shift + click), and delete.3


Select the front face, and under Scripts use 'Shape Builder > DoubleSide'.

Select the front face again, and under Scripts use 'ShiftGroupCenter'. Then select the group, center it on the world (X: 0, Y: 0, Z: 0).

Now shift the component 6 feet above the center so that it will show up in the game as being above the ground. 


We are done with our sign. Now we need to make the faces which will show the number textures.

Using the same steps above create a single face 8 inches wide (X: 0.66) and 6 inches tall (Y: 0.5). You should not double side this face.


Select the face, and under Scripts select 'ShiftGroupCenter' and then move the group under the sign group (so it is a child) and position it so it rests just forward of the sign (X: 0, Y: 6.0, Z: 0.001).

Now divide the face vertically so we have two.

You may not see it, but after you use the Union 3DC will create some extra faces which we do not need and must be removed. Select all faces, then while holding the shift key, click on just the two front faces we need to show the numbers. Delete all the other faces.

Lets assign some LODs and group names.

For the parent group, lets name it: '1_0500_SpeedSign'. For the number group we need to do something special and call the group: 'decal_primarydigits_2'. If your eyebrows are twitching then be aware that this is where the magic happens.


To name a group 'decal_' means that the texture will use 'TrainDecal.fx'. The name 'primarydigits_' is the handle the game engine can use to manipulate the numbers within the GEO file, and '2' tells the game engine that there will be two faces which can be changed.

At this point our simple model is done. Time to texture the model. If you haven't already please have your number textures prepared.

Load your texture up, and paint the sign. For this example I am using a small 32px x 32px BMP colored white. Set the diffuse to 35, the ambient to 4, and the Rail Sim slot to 'TrainBasicObjectDiffuse.fx' leaving the Tx Alpha slot empty.

Now we need to load up our number placeholders.

Load the '0' placeholder texture, and fill the rightmost number face.

Then load the '1's' place texture, and fill the leftmost face. Yes it will be stretched.

In the Rail Sim slot use 'TrainDecal.fx' and in the Tx Alpha slot use 'Transparent' (unless you really want Translucent).

Yes, its important to place them in order (unless you want your numbers reversed). Remember that the game engine is looking for these textures to identify the faces.


At this point we can export the model and start the blueprint.

For your source folder you may want follow RSC's example and use the following structure: 'Provider\Product\RailNetwork\Speedsigns' and place your IGS and ACE files there.

For this example I am using 'TGC\Tutorials\RailNetwork\Speedsigns'


The blueprint you want to create is: 'Speed limit sign blueprint'.

Give it a nice name: "TGC: Speed Warn Sign'

Give it a category of 'Track infrastructure'

Assign it a texture set of numbers. For this step, go down a few folders and open TextureSets. Right click on the number textures you want to use and select 'Copy Filename', and paste it into the 'Primary named texture set' field.

Now you can export and see what it looks like in game.

When you place the asset on the ground you should see the gizmo appear. Just set that to the section of track you want to read the speed from.

Kinda reminds me of an old SP speed sign... hmm...


Extra Credit: You can make a secondary set of digits on a sign to pick up the freight speed limit. I'll give you a hint... or perhaps I just did.


3 comments:

  1. can i create level crossings with this app?

    ReplyDelete
  2. Hello. I have been trying to duplicate your speed warning sign. However, I get stuck at the part where the 3D Crafter Shape Builder is used to create DoubleSide.

    I have the latest version of 3D Crafter (pro) 10.2 (Build 1997) but the Shape Builder menu only has one item in it, namely JavaScript Sample - Create Face.

    Perhaps this script has disappeared in later versions. Would you mind telling me which version of 3D Crafter you used for the example please.

    Failing that, is there another way of making a face DoubleSide?

    Many thanks

    ReplyDelete