• Welcome to SC4 Devotion Forum Archives.

Transit Texture Tutorial

Started by jplumbley, March 15, 2008, 10:08:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Creating Transit Textures

0.  Intro

Transit textures are not so hard to make, in fact they arent any harder than making standard textures.  There are a few differences though between transit textures and standard textures.  Just like with standard textures there are base and overlay textures, but they are sidewalk (base) and the road surface (overlay) textures.  I will explain when and how these textures are used as well as how to create them.


Beginner to Intermediate Level Modder (comfortable using SC4Tool)
iLive's Reader
Photo Editor (perferably one that can deal with layers such as Photoshop or Paint Shop Pro, but of course any photo editor will do that can save in PNG format)

1. Extracting Textures

This section will explain how to extract any texture from a given DAT file including the MAXIS simcity_*.dat files.  You will be using iLive's Reader and FSHman in this section.  Extracting textures can be benefitial when making adjustments to existing textures, such as making a Euro Texture Mod.

We must start in iLive's Reader.  First you must open the texture DAT that you are looking for in iLive's Reader, then select all the the textures you want and copy them into the Blank.dat as shown.  Remember you dont need all 5 views of the textures, just the 04, 14, 24 and 34 textures (128x128 pixels).  When you re-import the texture into a DAT later, you will only need the 128x128 pixel texture for all 5 zooms.

When you have all the textures you want goto File -> Export All Files..  Before you do this, I suggest that you create a "working" folder for you to extract the textures to.  When you extract the files it will extract the files into two files, a FSH file and a TGI file.  For us the TGI file is useless and you can remove it.  The FSH files are what we are looking for.

Now we are done with iLive's Reader, you can close it and you dont have to save anything.  We now need to work with FSHman.  FSHman cannot open DAT files so we must open each FSH file that we extracted separately and save them as PNG files.  To do this select File -> Open and click on the *.FSH file.  Then click on the #1 under Bitmaps and then click File -> Save as..  Save the file as a Portable Network Graphic (PNG) file.

Now you are able to extract existing textures!

2.  Texture Specifications

The most important transit texture specification is the IID.  The IID is the piece of information that the RULs and EXE will reference when looking for a texture, if it is wrong your texture will not work in-game.  This is how texture IIDs are designed.

MAXIS IID Structure for Transit Textures:


n = network ID
pppp = piece ID
w = wealth of texture
z = zoom of texture

Network IDs MAXIS used:
0  Road
3  Rail
4  Avenue
5  Street
8  El-Rail
9  One Way Road
A  Highway
C  El-Highway
D  Monorail

*I forget off hand what the other network IDs are, but I will update this later when I remember.  Others include Power Lines (2?), Water Pipes (6?), Subway

NAM Texture IID Structure:

Originally, the texture IIDs used to be based off of a time stamp, but we have since reached the end of that time stamp and we could potentially start creating conflicts.  Now we have come up with a solution to this and there is a new structure that is being used for projects like SAM, RHW, TLA and HSRP.  Any new textures will be assigned a range and any new transit textures will have to be syncronized with the rest of the NAM before release.


5 = NAM range
rr = project range
ppp = piece ID
w = wealth of texture
z = zoom of texture

0 = No wealth..... This has no sidewalk texture underneath the road surface texture
1 = Low wealth
2 = Medium wealth
3 = High wealth
4 = Low wealth (Medium and High Density)
5 = Medium wealth (Medium and High Density)
6 = High wealth (Medium and High Density)
7 = Agriculture

*Note Wealths 4 through 7 default to wealth 0 if no texture exists.  Wealths 0 through 3 are required for ingame to work properly.

Zooms: (pixel size)
0 = 8x8
1 = 16x16
2 = 32x32
3 = 64x64
4 = 128x128

3.  Creating Textures (Overlay Textures)

Road Surface Textures are exactly what the name portrays, they are textures for the road surface of the network.  There are many textures required for a network and they are different for each network.  I cannot really give a list of every texture, because there are too many to name, so it is best to extract the originals themselves for guidence on that.

Now, of course there are a few things that these textures are comprised of... The road surface, curb and grass as shown in the following texture.

Some of you may wonder why is there no sidewalk on this texture.  Well, this is because the sidewalks are actually an underlay that goes under the road surface.

So, now you are wondering, I have shown a texture with the whole texture covered and there is no invisible parts to show the sidewalk through.  You, would be right, I still would have another another step to do before I import the texture using SC4Tool.  This step includes the creation of an Alpha Texture.

An Alpha Texture is a texture that where there is Black it erases anything from that part of the texture and where there is White it keeps whatever is on the texture.  So, for all intensive purposes:

Black = where the sidewalk will go
White = everything else

This is an Alpha Texture.

