Board index FlightGear Development Scenery

How do I customize the terrain in Flightgear?

Questions and discussion about enhancing and populating the FlightGear world.

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Thu Jun 11, 2020 7:12 am

Oh so it is like a sort of virtualbox snapshot?
(I already had to work with Virtual Machines)
And the folder myscenery it's like a folder common to the VM and the host PC?
So now every file that I create inside that folder is permanent?
simone04
 
Posts: 65
Joined: Tue May 28, 2019 5:58 pm
Location: Italy
Callsign: MR-BEAN
Version: 2020.1.1
OS: Ubuntu 18.04.4 LTS

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Thu Jun 11, 2020 7:27 am

Yes, to all.
User avatar
ludomotico
 
Posts: 1102
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Thu Jun 11, 2020 9:40 am

ludomotico wrote in Wed Jun 10, 2020 10:19 pm:We have only mapped "myscenery", and this means any change or new file outside the internal "myscenery" directory will be lost when you exit the container! For example: you can install any additional program you need inside the container, but it won't be there if you exit the container and run again. Only files in "myscenery" will be kept between executions. This also means you can't break anything: exit, run again and you'll have a clean environment.

So it means that everytime that I need to work with terragear I need to run this command?
Code: Select all
sudo docker run --rm -ti -v $(pwd):/home/flightgear/myscenery flightgear/terragear bash

apart from that, everything with docker seems clear, I tested everything and it works..
Do I need to proceed with this guide?
https://forum.flightgear.org/viewtopic.php?f=5&t=35618
simone04
 
Posts: 65
Joined: Tue May 28, 2019 5:58 pm
Location: Italy
Callsign: MR-BEAN
Version: 2020.1.1
OS: Ubuntu 18.04.4 LTS

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Thu Jun 11, 2020 10:09 am

Yes, first enter "the virtual machine" (i.e.: the container), then run terragear commands inside "the virtual machine".

(docker is not exactly a virtual machine, but a glorified sandbox environment that behaves like a virtual machine, with a very cleverly designed snapshot system. This is why docker is much faster to deploy than a virtual machine)

Instead of running bash, you can also run the terragear commands from the outside, if you prefer. For example:

Code: Select all
sudo docker run --rm -ti -v $(pwd):/home/flightgear/myscenery flightgear/terragear \
   genapts850 --input=myscenery/input/apt.dat --work=myscenery/work --dem-path=myscenery/work/SRTM-3

sudo docker run --rm -ti -v $(pwd):/home/flightgear/myscenery flightgear/terragear \
   ogr-decode --max-segment 500 --line-width 10 --area-type Stream myscenery/work/Stream myscenery/input/shapefiles/v0_stream



(notice I have separated a single long command into two lines: the first line in the call to docker, the second the terragear command and its parameters)

The guide you found is specifically addressed to modify airports. Check the wiki for a use more similar to what you want: converting a .shp file you create in QGis into a .btg file for FlightGear: http://wiki.flightgear.org/Using_TerraGear

A generic build with custom airports, many land uses, lines, rivers, roads... involves nearly a hundred commands, and the process must be automated with a script or the GUI (the GUI is not included in the docker image, scripts are the only option). You aim to photoscenery, so you only have a single shape and (maybe) a couple of airports. In your case the process is "simple", only 3 or 4 commands.

- terrafit: convert elevation data. You can get good elevation data from: http://www.viewfinderpanoramas.org/dem3.html. Outputs to a working directory. For the first test iteration, you can skip this step: you'll have a flat terrain, but you can check faster whether the system is working.
- genapts, to generate airports for your area. Use the apt.data file included with FlightGear. Outputs to a working directory. Again, to test if the system is suitable to your needs, you can skip this step.
- ogr-decode, input your custom shape, output to a work directory. Show your magic with this command!
- tg-construct: build all together to a .btg file. Input to the working directory, outputs to an output directory.

Since all these commands are long commands with many options, specially if you run them from outside docker, use aliases, scripts or Makefiles! For example:

Code: Select all
alias tgenv="sudo docker run --rm -ti -v $(pwd):/home/flightgear/myscenery flightgear/terragear"
tgenv genapts850 --input=myscenery/input/apt.dat --work=myscenery/work --dem-path=myscenery/work/SRTM-3
tgenv ogr-decode --max-segment 500 --line-width 10 --area-type Stream myscenery/work/Stream myscenery/input/shapefiles/v0_stream


I wish we'd have a docker image for osm2city, probably based on this "flightgear/terragear" image. It is certainly doable, but I was unsuccessful when I tried

(edited several times for clarity)
User avatar
ludomotico
 
Posts: 1102
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Thu Jun 11, 2020 1:47 pm

