Author Topic: Building a new terrset for ground textures  (Read 743 times)

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Building a new terrset for ground textures
« on: March 18, 2019, 07:48:22 AM »
Before the holidays, I was forced to put my AH3 projects aside. I'm only now getting the time and energy to work on them again and I thought some of you might like to follow along. I can't say how far I will get, and things may become a bit random in the process.
As I don't do this every day, I usually need to do some  :bhead  to make things work.

This is not written for beginners.

Currently, I'm working two of several projects. I've always wanted to create a custom terrset from scratch and build a large railyard. Neither of these will be allowed in a main arena terrain but for some you, seeing what custom terrain builders go through and how the process works will be enough. Keep in mind it's meant for terrain builders with some experience.

Today, I'll discuss building a new terrset but using an existing default terrset as a template will make the work go faster.
As the TE no longer exports ground textures as the AH2 TE did, you'll need to download HTC's terrsettextures.zip from the top of this forum: https://bbs.hitechcreations.com/smf/index.php/topic,387747.msg5152982.html#msg5152982
While you're at it, also download the default swa tree and building files from the same post: tilesswa.zip

The second step is recognizing which trees and buildings you want, summer eto, winter eto, desert, or sunny tropical palm trees. The buildings and trees are a set, so no mixing palm trees with eto buildings, sorry.

In step 3 you must create a terrain. It can be a dummy, it's just a placeholder for your work, and you will move your terrset later. I recommend not using a terrain project you intend for the server and avoid the possibility of trashing your valuable work.

In the TE, select New and create 'myterr', don't care what size, but quickly pick your tree/building set from the available tilesets.
So now we have a terrain called myterr with the proper tileset. Save it and exit.

I'll pretend you want to modify or build a new ETO terrset.