This is the Alpha Texture overlaid onto the texture and made 50% invisible so it will give you an idea of what I am talking about.

For the sidewalk textures there are 4 and only 4 textures in the game.  No more, no less.  These 4 textures are wealth based and are used when the neighboring lot is of a certain wealth:

IID = 0x0840000z     Rural Wealth
IID = 0x0810000z     Low Wealth
IID = 0x0820000z     Medium Wealth
IID = 0x0830000z     High Wealth
*The z is the zoom view of the texture.

Now, I am no expert when it comes to physically designing and creating the texture because that is your job.  My specialty is taking existing textures and making more out of them using parts of the originals.  But...  You have the idea and you can bring that idea to life, I will just help you with getting it into a texture DAT now.

Using SC4Tool, we will be putting these textures into a texture DAT.  So, to start, open SC4Tool and select "Create your own textures".  Then hit the star to create a new texture DAT from scratch.  To import the textures you now want to hit the picture next to the star.

First thing you need to do is set it so that you are creating a Traffic Texture by hitting radial button.  Then you want to hit the folder next to the 128x128 Bitmap to load the road surface texture, to apply the 128x128 size to all 5 zoom textures just hit the little camera.  Do the same thing for the Alpha Map and your almost good to go.

The final thing that you need is the texture IID, this is something that you should know before you start importing the texture.  Do not ever click "next free IID", you need to know what texture you are replacing or adding.  If you are adding a texture, the person writing the RULs will tell you what IID you need.  If you are replacing a texture, the original texture will tell you what IID you need.  This is the most important thing, because the IID is everything when it comes to Transit Textures, unlike with Standard Textures.

Another thing to think about when creating textures is the orientation.  If the texture is a replacement, you MUST remember to have it rotated so that the entrance/exits of the tile are in the exact same places as the original texture.  RULs define when and at what orientation the textures will show up at and if you are replacing the texture its easier to make the texture properly rather than change the RULs to fit the new texture.

Sometimes, it is possible to use the same texture over and over.  For example, sometimes in the past for a replacement of the Avenue 4way Intersection the creator made 4 different textures, one for each tile in the intersection.  But, through the use of RULs, it is possible to create that whole intersection with one texture.  So, this is a caution to be mindful, think about how the textures will be used, if you can reuse a texture for something it is always the best thing to do.  Always make it as simple as possible.

Now we have the textures into a DAT and you are ready to test away.
"You learn something new everyday."

Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM


Great tutorial, It was worth the reading. will look to it again later. Keep Up The Great Work!
Your Friend;
Mayor Of Steven's Point & Maxiston
(Proud To Be Cities Of Sim Nation!)


Thank you, valuable info here.

Can you tell me what is the width (in pixels) of the side walks on the 128x128?

edit: oops  ::) nm I'm dl the picture you gave. It's 16px wide.


Is it okay if I do a little thinking out loud and ask if I'm wrong?  This is turning into a tutorial of sorts I suppose so I hope I'm not out of line for posting this here.  I know the game requires 128x128 pixel images for textures but that size is too small for me to work with comfortably.  I would prefer to work with 512x512 or larger in photoshop and it can always be scaled down later for the game.
http://mutcd.fhwa.dot.gov/HTM/2003r1/part3/part3a.htm#section3A05 - using that as a reference a dashed line on a road should be 10cm x 300cm.  So I did a test to scale this into a texture image.  One SC4 tile/square is 16 meters x 16 meters.  100% / 16 = 6.25%... I placed a single pixel wide black line every 6.25% in the image to give me a 1 meter grid.  I then placed 1 pixel wide magic pink lines to give me... um.... a smaller grid... as it turns out there's 31 blank pixels between each black line (32nd pixel is 1st line so 1x1meter here is 32x32 pixels) so they measure out 3.125cm increments. 

So we want a 10cm x 300cm line in a 512x512 image.  We know the pink lines are at every 3.125cm which gives us our centimeters to pixels conversion scale. 
10cm / 3.125 = 3.2 pixels.  I went with 3 pixels.
300cm / 3.125 = 96.15 pixels.  I went with 96.

At 512x512 the dashed line is 3pixels x 96pixels.

The same link says we need a 9 meter gap between each dashed line. 
900cm / 3.125 = 288 pixels for the gap.

Okay... 96 pixels + 288 pixels = 384 pixel length for one line and one gap.  512 / 384 = 1.333... or we'd want to have 1 and 1 3rd line + gap per tile... right? *edit* looks like I should have been paying attention to the RHW project thread today since it looks like Tarkus was in a similar frame of mind as me and he has the dashed line positioning down!
Quote from: Tarkus on April 19, 2008, 12:54:54 PM
The exact scaling on the striping I have right now is 3.5m (28px on 128x128px textures equalling 16m), which is actually 0.5m longer than the MUTCD recommendation.  As far as 9m goes, it's a little more than half of a tile.  If I were to actually increase the size of the lines to 4m (32px), which seems to be somewhat acceptable under the MUTCD, as per this phrase (emphasis mine):

