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 ludomotico » Tue Jun 09, 2020 6:08 pm

simone04 wrote in Tue Jun 09, 2020 2:45 pm:The image in this screenshot is "stretched" for the whole territory .. The strange thing, however, is that it repeats itself, but not because the image is small (besides that), the problem is that it repeats itself in the middle of the image , it is not even displayed completely..


This is the normal behaviour of terragear: terrain shapes are not aware of their offset inside the tile, and the UV mapping is, in all practical ways, random. You are projecting an image to many different shapes, each one needing their own offset. I don't believe this is going to work.

If you want to walk this path, you MUST define your own rectangular shape covering exactly a tile with qgis, run terragear on your custom shape and check the UV-map is right with blender, as the wiki says (section "texture materials"): http://wiki.flightgear.org/Photoscenery I'm sure this process can be easily scripted (`make_photoscenery_tile 12345 latitude longitude image.png`), but I don't believe such script exists.

If you don't want to rebuild your terrain, you can try the "texture overlay" method. I believe this is closer to what you are trying to do. Be aware this method involves changing the source code of a 10 years old version of FlightGear
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Tue Jun 09, 2020 6:25 pm

In fact, since I believe we have a "BTG importer" for blender, maybe you can import the BTG file (i.e., "the tile") in Blender, map the texture, and export the BTG file.
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: How do I customize the terrain in Flightgear?

Postby Hooray » Tue Jun 09, 2020 6:41 pm

ludomotico wrote in Tue Jun 09, 2020 6:08 pm:If you don't want to rebuild your terrain, you can try the "texture overlay" method. I believe this is closer to what you are trying to do. Be aware this method involves changing the source code of a 10 years old version of FlightGear


As far as I remember, the patches were rather self-contained (roughly 50 lines of code) and didn't do very much other than provide a mechanism to register overlay coordinates to be used by the effects/shader system, so should be restricted to simgear only - and given that scenery core development has been stagnating for many years, it may not be that far fetched to rebase those patches, I believe most of the code in question was originally written by Curt, ~20 years ago :D

To see for yourself, you only need to take a look at the corresponding commit logs: https://sourceforge.net/p/flightgear/si ... binobj.cxx

So there's roughly ~10 commits, most of which would seem unrelated to the original modifications - and in fact, obj.cxx is only 100 LOC, and dates back to 1997 :lol:


https://sourceforge.net/p/flightgear/si ... binobj.cxx
https://sourceforge.net/p/flightgear/si ... db/obj.cxx

Apart from that, the more proper method would be to use a dedicated canvas placement to drape arbitrary textures over the terrain mesh: http://wiki.flightgear.org/Canvas_Scenery_Overlays
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Tue Jun 09, 2020 7:02 pm

I would prefer to build my own terrain instead of touching 20 years old code :? :mrgreen:

But I need to know how to use terragear... Anyone has a nice tutorial on how to use it?

Also because it isn't rocket science right? :)
simone04
 
Posts: 65
Joined: Tue May 28, 2019 6: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 pb321 » Tue Jun 09, 2020 8:20 pm

pb321
 
Posts: 424
Joined: Sun Nov 27, 2016 5:08 pm
Version: 2020.4.0
OS: Windows 10 Pro

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Tue Jun 09, 2020 8:57 pm

Should I adapt this on Ubuntu or there is another specific tutorial for linux?
Anyways thank you
simone04
 
Posts: 65
Joined: Tue May 28, 2019 6: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 pb321 » Wed Jun 10, 2020 4:04 am

Here are two other sources, just not tutorials as such: http://wiki.flightgear.org/Using_TerraGear and
http://wiki.flightgear.org/TerraGear_CORINE. I believe the tools are the same whether using Linux or Windows. Here is a tutorial specifically describing use of NLCD data with TerraGear, but it may be helpful as well: http://wiki.flightgear.org/Howto:Using_QGIS_to_process_NLCD_data

Hope this helps get you started.
pb321
 
Posts: 424
Joined: Sun Nov 27, 2016 5:08 pm
Version: 2020.4.0
OS: Windows 10 Pro

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Wed Jun 10, 2020 9:26 am

Getting terragear on Linux is much easier than on Windows: download the source code, build, done.

