Discussion Tile making

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,668
Reaction score
796
Points
128
@jarmonik , if you ever plan to update the tools, you have a small fan base here ! :hailprobe:

There is an updated version as a part of the OpenOrbiter which can work with water masks and nightlights. There are simply so many things to do that I haven't had much time for this tool. But I do have plans to continue the development.
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Could someone suggest how to change/tune color palette to match colors in Photoshop? (I'm just using Photoshop only for a couple of weeks.)

green.png
 

LordCroussette

Quebec City's Resident Base Builder
Addon Developer
Donator
Joined
Jan 26, 2013
Messages
228
Reaction score
744
Points
108
Location
Quebec City
Preferred Pronouns
He/Him
Could someone suggest how to change/tune color palette to match colors in Photoshop? (I'm just using Photoshop only for a couple of weeks.)

View attachment 34076
Personally I just increase the brightness of the overall image once I have it assembled, before I divide it in tiles.
1690756345455.png
The value depend from place to place - I would recommend just increasing it enough so that it match the original tiles of that location (so the blend in isn't so bad). Also, keep it consistent across the entire base (so if you increase it by 25 for L14, increase it by 25 for L19 as well)
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Some optimization/automatization of surface tiles making

I recommend you to read @jacquesmomo's manual for better understanding.

I'll try to explain with an example how I make surface tiles. Maybe you can take something useful for yourselves.

PART 1

Let's choose a tile of 14 level and make it until 19 level. Each tile will have a resolution of 512x512. I'm using @jarmonik's TerrainToolBox included into OpenOrbiter:

1.png

The green tile of level 13 contains the yellow tile of level 14 we want to start from. The yellow tile is located in folder:

[imath]147\cdot2+1=295[/imath]

and has the name:

[imath]235\cdot2=470[/imath]

Besides we need coordinates of upper left and lower right corners of the yellow tile. They are:

[imath](38.1445; -97.3828)[/imath]
[imath](37.9688; -97.2070)[/imath]

So, we need these six numbers: 295, 470, 38.1445, -97.3828, 37.9688, -97.2070.

Save the yellow tile:

8.png

PART 2

I'm using SAS.Планета. Also, you need maps (the fourth link).

Unpack it into Maps folder of SAS.Планета. Rename "maps" to "sas.maps".

Run SAS.Планета, change language if needed. Do: View -> Projection -> Geographic.

I'll use Bing Maps (hotkey "V"):

3.png

Then:

4.png

Enter our four numbers:

5.png

I choose zoom 18 (as far as it's very close to needed resolution, because if a tile of level 19 is 512x512, then a tile of level 14 is 16384x16384):

6.png

Start this. After downloading click on the blue square in the lower left corner (Selection Manager). Then:

7.png

(There is a limit of the file size 65536x65536 (but you can split image for those cases).)

Start and download your one big picture.

PART 3

I'm using Adobe Photoshop for automatic color matching. Open separately your two saved pictures (MyPicture.jpg and Background.dds). For the first one do: Image -> Adjustments -> Match Color. Choose Background.dds as a Source. Save it:

9.png

PART 4

I'm using ImageMagick to resize, format and crop images. (During installation check the box "Install legacy utilities".)

I'm using a batch script for resizing, formatting and cropping our one big image, and also for creating right folders, and moving tiles into them.

Create a new folder, move your image into it and rename to "file.jpg". Move the batch script (I attach it in zip-archive) into this folder too. Open your
cmd, go to the folder and run the script. There are two input commands:

Name of 14 level folder: 295
Name of 14 level file: 470

After the script finishes you will get the "Textures" folder. Just move it to your main Orbiter directory.

The color was matched pretty well:

r.png

_________________________________________

Here is a script code if you just want to take a look at it:


Code:
@echo off

SET /a var1=1
SET /p var2="Name of 14 level folder:"
SET /p var3="Name of 14 level file:"

md 19 18 17 16 15 14

magick mogrify -resize 16384x16384! *.jpg

copy *.jpg 19

magick mogrify -resize 8192x8192! *.jpg

copy *.jpg 18

magick mogrify -resize 4096x4096! *.jpg

copy *.jpg 17

magick mogrify -resize 2048x2048! *.jpg

copy *.jpg 16

magick mogrify -resize 1024x1024! *.jpg

copy *.jpg 15

magick mogrify -resize 512x512! *.jpg

move *.jpg 14

::///////////////////////////////////////////////////////////

cd 19

magick mogrify -crop 512x512 *.jpg
magick mogrify -format dds *.jpg
del *.jpg
SETLOCAL ENABLEDELAYEDEXPANSION

SET "sourcedir=%cd%"
SET "destdir=%cd%"
SET /a directorydigits=6
SET /a filedigits=6

SET /a filecount=var1*32
SET /a dirnum=var2*32
SET /a rennum=var3*32

SET /a dirnum+=1000000000
SET /a rennum=1000000000 + rennum
SET /a rennummax=rennum + filecount

:: This should rename "file-0..9999" to "file-00000..099999"
for /L %%e in (0,1,9999) do IF EXIST "%sourcedir%\file-%%e.dds" (
 SET /a filenumber=1000000000 + %%e
 ren "%sourcedir%\file-%%e.dds" "file-!filenumber:~-5!.dds"
 ) ELSE GOTO continue

:continue

FOR /f "delims=" %%e IN ('dir /b /a-d "%sourcedir%\file-*.dds"') DO (
 SET "destsubdir=%destdir%\!dirnum:~-%directorydigits%!"
 MD "!destsubdir!" 2>NUL
 MOVE "%sourcedir%\%%e" "!destsubdir!\!rennum:~-%filedigits%!.dds"
 SET /a rennum+=1
 IF !rennum! geq !rennummax! SET /a rennum-=filecount&SET /a dirnum+=1
)

cd ..

::///////////////////////////////////////////////////////////

cd 18

magick mogrify -crop 512x512 *.jpg
magick mogrify -format dds *.jpg
del *.jpg

SET "sourcedir=%cd%"
SET "destdir=%cd%"

SET /a filecount=var1*16
SET /a dirnum=var2*16
SET /a rennum=var3*16

SET /a dirnum+=1000000000
SET /a rennum=1000000000 + rennum
SET /a rennummax=rennum + filecount

:: This should rename "file-0..9999" to "file-00000..099999"
for /L %%e in (0,1,9999) do IF EXIST "%sourcedir%\file-%%e.dds" (
 SET /a filenumber=1000000000 + %%e
 ren "%sourcedir%\file-%%e.dds" "file-!filenumber:~-5!.dds"
 ) ELSE GOTO continue

:continue

FOR /f "delims=" %%e IN ('dir /b /a-d "%sourcedir%\file-*.dds"') DO (
 SET "destsubdir=%destdir%\!dirnum:~-%directorydigits%!"
 MD "!destsubdir!" 2>NUL
 MOVE "%sourcedir%\%%e" "!destsubdir!\!rennum:~-%filedigits%!.dds"
 SET /a rennum+=1
 IF !rennum! geq !rennummax! SET /a rennum-=filecount&SET /a dirnum+=1
)

cd ..

::///////////////////////////////////////////////////////////

cd 17

magick mogrify -crop 512x512 *.jpg
magick mogrify -format dds *.jpg
del *.jpg

SET "sourcedir=%cd%"
SET "destdir=%cd%"

SET /a filecount=var1*8
SET /a dirnum=var2*8
SET /a rennum=var3*8

SET /a dirnum+=1000000000
SET /a rennum=1000000000 + rennum
SET /a rennummax=rennum + filecount

:: This should rename "file-0..9999" to "file-00000..099999"
for /L %%e in (0,1,9999) do IF EXIST "%sourcedir%\file-%%e.dds" (
 SET /a filenumber=1000000000 + %%e
 ren "%sourcedir%\file-%%e.dds" "file-!filenumber:~-5!.dds"
 ) ELSE GOTO continue

:continue

FOR /f "delims=" %%e IN ('dir /b /a-d "%sourcedir%\file-*.dds"') DO (
 SET "destsubdir=%destdir%\!dirnum:~-%directorydigits%!"
 MD "!destsubdir!" 2>NUL
 MOVE "%sourcedir%\%%e" "!destsubdir!\!rennum:~-%filedigits%!.dds"
 SET /a rennum+=1
 IF !rennum! geq !rennummax! SET /a rennum-=filecount&SET /a dirnum+=1
)

cd ..

::///////////////////////////////////////////////////////////

cd 16

magick mogrify -crop 512x512 *.jpg
magick mogrify -format dds *.jpg
del *.jpg

SET "sourcedir=%cd%"
SET "destdir=%cd%"

SET /a filecount=var1*4
SET /a dirnum=var2*4
SET /a rennum=var3*4

SET /a dirnum+=1000000000
SET /a rennum=1000000000 + rennum
SET /a rennummax=rennum + filecount

:: This should rename "file-0..9999" to "file-00000..099999"
for /L %%e in (0,1,9999) do IF EXIST "%sourcedir%\file-%%e.dds" (
 SET /a filenumber=1000000000 + %%e
 ren "%sourcedir%\file-%%e.dds" "file-!filenumber:~-5!.dds"
 ) ELSE GOTO continue

:continue

FOR /f "delims=" %%e IN ('dir /b /a-d "%sourcedir%\file-*.dds"') DO (
 SET "destsubdir=%destdir%\!dirnum:~-%directorydigits%!"
 MD "!destsubdir!" 2>NUL
 MOVE "%sourcedir%\%%e" "!destsubdir!\!rennum:~-%filedigits%!.dds"
 SET /a rennum+=1
 IF !rennum! geq !rennummax! SET /a rennum-=filecount&SET /a dirnum+=1
)

cd ..

::///////////////////////////////////////////////////////////

cd 15

magick mogrify -crop 512x512 *.jpg
magick mogrify -format dds *.jpg
del *.jpg

SET "sourcedir=%cd%"
SET "destdir=%cd%"

SET /a filecount=var1*2
SET /a dirnum=var2*2
SET /a rennum=var3*2

SET /a dirnum+=1000000000
SET /a rennum=1000000000 + rennum
SET /a rennummax=rennum + filecount

:: This should rename "file-0..9999" to "file-00000..099999"
for /L %%e in (0,1,9999) do IF EXIST "%sourcedir%\file-%%e.dds" (
 SET /a filenumber=1000000000 + %%e
 ren "%sourcedir%\file-%%e.dds" "file-!filenumber:~-5!.dds"
 ) ELSE GOTO continue

:continue

FOR /f "delims=" %%e IN ('dir /b /a-d "%sourcedir%\file-*.dds"') DO (
 SET "destsubdir=%destdir%\!dirnum:~-%directorydigits%!"
 MD "!destsubdir!" 2>NUL
 MOVE "%sourcedir%\%%e" "!destsubdir!\!rennum:~-%filedigits%!.dds"
 SET /a rennum+=1
 IF !rennum! geq !rennummax! SET /a rennum-=filecount&SET /a dirnum+=1
)

cd ..

::///////////////////////////////////////////////////////////

cd 14

ren file.jpg file-0.jpg
magick mogrify -format dds *.jpg
del *.jpg

SET "sourcedir=%cd%"
SET "destdir=%cd%"

SET /a filecount=var1
SET /a dirnum=var2
SET /a rennum=var3

SET /a dirnum+=1000000000
SET /a rennum=1000000000 + rennum
SET /a rennummax=rennum + filecount

:: This should rename "file-0..9999" to "file-00000..099999"
for /L %%e in (0,1,9999) do IF EXIST "%sourcedir%\file-%%e.dds" (
 SET /a filenumber=1000000000 + %%e
 ren "%sourcedir%\file-%%e.dds" "file-!filenumber:~-5!.dds"
 ) ELSE GOTO continue

:continue

FOR /f "delims=" %%e IN ('dir /b /a-d "%sourcedir%\file-*.dds"') DO (
 SET "destsubdir=%destdir%\!dirnum:~-%directorydigits%!"
 MD "!destsubdir!" 2>NUL
 MOVE "%sourcedir%\%%e" "!destsubdir!\!rennum:~-%filedigits%!.dds"
 SET /a rennum+=1
 IF !rennum! geq !rennummax! SET /a rennum-=filecount&SET /a dirnum+=1
)

cd ..

::///////////////////////////////////////////////////////////

md Textures\Earth\Surf
move 14 Textures\Earth\Surf
move 15 Textures\Earth\Surf
move 16 Textures\Earth\Surf
move 17 Textures\Earth\Surf
move 18 Textures\Earth\Surf
move 19 Textures\Earth\Surf

echo Success
pause

I will attach these textures as addon "The rectangle", since can't do it here. You can just run "The rectangle" scenario. It works both Orbiter 2016 and OpenOrbiter for me.

(I have similar bash scripts for Linux, but I haven't put them all together yet. But if needed I can share them too.)
 

Attachments

  • MakeTile.zip
    971 bytes · Views: 2

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Although more detailed tiles with contrasting colors look better, I think:

Cessna.pngCessna2.png
 

LordCroussette

Quebec City's Resident Base Builder
Addon Developer
Donator
Joined
Jan 26, 2013
Messages
228
Reaction score
744
Points
108
Location
Quebec City
Preferred Pronouns
He/Him
Tested it. Not bad, though it matches the default tiles, the contrast isn't great and hide a lot of details imo.

Still, there was a patched of land with L19 tiles but no base. That felt wrong to me. So, I made one quickly.
1690841994886.png

Do with it what you want with it. Even add it to your addon if you want! :p

(PS: It is called "Newton" after the nearby town. Oh, and it has D3D9 terrain flattening.)
 

Attachments

  • Newton.zip
    2 KB · Views: 3
Last edited:

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Thank you!
I'm sorry that I named it just "The rectangle".
I've never add/make runways and buildings yet. Your config file is amazing. I didn't expect that objects improve the surface so much.

I don't know how you determine object coordinates and where this amazing runway with navigation lights came from, but I'll study it later :) Thanks for the flattening.

I made additional tiles of level 19, but 1024x1024 (2nd screen) instead of 512x512 (1st screen). Here the surface is a little clearer, but not much at this height. Also 2048x2048 tiles of level 19 with original colors from Bing Maps for comparison (3rd screen).

512.png1024.png2048 (original contrast).png
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Hi,
I would like to ask you for advice. I'm going to start making mask tiles for an island, and I have a question about surf tiles. Do I need to carve the island surface around its perimeter for surf tiles, or should I do this only for mask tiles?
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
I would be grateful if someone could help me with brief explaining of the mask tiles creating and their saving using Photoshop. I'd like to understand how it works in the most general terms, I'm just not at all familiar with alpha channel, transparency and so on.

Intuitively I did the following. Opened my *.jpg picture which I use for surface tiles, then selected an area using the lasso tool, created mask from selection, applied layer mask, and obtained:

2.png

Although I'm not sure if I'm doing something correctly...
 

jacquesmomo

Addon Developer
Addon Developer
Joined
Jun 14, 2008
Messages
613
Reaction score
453
Points
78
Location
FRANCE
Website
francophone.dansteph.com
Sorry I am not attention home.
But just one thing :
With the alpha Chanel calque :
Black is water, White is "no water".
And with the rgb calque color is light at night ( a red point will be a red light)
when I come back I Will explain to you)
Now this msg is from m'y phone)
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
I was trying to make feathered edges of a surface tile in Photoshop, but these blurry edges are pixelated (in the middle of the screenshot). It seems that Orbiter (or D3D9) makes its own blur. I really don't understand why we don't see pixels at a close distance from the ground (on the right in the screenshot).

pixels.png
 

LordCroussette

Quebec City's Resident Base Builder
Addon Developer
Donator
Joined
Jan 26, 2013
Messages
228
Reaction score
744
Points
108
Location
Quebec City
Preferred Pronouns
He/Him
Ah yes, Mask tiles. A bit more annoying to do than surface tiles, but they make the whole thing look a whole lot better once water and night lights are added!

So, how do we do them? Well, it is very easy.

First, I'd start by copying all of your folders in your Earth/Surf folder and paste them in Earth/Mask.
1691501620844.png1691501631143.png

Then, you open your tiles (I'm using a single tile from Quebec as an example) in Photoshop or whichever image editor you use. And then delete all the water, either with a roto tool or the magic wand thing.
Preferably, you would use an alpha channel for this step, painting the water black (and so transparent) and the land white (opaque) and be done with it. However, in my personal case, my photoshop doesn't seem to want to save alpha channels in DDS files, so I have to resort to an alternative and slightly longer method to mask the water.
1691501758510.png
Once your water is deleted (or masked in an alpha channel), you then have to create the night tiles, otherwise the tile would look lit up in the middle of the night! One method you could do this is paint the whole thing black. However, without night lights (aka street lights), it wouldn't look very good in game. But, it is the easiest method and would ensure you have masked water.

The second option is a lot more time consuming. It however gives the best results. It is to hand-draw the street lights yourselves! The way to do it is to have your day tiles as one layer and colour corrected to look yellowish or white, and then put a black layer on top. Then, use the eraser tool to create dots in the black layer, making the bright layer visible under, giving the impression of lights lighting up the roads.
1691502244719.png
In game, it look very good! However, it can be time consuming on large spaces so I would recommend only doing it for airports and stuff like that.
1691502284245.png
The third alternative is the best option in my opinion, at least when it's time to do night tiles for large surfaces like an entire city. It is to simply use the Brightness/Contrast tool on the tiles! In legacy mode, with brightness at -100 and Contrast between 40 and 70 (depending on the result), you can get some passable street lights!
However, it only work best when you're doing it for cities, since it highlight the roads and the buildings. For bases in the countryside or the middle of nowhere, it doesn't work as well as it tend to highlight things that have no place being lit up (like beaches, farm lands and others). In these cases, you might need to pass over with a black brush and paint them out before saving the tiles.
1691502364497.png
And once you're done, you can save the image! If you used an alpha layer, then your tile should be good to go. However, if you simply deleted the water like I did, then there is one last step you need to do (unless there is no water in the tile you're editing, then it is not required).
But why is there another required step, you might be asking. Well, if you try to put your tiles in Orbiter and load them, you will see something strange: the water is masked in the day like it should be. But, in the night, it is completely fluorescent!
1691502714345.png
So, what is happening? Well, if you open the tile in photoshop again (make sure to close it first), then you will understand why. When the pop-up "Load Options" appear, make sure to click on "Load Transparency as Alpha channel". Then click okay.
1691502777740.png
You will get this surprise! The water is all white! The way to fix it is easy. Take the bucket and fill it black!
1691502920683.png1691502936741.png
And then save again!

And then you should be done. You should now have night tiles in your base! :D (And yes, if you're perspective, you will have seen that we re-opened the tile with the transparency as an alpha layer. So why could I save it an alpha layer now but not before? No idea. I think it's because before I created my own alpha channel while in this case photoshop itself did. I guess photoshop just doesn't care about my alpha channels and ignore them.)
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Thanks to you I've made some progress in that:

mask.png

I painted the ground black, but I have some light streak at night:

night.png

So, I made something wrong. When I open my mask file in Photoshop I see:

streak.png

I'd like to try to add an alpha channel and save it using Photoshop. I thought I could do it like the following. I take my big *.jpg picture, add an alpha channel, save it, crop it into small tiles, convert them into *.dds format, and that's it. But it seems I can't use the *.jpg format to add an alpha channel and so on. So, I'd like to make one big mask file and then just crop it into small tiles. Which format can I use for this one big mask file?
 

LordCroussette

Quebec City's Resident Base Builder
Addon Developer
Donator
Joined
Jan 26, 2013
Messages
228
Reaction score
744
Points
108
Location
Quebec City
Preferred Pronouns
He/Him
Thanks to you I've made some progress in that:

View attachment 34237

I painted the ground black, but I have some light streak at night:

View attachment 34238

So, I made something wrong. When I open my mask file in Photoshop I see:

View attachment 34240

I'd like to try to add an alpha channel and save it using Photoshop. I thought I could do it like the following. I take my big *.jpg picture, add an alpha channel, save it, crop it into small tiles, convert them into *.dds format, and that's it. But it seems I can't use the *.jpg format to add an alpha channel and so on. So, I'd like to make one big mask file and then just crop it into small tiles. Which format can I use for this one big mask file?
.PNG, maybe? I don't know. Personally, I do the masks one tile at a time, hence why I copy-paste the surface tiles in the mask folder. A bit more time consuming but easier overall I find.
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Do I understand correctly that if you have, for example, one surface tile of level 15, and you make tiles up to the level 19, thus you have 1+4+16+64+256=341 tiles in *.dds format, then you copy them into the mask folder and make the masks for each of these 341 *.dds files separately?
 

LordCroussette

Quebec City's Resident Base Builder
Addon Developer
Donator
Joined
Jan 26, 2013
Messages
228
Reaction score
744
Points
108
Location
Quebec City
Preferred Pronouns
He/Him
Do I understand correctly that if you have, for example, one surface tile of level 15, and you make tiles up to the level 19, thus you have 1+4+16+64+256=341 tiles in *.dds format, then you copy them into the mask folder and make the masks for each of these 341 *.dds files separately?
My L19 tiles don't cover the same terrain as my L18 tiles, or L17 tiles, etc. It would take way too much time to do so. If we take Reunion Island for instance, the entire island is L16 but only the areas around the major towns are in L17. Only the towns themselves are L18 and only the airports are L19. I don't use a program that pop me all the tiles for a specific zone, I have to do it by hand by putting togethers screenshots of Google Earth and then dividing them by tiles, so that method make it a whole lot quicker than if I did L19 for the entire island, for instance.

But yes, I do go through all the mask tiles one by one. It is easier and quicker than it seem. One tile only take between thirty seconds and a minute (unless the water is very badly defined and blend in the background (like it's green like the grass or something) then I have to trace it by hand and it can take a few minutes) and I usually only have a few dozen tiles per level.
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
414
Reaction score
532
Points
108
Location
Lviv
Preferred Pronouns
he/him
Thank you.
Your tricks and experience are very valuable!
 
Top