I think it would be more convenient for me to use the commands directly inside docker
ludomotico wrote in Thu Jun 11, 2020 10:09 am:- ogr-decode, input your custom shape, output to a work directory. Show your magic with this command!

anyways from where do I need to get my custom shapefile?
or how do I create my shapefile?
I am a bit puzzled about this, because the wiki clearly says:
Note The text in this section refers to using data from the MapServer, which has been discontinued. Land use data (shapefiles) should be acquired from another source for now.

from what source? Also I need to know how to implement the texture into the terrain...
simone04
 
Posts: 65
Joined: Tue May 28, 2019 5:58 pm
Location: Italy
Callsign: MR-BEAN
Version: 2020.1.1
OS: Ubuntu 18.04.4 LTS

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Thu Jun 11, 2020 2:15 pm

In your case, you don't want to use any source for shapes: create your own shape in QGis: it is a single rectangle covering exactly a tile (its latitude and longitude). Since it is just a rectangle, I'm sure it can be created with some tool from the command line (ogr-something or gdal-something) but I don't know how. Probably, you don't need "exactly a tile" and it doesn't matter if it is larger than a tile: tg-build will crop it. This is the only step of the process I don't know how to automate, and the only option I know is using QGis. If you discover how to create this shape from the command line, then we can quickly automate the process for any part of the world.