You can use Windows Explorer (W.E.) to browse the zip file. Right click the zip and select W.E. Drag the terrset00 folder into the myterr folder. It contains 2 important text files and 4 optional files, also a spdtree folder.
(You need that terrset## folder along with its text files and spdtree folder.)
Using a text editor like Notepad, open atlas0.txt and modify the first line so AH will use the local directory path.
It reads:
atlas,C:\art\ah2\stdtexnew\atlas\terrset00
Truncate it before or after the coma: atlas,
and save it.
Do the same for atlas1: - atlas,C:\art\ah2\stdtexnew\atlas\terrset00 - becomes - atlas,
I can't imagine ever having a need to change the other 4 text files. Currently, I delete them and AH will use the defaults for the selected terrset.

You may have noticed that these 2 text files read something like "../508/sand.bmp".
Each of those lines is pointing at the 508 folder or the 1016 folder in the local terrset00 folder. That won't work even if you drag both folders over from the zip file. Use the recommended path. This requires more steps, changing the text lines, adding another texsrc folder, and moving the textures to the new texsrc folder.

Those "../508/sand.bmp" and "../1016/$$$" lines in the atlas' mentioned above all need changing to match the intended path. They can be written thus:
Ex:
../1016/farm1.bmp
 - should become -
texsrc/farm1.bmp
 - etc., and that line will now work. -

Inside your terrset00 folder, along side the atlas#.txt files, create a new texsrc folder.
This texsrc folder is for the terrset bitmaps only. Unless the editor has changed, the TE will incorporate every bitmap it sees inside the project folder. That increases the size of the res file, so limit your final terrain to a single terrset and no (or few) unused bitmaps. That means copying the terrain textures needed for terrset00 from the 508 and 1016 folders and pasting them into your new texsrc folder, or just drag them.

The important thing is to follow the directory path procedure used by your operating system. I don't find the ../ prefix necessary in Win7 but ymmv.
"But wait," you say, "I shouldn't need to make all these modifications just to play around with a few textures. Why not leave the bitmaps in the original 508 & 1016 folders?" Won't work, not as written.

Both atlas' have been modified to follow the correct directory paths, the 2 folders needed, terrset00 and texsrc exist inside your project folder, and the bitmap textures (usually a family of 4 bitmaps per tile) have been copied over into the texsrc folder.
Your directory structure should look like this:

myterr
>terrset00
>atlas'
>>texsrc
>>>terrain texture bitmaps
texsrc
>clipboard map if desired
.oba
etc.

Reopen the TE to your 'myterr' and if all went well, it will automatically build and update the necessary stb, sta and htx files each time it runs. Since these are still using the default textures, you won't notice any changes in the TE until you modify one of the diffuse textures.

Make your first test VERY quick and minimalist. Make a backup copy of the diffuse snow texture and draw a wide line across the original snow texture. Remember it needs to be index 256 color, but more than that, it needs to be the right version of 5 possibilities for an MS bitmat file. The internal headers vary. Your graphic program's indexed color output may not match that. If you followed along and drew lines in MS Paint and saved it, you might notice the snow texture might be a slightly different in color to the backup.

So great, you can see the change in the TE. What about those trees and buildings? Using W.E. again, navigate through tilesswa.zip > tilesswa > swa > terrset00. See the swa folder and copy it over into the spdtree folder inside your terrset00 folder.

To make sure it's working, notice there is no snow.swa file. For fun, make a copy of farm1.swa and rename it snow.swa and reopen the TE. Turn on the trees to see the change.

At this point, you can modify the diffuse textures to your heart's content. At some point, you want to experiment with the other three supporting textures which control things like lighting, ground surfaces, vegetation and bump mapping.

~~~~

There was no way to modify trees or buildings in the custom terrset before now.

Open the OE, select New, and select the matching terrset for the trees and buildings you want. It should match the terrset## folder name you decided on earlier. The OE uses the tile's texture as the starting point for trees. Open the same snow texture bitmap you modified and added farm1 trees to.

At this point you should see the diffuse texture but no trees or buildings. That's because the OE uses an input folder and a different output folder for trees. It loads swa files from the terrset00\ spdtree\swa\spdtree\swa\ folder and writes to the terrset00\swa folder. I suspect this is to afford an opportunity to make backup copies of previous versions before you commit to changes.
Until you rationalize why this is done this way, the confusing part comes from the fact you point the OE at the swa file in the output folder to load from the input folder. It won't work otherwise.
It's unlikely I will modify the swa files for the square tile objects in my new terrset work so I'll select only the swa files for the ground textures I intend to change, and copy them from the output folder to the input folder.
Now when the OE is pointed at an swa file in the output folder, it will actually load the same file name from the input folder.

~~~

Next time, more about the atlas and supporting textures for the diffuse bitmap, _a0, _b1,_n and clutter.

 :cheers:
Easy in-game again.
Since Tour 19 - 2001

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #1 on: March 31, 2019, 02:31:51 PM »
Before continuing, it’s time for a quick review of the default file and folder paths.  I’m listing the folders and paths for all the folders needed, and a short comment or example of their content where needed.  It will act as a framework for building the new terrset and should make following along easier.

C:\Hitech Creations\Aces High III\ah3terr\myterr\ (Ex: myterr.oba)
C:\Hitech Creations\Aces High III\ah3terr\myterr\texsrc\ (Ex: myterr.bmp)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\ (the new terrset)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\ (Ex: atlas0.txt etc.)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\texsrc\ (Ex: dgrass1.bmp textures)

C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\texsrc\detail\ (I keep it here)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\texsrc\detail\objectdetail\
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\texsrc\detail\objectdetail\ (Ex: mud_a1.bmp)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\texsrc\detail\terraindetail\
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\texsrc\detail\terraindetail\ (Ex: dirtroad_a1.bmp)

C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\spdtree\ (speed tree folder)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\swaobj\ (TE’s binary output)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\spdtree\swa\ (OE’s .swa output)
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\spdtree\swa\spdtree\
C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\spdtree\swa\spdtree\swa\ (OE’s .swa input)

C:\Hitech Creations\Aces High III\ah3terr\myterr\terrset00\ (files)
atlas0.txt (list assigns the order in which the textures will be displayed in the TE User Interface and terrain)
atlas1.txt
catlas0.txt (list assigns clutter grayscale.bmp in sequence with atlas0.bmp)
catlas1.txt (list assigns clutter grayscale.bmp in sequence with atlas1.bmp)
objdet.txt (_a0, list assigns 16 of 34 possible detail types including dirtroad)
terrdet.txt (clutter, list assigns 16 of 17 possible ground types including pondwater)

Easy in-game again.
Since Tour 19 - 2001

Offline CptTrips

  • Platinum Member
  • ******
  • Posts: 7663
Re: Building a new terrset for ground textures
« Reply #2 on: March 31, 2019, 02:35:00 PM »
Hope this gets sticky'd.  :D

:aok
Toxic, psychotic, self-aggrandizing drama queens simply aren't worth me spending my time on.

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #3 on: March 31, 2019, 10:14:18 PM »
A word about the texture sizes, 508 vs 1016.
These textures are scaled to cover a 2x2 mile square in the terrain, 10,560' x 10,560'.

Why is this important?

Inevitably, at some point, you will wish to include roads and foot paths in the textures.

With a little math, each pixel in a 1016 texture is ~10.4' x 10.4' and each pixel in a 508 texture covers twice that, at ~20.8'.

Looking at the ETO village textures, my favorite, the detail.bmp, _a0, that lays down the roads show the width of the roads to be 5 to 6 pixels wide. That makes them ~52' to ~63.4' wide. This feels about right in-game, and there's hopefully some blending taking place to make the roads feel narrower than the pixels would suggest.

Ever notice there are no roads in the 508 textures?

To accomplish the same road feel with a 508 texture, the "roads" must be drawn with 2 (~41') to 3 (~62.4') pixels width. Not too terrible unless you use something like the brick detail and forget it scales up x2. Use stone, brushed concrete, or asphalt instead. Dirt or gravel would be best.

Drawing a “foot path” in a 1016 texture (~10.4 to ~20.8’ wide) could work, but in a 508 texture, that’s a minimum of ~20.8’ to ~41’ wide. Hardly a “foot path” anymore is it.

Why is this important?

I wished to tie all the textures together in a uniform "road" system the player on the ground can depend upon. My concept is to use the diffuse textures, trees and shrubs to hide the repetition within the visual range of the player "flying" above the terrain. Unfortunately, at a max visual range of 3 miles, even the players with top of the line hardware and maximum settings are likely to notice the repetition beyond the 3 mile limit, and it’s worse for those dialing back on their terrain visual range. That would get ugly for them, but not something the builder can control?
No, not with the default texture sizes.
Hint: “He didn’t really just say that did he?” LOL.

The point of this post is, whether diffuse, or detail (x2 bitmaps), or clutter, the builder must keep the texture size vs mapping to the terrain in mind. Sometimes, drawing a road or path in the diffuse might be one pixel wide while in the associated _a0 detail map, not always, but it could be be wider.

[edit] P.S. Sorry about the length of these posts.

Oh! and I lied about deleting the catlas0.txt, catlas1.txt, objdet.txt and terrdet.txt files. You don't need them for basic testing and should remove them, but, you will need them later. They should always be available for copying.

Lastly, I've noticed that much has changed from the Beta. We have better textures and speedtree objects that weren't available originally. Woot!
For example, we have three farm crops instead of two in ETO, lettuce 0xD0, tomatoes 0xE0, and corn(?) 0xF0.


Next time, what is the difference between clutter, object detail and terrain detail.
« Last Edit: March 31, 2019, 11:42:17 PM by Easyscor »
Easy in-game again.
Since Tour 19 - 2001

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #4 on: April 26, 2019, 12:52:40 AM »
One thing I should mention before moving too far from the folder paths.
If you’ve ever tried to create a square tile object, such as the ground under an airfield and couldn’t manage the trees, it is because the current version of the TE expects to read a file with a list of all square tile file names.

The name of the file is “shapesswa.sta”, it’s a text file created with Notepad.

Suppose the name of the square tile object is city0. Open the newly created text file, shapesswa.sta, and type city0 +a line feed and save.
In the folder myterr\terrset00\ place the shapesswa.sta file.
If not created already, create the spdtree folder with both the swa and swaobj folders inside.
Place the city0.swa file that the OE created for the city0 object inside the swa folder and launch the TE. If all went well, a new city0.swb file is created inside the swaobj folder when the TE opens.

When all the Speedtree objects, trees and buildings, are completed in a satisfactory way, go back to the OE and create the two Ortho images for the diffuse and bump map.
Additional discussions of creating objects in the OE will need to wait for another thread.

 :cheers:
Easy in-game again.
Since Tour 19 - 2001

Offline CptTrips

  • Platinum Member
  • ******
  • Posts: 7663
Re: Building a new terrset for ground textures
« Reply #5 on: April 26, 2019, 09:41:08 AM »
One thing I should mention before moving too far from the folder paths.
If you’ve ever tried to create a square tile object, such as the ground under an airfield and couldn’t manage the trees, it is because the current version of the TE expects to read a file with a list of all square tile file names.

The name of the file is “shapesswa.sta”, it’s a text file created with Notepad.


Arhhg.  I was trying to create a new airfield and no matter what I did with the alpha mask or the swa, I couldn't keep trees from growing up through the middle of the field.   Is this why????

If so, this is priceless info!   :aok
Toxic, psychotic, self-aggrandizing drama queens simply aren't worth me spending my time on.

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #6 on: April 26, 2019, 10:06:15 AM »

Arhhg.  I was trying to create a new airfield and no matter what I did with the alpha mask or the swa, I couldn't keep trees from growing up through the middle of the field.   Is this why????

If so, this is priceless info!   :aok

No, that is done with the _A alpha and judicial care in the choice for the underlying ground texture. But all that is for another thread.
Easy in-game again.
Since Tour 19 - 2001

Offline CptTrips

  • Platinum Member
  • ******
  • Posts: 7663
Re: Building a new terrset for ground textures
« Reply #7 on: April 26, 2019, 10:56:41 AM »
No, that is done with the _A alpha and judicial care in the choice for the underlying ground texture. But all that is for another thread.

Bummer.

So what is the function of the sta exactly? 

What did you mean by "and couldn’t manage the trees"? 

Did you just mean couldn't get the trees in the swa to show up?
Toxic, psychotic, self-aggrandizing drama queens simply aren't worth me spending my time on.

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #8 on: April 26, 2019, 11:02:29 AM »
Yes
Easy in-game again.
Since Tour 19 - 2001

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #9 on: August 27, 2019, 03:11:16 PM »
A helpful word of caution when building terrain tiles.

If you copy and paste the trees from one swa file to another, or use an outside program like Excel to create the file, sometimes the trees might be from the wrong terrset or the parameters might become corrupted. Either way, the Terrain Editor will silently ignore the entire set of swa files. Usually only happens after dropping a project for several months.

If this happens, use the Object Editor to walk through the set from beginning to end and open/inspect each texture image looking for one(s) that shows no trees in the OE. Fix or remove any that don't show trees.
Easy in-game again.
Since Tour 19 - 2001

Offline nooby52

  • Silver Member
  • ****
  • Posts: 990
Re: Building a new terrset for ground textures
« Reply #10 on: August 27, 2019, 03:24:08 PM »
I'm not a terrain builder. I read too far. At some point I blacked, didn't know where I was or who I was for a few minutes. Feeling better now tho.  :x

Flying as "South52" for VF-17 Jolly Rogers
17 Squadron - The Hardest Day Battle of Britain
204 Kokutai - Target Rabaul
610 Squadron -TFT Battle of Britain

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10873
Re: Building a new terrset for ground textures
« Reply #11 on: September 20, 2019, 07:00:23 AM »
I'm still working on these, but I'm happy with the results so far. I'll post the details of the project after I'm sure all the stumbling blocks have been worked out. Often what I anticipate working isn't really how it works.

 :cheers:
Easy in-game again.
Since Tour 19 - 2001