Quote from: MUTCD
or dimensions in a similar ratio of line segments to gaps as appropriate for traffic speeds and need for delineation.

the 9m spacing would be upsized to 12m, following the 3:1 ratio.  Considering that the 4m lines are to be centered perfectly in the middle of the 16m tile, they would effectively extend from the 6m mark to the 10m mark, which, on a two-tile stretch, the second line would be situated at 22m-26m.  And subtracting the point of the end point of the first stripe from the start point of the second, 22m-10m=12m. 

This solution would effectively fit the MUTCD's 3:1 ratio while fitting within the game's scale and the modding requirements of a symmetrical (length-wise) texture. 

The resultant texture:

I estimated lane widths to be 2.5 meters for highways and large city streets based on google maps of Columbus Ohio.
http://www.contextsensitivesolutions.org/content/reading/lane_width_flex/ - going by that the American Association of State Highway and Transportation Officials recommends 3 to 3.6 meter lane width so my estimate is probably wrong.  The golden gate bridge appears to be 20 meters wide edge to edge including the sidewalks on google maps and that can't be right?  6 highway lanes + 2 sidewalks = less than 20 meters?!

360cm / 3.125 = 115.2 pixels... so 96 pixels wide for small scale streets/road lanes and 115 pixels wide for highway lanes is what I would go with I think.  The 115px wide lanes are the darker grey and 96px wide are the lighter grey in this image:

After working through this I'm left with one thought... the game's streets and single lane roads are all too wide :)
There's no promise of me making a texture that people will like but I started thinking about being accurate and wanted to figure some things out for my own curiosity.  I hope it can satisfy someone else's too... and please correct me where I'm wrong!

Another thing to possibly take into consideration is the oil slick... for lack of a better term that's what I call it for now.  It's the darker path that cars make on the pavement.  In google maps of Columbus Ohio they're most often seen at intersections and much less intense, almost nonexistent sometimes on long stretches of roads and highways.  Anyway...

Uhaul Car Trailers have a track width under 80 inches.  From that I can extrapolate the average track width of passenger cars to be less than 80" or 200cm.
A claim here is that for the most part no car has a track width under 60" or 152cm... 150cm because I like round numbers.

200 / 3.125 = 64 and 150 / 3.125 = 48... but what about semi trucks?

Here is a Chinese truck with a track width of 200cm and I'm having trouble finding anything wider than that so 48 to 64 pixels across for the average space under vehicles on the road.  I made 2 shapes for it here, one for each width (this would best be done with a gradient) and centered them both to the narrower lanes.

and at 128:

Changed my dash to be 4m long or 128x3px (128 is 1/3 of 512) and centered it vertically per Tarkus' post:


Those graphics looks great videoscreen.
Your Friend;
Mayor Of Steven's Point & Maxiston
(Proud To Be Cities Of Sim Nation!)


Quote from: jplumbley on March 15, 2008, 10:08:28 PM
1. Extracting Textures
I've stumbled onto another way to extract textures using SC4Tool. 
1, Navigate to Analasys->Texture Scanner.  SC4Tool scans your plugins directory so this can take some time.

2, Navigate to Scan->File and choose the file you wish to open.

3, Navigate to Mode->Images - it may take some time to generate/display these images.

4, Select the image on the right - just click on the picture.
5, Click the Arrow next to 'Save image as' and select your format - I chose PNG.

The best part about this way IMO is that you don't get a chance to name the file.

Every file gets saved in the 'Export' subfolder with the proper IID for the file name... which is good if you want to change existing textures :)


I'm not trying to take over this thread... honest!  I just went through some troubles and maybe I can save someone else the same problem of figuring this part out.
Quote from: jplumbley on March 15, 2008, 10:08:28 PM
So, now you are wondering, I have shown a texture with the whole texture covered and there is no invisible parts to show the sidewalk through.  You, would be right, I still would have another another step to do before I import the texture using SC4Tool.  This step includes the creation of an Alpha Texture.

An Alpha Texture is a texture that where there is Black it erases anything from that part of the texture and where there is White it keeps whatever is on the texture.  So, for all intensive purposes:

Black = where the sidewalk will go
White = everything else
And just how do you make these alpha textures?  I have a method that works very well using Photoshop.
Let's use this image as the example:

It's a PNG file and we have transparency between the edge of the pavement and the grass.  All fine and dandy but we need an alpha mask.
In Photoshop, go to levels using ctrl+L on windows or command+L on mac.

Take your black output and raise it to 255 - move the lower black triangle all the way to the right:


Use these settings:

Image->Mode->RGB (no settings):

Save it as PNG (non interlaced if you're using 'save as') and you have your alpha mask.  What was transparent is now black:

This method also works great as an action which means it can be run as a batch operation (File->Automation->Batch) on a folder full of files :) 


Quote from: jplumbley on March 15, 2008, 10:08:28 PM
MAXIS IID Structure for Transit Textures:


n = network ID
pppp = piece ID
w = wealth of texture
z = zoom of texture

0 = No wealth..... This has no sidewalk texture underneath the road surface texture
1 = Low wealth
2 = Medium wealth
3 = High wealth
Any ideas on 4, 5, 6 and 7 for wealth?!  These come from the cosmetic dashed roads mods made by Teirusu (sp?)... I've always wondered how this mod dictated which straight roads get solid double lines and dashed lines.  4, 5 and 6 wealths are solid line roads in their mod.

Example (I've changed the dashed lines but not the IIDs) of how the dash and solid changes and I dunno why:



4 = low, 5 = medium, 6 = high wealths if I go by the textures.  I'm going to put the respective IIDs onto the textures and see where what shows up in the game.  There are also triplicate textures with different IIDs... this is just bugging me lol :)

*edit*  This has been interesting... and yep 4,5 and 6 are density related and 7 is agriculture :)  I marked all the 4, 5 and 6 double solid line straight roads in the Cosmetic Dashed Roads mod.
00004B40 | 00004B60 | 00004B60
| |
Some shots where they intermix and what texture is being used for double line road at fire station?! lol
| |
Zoning medium density in rural areas is a bad thing | the only 7 texture I marked - I put these roads right through a field to get it.
MAXIS IID Structure for Transit Textures:
n = network ID
pppp = piece ID
w = wealth of texture
z = zoom of texture

0 = no wealth no density
1 = low wealth low density
2 = med wealth low density
3 = high wealth low density
4 = low wealth med/high density
5 = med wealth med/high density
6 = high wealth med/high density
7 = agriculture

There are still some 4, 5 and 6 textures that didn't show up in my cities but only because I don't use diagonal roads hardly ever... and it would sure be nice if we could show IIDs like we can using the draw paths thing.


4, 5, and 6 are for Mid/High-Density, as Low, Medium and High-Wealth respectively.  7 is for Agricultural Zones.

-Alex (Tarkus)


Are 8, 9, A-F defined for the wealth/density value?  I've seen some road texture IIDs that have E for the zoom value?


I'm just starting to do texturing and I need help on how I can make this look better in the game? %confuso

(trying to make a cement road w/ black top shoulders for RHW) :-[


After exporting the .fsh files, i can't open them in FiSHMan. I've also tried EA Graphics Editor and FshX (won't even go into the trouble i had getting that working), with no avail. I'm using iLive's Reader 0.9.3 and FiSHMan on Vista x64. The .fsh files i'm trying to get are the Maxis street straights. Is it the files i'm grabbing, or is it the software, or is it my OS (and don't give me flak about vista, i don't care)? I'm tempted to reflect over FiSHMan.exe and any dependency dlls and rebuild them to fix this problem if it's a coding oversight; i would rather not have to resort to such drastic measures if possible. Any help is appreciated, thanks.


Edit: I tried using version 0.8.7 of iLive's Reader, but with the same results. I believe the problem lies with Reader, but I can't be certain.


Question I have is how do you make it so that the texture you make replaces a SAM texture? I do not use the Trocola dirt roads and would like to make a cracked street texture for my ghetto/low wealth areas. I remember there being a thread for how to make your own SAM textures but I cannot find it anywhere.


Nerdly Dood made a texture for SAM like you just described. The crack texture does look awesome for ghetto/low wealth, and industries. I asked if those could eventually replace Trocolas dirt roads, but its not finished, and it will be awhile till any of that new SAM stuff is taken care of.


Ahh...nice..and nevermind about the SAM texture question I had. Nerdly kindly directed me to the LEX file while I was in STEX Chat.


Hi all,  This may be a rather obvious question for most but how do you extract a Maxis texture like those that show up in the LE Base Texture Add Item?  If I use the texture as a base texture in say a park or plaza lot it doesn't seem to have the attributes that show up in the iLive Reader examples in this thread.  Obviously my knowledge of all of this is limited so as I stated I am probably missing something.  Thanks for any help.  Steve 


well you would need to go through the Simcity.Dats to find the FSH files you were interested. These are very big files and there are several of them and can be found in your main SimCity4 Folder (not the one in your MyDocuments). It'll take a little searching to find them, but you can use the ID from LE to make searching a little easier.


So when I create my own road textures, do I have to give them a sidewalk, or could I have a sidewalk of my own creation already on the road texture and go with that in the game?