(in case you really want to use existing shapes, and you don't because you are working on photoscenery: google "SHP CORINE" for Europe, or "SHP OpenStreetMaps" outside Europe)

With ogr-decode, assign a custom landclass to this shape. For example: TILEIDENTIFIER_photo.

Run tg-build to build the .btg ("the tile") with your shape.

Then, modify your materials.xml to assign your texture to the landclass "TILEIDENTIFIER_photo". Don't worry about regional textures or their limits: the only part of the world with your custom landclass is going to be your tile.
User avatar
ludomotico
 
Posts: 1102
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Mon Jun 15, 2020 4:06 pm

Sorry for my absence here but I was busy with getting familiar with QGIS, mainly because I needed to know what I was doing there...
So, I got here the .shp file with the tile bounds. (Also the shape file is called "shapeTILE.shp", just for clarification)
So now I need to move my .shp file to the "input" folder right?
ludomotico wrote in Thu Jun 11, 2020 2:15 pm:With ogr-decode, assign a custom landclass to this shape. For example: TILEIDENTIFIER_photo.

How should I implement "ogr-decode" in my case?
the <work_dir> for ogr-decode is the "input" folder right? or the "output" folder, where the stg file gets generated and <datasource> is the input folder?
Also from here: http://wiki.flightgear.org/TerraGear_Documentation#ogr-decode
what is the difference between line data and point data(--line-width and --point-width)?
for the --area-type should I put TILEIDENTIFIER_photo(that example), and then with ufo I should see with Ctrl+alt+click "TILEIDENTIFIER_photo" as the landclass name, so in the --area-type I could set any name right?
simone04
 
Posts: 65
Joined: Tue May 28, 2019 5:58 pm
Location: Italy
Callsign: MR-BEAN
Version: 2020.1.1
OS: Ubuntu 18.04.4 LTS

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Tue Jun 16, 2020 9:13 am

Ok, so I tried this command:
Code: Select all
ogr-decode --max-segment 500 --line-width 10 --area-type TILEidentifier myscenery/output myscenery/input

it did something.. in fact in the input directory I have all the shape files (actually ogr-decode required a shx file not a shp)

anyways the command did something in the output directory, but the files aren't ready, because I need to properly build them with tg-construct:
ludomotico wrote in Thu Jun 11, 2020 10:09 am:- tg-construct: build all together to a .btg file. Input to the working directory, outputs to an output directory.

Code: Select all
tg-construct --output-dir=myscenery/output --work-dir=myscenery/input --min-lat=38.8750 --min-lon=16.0000 --max-lat=39.0000 --max-lon=16.500

the --output-dir parameter points to the output directory, and the --work-dir parameter points to the input, and then I put the latitude and the longitude range.
This is the output of the command:
Code: Select all
0.00 [ALRT]:general    tg-construct version 2.1.0

    0.00 [ALRT]:general    Output directory is myscenery/output
    0.00 [ALRT]:general    Working directory is myscenery/input
    0.00 [ALRT]:general    Shared directory is myscenery/input/Shared
    0.00 [ALRT]:general    Match directory is
    0.00 [ALRT]:general    Longitude = 16:16.5
    0.00 [ALRT]:general    Latitude = 38.875:39
    0.00 [ALRT]:general    Nudge is 0
    0.00 [ALRT]:general    Unable to open priorities file /home/flightgear/dist/share/TerraGear/default_priorities.txt
    0.00 [ALRT]:general    Building tile(s) within given bounding box
    0.00 [ALRT]:general      construction area spans tile boundaries
    0.00 [ALRT]:general    3219512 - Construct in e010n30/e016n38 tile 1 of 4 using thread 139960543704832
    0.00 [ALRT]:general    3219512 - Loading landclass polys
    0.00 [ALRT]:general    3219513 - Construct in e010n30/e016n38 tile 2 of 4 using thread 139960543704832
    0.00 [ALRT]:general    3219513 - Loading landclass polys
    0.00 [ALRT]:general    3219520 - Construct in e010n30/e016n39 tile 3 of 4 using thread 139960543704832
    0.00 [ALRT]:general    3219520 - Loading landclass polys
    0.00 [ALRT]:general    3219521 - Construct in e010n30/e016n39 tile 4 of 4 using thread 139960543704832
    0.00 [ALRT]:general    3219521 - Loading landclass polys
    5.00 [ALRT]:general    3219512 - Construct in e010n30/e016n38 tile 1 of 4 using thread 139960543704832
    5.00 [ALRT]:general    3219513 - Construct in e010n30/e016n38 tile 2 of 4 using thread 139960543704832
    5.00 [ALRT]:general    3219520 - Construct in e010n30/e016n39 tile 3 of 4 using thread 139960543704832
    5.00 [ALRT]:general    3219521 - Construct in e010n30/e016n39 tile 4 of 4 using thread 139960543704832
   10.00 [ALRT]:general    3219512 - Construct in e010n30/e016n38 tile 1 of 4 using thread 139960543704832
   10.00 [ALRT]:general    3219513 - Construct in e010n30/e016n38 tile 2 of 4 using thread 139960543704832
   10.00 [ALRT]:general    3219520 - Construct in e010n30/e016n39 tile 3 of 4 using thread 139960543704832
   10.00 [ALRT]:general    3219521 - Construct in e010n30/e016n39 tile 4 of 4 using thread 139960543704832

Elapsed time: 15.0008 seconds
   15.00 [ALRT]:general    [Finished successfully]

the thing is that there is nothing in the output directory, only the directory with the files generated by ogr-decode
simone04
 
Posts: 65
Joined: Tue May 28, 2019 5:58 pm
Location: Italy
Callsign: MR-BEAN
Version: 2020.1.1
OS: Ubuntu 18.04.4 LTS

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Tue Jun 16, 2020 9:38 am

- ogr-decode, input your custom shape, output to a work directory. Show your magic with this command!
- tg-construct: build all together to a .btg file. Input to the work directory, outputs to an output directory.

i.e: tg-construct uses the output from ogr-decode. The output from tg-construct (and only this output) is you custom scenery.

If I remember correctly, you must pass the list of landclasses to tg-construct. In you case, only "TILEidentifier" (by the way, I assumed you were going to use the tile identifier as the name of the landclass: 21732782 or something like that :D)

You can also instruct tg-construct to build only a tile identifier (such as 21732782) instead of a box of latitudes and longitudes.

what is the difference between line data and point data(--line-width and --point-width)?


Your shape is an area, so both of these options do not apply. For completion:

- point data: an old option, in case you only have the position of a city and not its shape. Converts cities (described as points) into large squares. Useless these days.
- line data: converts streams, rivers, roads... Not useful in your case.
User avatar
ludomotico
 
Posts: 1102
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Tue Jun 16, 2020 10:19 am

ludomotico wrote in Tue Jun 16, 2020 9:38 am:Your shape is an area, so both of these options do not apply. For completion:

- point data: an old option, in case you only have the position of a city and not its shape. Converts cities (described as points) into large squares. Useless these days.
- line data: converts streams, rivers, roads... Not useful in your case.

Oh, I see..

ludomotico wrote in Tue Jun 16, 2020 9:38 am:If I remember correctly, you must pass the list of landclasses to tg-construct. In you case, only "TILEidentifier"

How do I pass the list of landclasses to tg-construct? There is any additional parameter that I need to include?
simone04
 
Posts: 65
Joined: Tue May 28, 2019 5:58 pm
Location: Italy
Callsign: MR-BEAN
Version: 2020.1.1
OS: Ubuntu 18.04.4 LTS

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Tue Jun 16, 2020 10:51 am

keep in mind last time I built a scenery was years ago. The process might have changed. Try not providing a list of landclasses and, if it works, good for you. Also, there is a priorities.txt file with the priorities of the landclasses. If not providing the list doesn't work, try providing this file adding your custom landclass to the top. You can see an example of this file in /usr/local/share/TerraGear, inside the docker container.
User avatar
ludomotico
 
Posts: 1102
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Previous

Return to Scenery

Who is online

Users browsing this forum: No registered users and 1 guest