412
edits
(Formatting ( Updated aircraft should be a subheading of In the hangar )) |
|||
| Line 101: | Line 101: | ||
== Scenery corner == | == Scenery corner == | ||
=== Photoscenery generator for Julia compiler === | |||
[[File:G91R1B taking off from LOWI .jpg|thumb|500x500px|The G91R1B taking off from LIME with 32 Kpixel photoscenery]] | |||
There had been talk of photoscenery for FGFS for years, but very little had been done to create a practical solution for everyone. Then the breath of fresh air coming from Flight Simulator 2020 gave the stimulus to try something similar also for FGFS. The result was to insert, in the development code, the system for loading the orthographic images to be spread over the 3D scenario instead of the classic textures linked to the type of territory. | |||
At the beginning of this adventure, I had done some tests noting that everything worked pretty well and the performance of the program was still good. | |||
I then looked for a way to download blocks of images quickly and methodically and so I found this excellent software by the talented [https://nathanielwarner.net/home Nathaniel] published at [https://github.com/nathanielwarner/flightgear-photoscenery this link] | |||
The software is mainly written in Python for the image download part and in Perl for the area management part to cover a territory with orthographic images. I have been using the program for several weeks with satisfaction, but when my friends, from the Italian Flightgear forum on Discord "FG ITA Mercenaries", started asking me how to make it work on Windows 10 I had to waste a lot of time organizing a solution based on Linux Bash Shell. | |||
Perché usare Julia e non Python | |||
It worked, but it was not very practical and then had various problems due to the difficulty of managing thousands of images and downloading, it had very long download times, the problem of resuming operation from an interruption, downloading very large images, such as 32K pixels (1GB image). Then there was the problem, for many of my forum friends, in using the Bash Shell. | |||
==== Why use Julia and not Python ==== | |||
At this point I had made the decision to get into the code and make the additions that I deemed necessary to solve the problems reported by my friends. The code was written in Python, but I had noticed that many users also found it difficult to install Python 3 and the various libraries needed to make the program work. | |||
However, in the meantime, for professional reasons, I was studying a programming language called Julia (https://julialang.org). | |||
This language which is suitable for handling engineering, math and physics problems in a very efficient way and with full support of multi CPU and GPU systems. The language was developed in [https://julia.mit.edu MIT] with a respectable pedigree: ''Amazon, DARPA XDATA, Intel Science and Technology Center for Big Data, Saudi Aramco, MIT'' etc ... The good thing is that Julia installs very easily on any OS, all libraries are written directly in Julia and therefore can be run, without modifications, in any environment where the Julia compiler has been installed. | |||
This means that I could make the software directly on my Linux Ubuntu PC and see it running on Windows, MAC .. Raspeberry without modifying anything! Not only that, but Julia is one of the fastest compilers that exist, it is on the level of C ++, but sometimes it surpasses it in speed, this is the reason why all the libraries are written in Julia and not with the usual C, C ++ or Fortran. It is a language made to chew numbers and AI programs and simulators for Quantum Computers, to replace Math CAD, R etc. The replacement of these languages has led the vast community of programmers to create many Julia libraries, all of which are lightning-fast and feature-rich. | |||
At this point I decided to use Julia to write the program that could download the scenarios easily and quickly in FGFS. | |||
==== The Photoscenary.jl program ==== | |||
The program was born with a name that is the Italian pronunciation of the word "photoscenery", the extension "jl" indicates that it is a program written in the Julia language. | |||
The program exploits several Julia libraries in order to obtain a simple and fast code. The only problem is that there is no library for converting PNG images to DDS, but this must be done by a graphics processing program called [https://imagemagick.org/index.php ImageMagick] it is also possible to use only PNG images to avoid using ImageMagick, but unfortunately this format slows down the operation of FGFS a lot and so I immediately discarded it. | |||
==== Using the photoscenary.jl program ==== | |||
The program manual was written in the FGFS wiki at this address: | |||
https://wiki.flightgear.org/Julia_photoscenery_generator | |||
where it is possible to have all the necessary instructions for its installation and use, the program can currently be downloaded from my GIT with GPL2 license: | |||
https://github.com/abassign/Photoscenary | |||
You run the program by placing us with a console (Linux, Mac) or command prompt (Windows) in the directory ~ / Photoscenary by typing the command: | |||
<code>'''julia photoscenary.jl'''</code> | |||
This is how it already works and starts downloading an area of 10 nm radius around the LIME airport (Bergamo, Italy), so if you take off from that airport you can test the operation of the program and observe the results it produces. | |||
If you want to see the scenery in another airport area (The program contains a database with over 60,000 ICAO airports) you have to add an option: | |||
<code>julia photoscenary.jl '''-i''' LOWI</code> | |||
From the LOWI airport (Innsbruck) there is a nice route that connects it with LIME passing through the Alpine area of the Dolomites, then takes a turn on the city of Verona (The city of Romeo and Juliet) and finally lands in LIME. This route is described by a file created with the FGFS Route Manager, the file has been inserted in the GIT, and then just type: | |||
<code>julia photoscenary.jl '''–route''' LOWI-LIME.xml</code> | |||
The program starts downloading almost 200 images of 2K pixels in about twenty blocks of process. If now we want to make everything faster we can insert the turbo: | |||
<code>julia '''-t 10''' photoscenary.jl –route LOWI-LIME.xml</code> | |||
With this option the download speed increases by 2-10 times as we have authorized Julia to use up to a maximum of 10 CPUs (if any) of the PC. Thinking your system is slowing down? No, it doesn't slow down, you can continue to use FGFS without noticing anything, unless your system is old and maybe with a 2 CPU processor from 10 years ago. | |||
The real limit is the speed of the Internet and how much the provider, which releases the orthographic images, is willing to give you. Normally, in my system, 2K pixel images download at the rate of one image every 2 seconds .. those at 4K (already very good for a VFR flight) at a rate of one image every 4 seconds. | |||
This means that in the future, if our FGFS developer friends so wish, the program could load the scenario directly, while flying. | |||
If we want to enlarge the area where the photoscenery is visible (by default it is 10 nm) we must add the -r option which defines the radius within which the images will be downloaded, for example we download the images in a radius of around 100 nm to the airport, with -r 100 option: | |||
<code>julia -t 10 photoscenary.jl -i “orio al serio” '''-r 100''' -s 3</code> | |||
In summary, this command indicates that we download an area with Orio Al Serio (LIME) in the center, for a radius of 100 nm at the resolution of 4K pixels per image, the -s parameter can vary from 0 (512 pixels) to 6 (32768 pixels) and, in this case, -s 3 means a 4K pixel image. | |||
We can also change the image server, there is the '''–map''' option followed by a number which is 2 for the US server (all the United States) or 3 for Spain. | |||
Finally, another useful option is –over followed by a number that defines how the program behaves when it encounters an image already loaded, for example: '''–over 1''' replaces the image it finds already inserted only if it has a smaller resolution of the new one. If, on the other hand, '''--over''' is not declared or is set to zero, the program does not download the image if it is already present. In this way it is possible to have differentiated areas in the resolution of the images. | |||
I hope with this I have explained this project and have given you the curiosity to try it. | |||
You can ask anything at this FGFS forum post: | |||
''Photoscenery generator for Julia compiler'': | |||
https://forum.flightgear.org/viewtopic.php?f=5&t=39066 | |||
<!-- Scenery development news --> | <!-- Scenery development news --> | ||
edits