In any case, you can also use a docker container on any modern system. I think docker is the easiest/cleanest way these days to run terragear on Linux, Windows or OSX: https://hub.docker.com/r/flightgear/terragear I you don't know docker you have to learn about it, but it is a very useful skill.
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Wed Jun 10, 2020 9:45 am

It is like a snap package?
Some sort of system that install the package independently?

Mmh well I think that I'll build terragear... (I just don't want to mess up things with docker :? )
simone04
 
Posts: 65
Joined: Tue May 28, 2019 6: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 » Wed Jun 10, 2020 10:14 am

right now I am compiling terragear(along with simgear, as I understand is required)
I am using this script that I got from this wiki:
http://wiki.flightgear.org/TerraGear#Using_the_download_and_compile.sh_script_.28Linux_distros_using_apt.29
What I need to do when I finish compiling?
Also should I use the GUI?
I pretty much know what I do when I use the command line so I don't know if I need the GUI....
simone04
 
Posts: 65
Joined: Tue May 28, 2019 6: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 » Wed Jun 10, 2020 11:41 am

simone04 wrote in Wed Jun 10, 2020 9:45 am:It is like a snap package?
Some sort of system that install the package independently?


Docker is something in between a snap package and a virtual machine. Compared to snap packages, docker offers many additional properties such as dynamic allocation, service composition, security and can be run on Windows/OSX. Compared to a virtual machine, docker is much lighter and can be deployed faster.

Docker is addressed to system administrators. Anyway, after an initial research to have docker running, advanced users not interested in system administration will find docker containers and snap packages quite similar.
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: How do I customize the terrain in Flightgear?

Postby Hooray » Wed Jun 10, 2020 11:55 am

Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: How do I customize the terrain in Flightgear?

Postby simone04 » Wed Jun 10, 2020 3:03 pm


mmmh I see.. Semms simple.. I installed docker and did this command on the terminal:
Code: Select all
docker pull flightgear/terragear

so now I am ready to go right?
simone04
 
Posts: 65
Joined: Tue May 28, 2019 6: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 Hooray » Wed Jun 10, 2020 3:51 pm

See: http://wiki.flightgear.org/Howto:Docker ... _toolchain

And feel free to add to it, and to contribute your own improvements back to the project.

PS: You will not necessarily need to build the OSG part of SimGear, the headless portion should suffice: http://wiki.flightgear.org/Howto:Buildi ... via_Docker
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: How do I customize the terrain in Flightgear?

Postby ludomotico » Wed Jun 10, 2020 11:19 pm

The article linked by Hooray tells how to build a docker image. You already have pulled the docker image! No need to rebuild it!

Some definitions:

- a docker image is similar to a snapshot of a virtual machine: something static, frozen in time you can always reload to have a clean environment. "flightgear/terragear" is a docker image.
- a docker container is an image that has been started. When you run the image "flightgear/terragear", you have a (by default, randomly named) container in your PC, similar to an isolated virtual machine. Usually, when a container ends, it is deleted and the image is ready to be run again to create a new, clean container.

simone04 wrote in Wed Jun 10, 2020 3:03 pm:so now I am ready to go right?


Now, create and map the input and output directories and enter the docker container:

1. create a "myscenery" directory and any files or directories you need. For example: save your shapes in an input "input" directory, in "output" you'll find the scenery, after you build it!


Code: Select all
mkdir myscenery
cd myscenery
mkdir input output



2. Run this command (maybe, with sudo). This command maps the current directory (hopefully, "myscenery") to the myscenery directory in the container, and then enters the container

Code: Select all
docker run --rm -ti -v $(pwd):/home/flightgear/myscenery flightgear/terragear bash


Explanation: "docker run OPTIONS IMAGE COMMAND".

- The image "flightgear/terragear" is the name you just pulled (not even necessary pulling before running: docker automatically downloads the image if you have not pulled it yet)
- OPTIONS are: --rm (delete the container after using it); -ti create an interactive terminal and -v EXTERNAL:INTERNAL maps an external directory to an internal directory.
- We run bash in the internal container. bash is the default command in this specific image, but I like to say "run bash" explicitly because bash is usually NOT the default command for most images.

3. The image ""flightgear/terragear" is based on Ubuntu, but terragear, simgear and some geo tools are already built and installed. Run ogr2ogr, genapts, tg-build.... the commands described in the wiki, using the files and directories in "myscenery" for input, working and output directories.

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.

4. When satisfied, exit with "exit"
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 5 guests