A utility to approximate satellite imagery of any location in the world. Aimed to be viable alternative for ortho photos in flight simulators, such as X-Plane or Microsoft Flight Simulator, with the main purpose to eliminate challenges with actual orthophotos. Written in Python.
While tools like Ortho4XP or AutoOrtho can provide next-level realism into X-Plane, the idea still falls short when it hits photos that were stitched together. In one or many ortho photos, you will see parts of the specific area of which the photo was not taken at the same time as another part, resulting in what is known as discoloration. Sometimes you will also find clouds in the photos, or remnants of buildings or attractions which show perspective distortion. This is a huge immersion-breaker for me and many others. A problem I wanted to tackle for my flight simulator - Orthographic may just be the solution that does away with all issues when it comes to ortho photos in flight simulators.
Currently, zoom level 18 is implemented.
Orthographic | Real World
Aerial photos taken with a satellite, of varying resolution, altitude, and detail. When you switch to satellite in Google or Bing Maps - what you see is a collage of ortho photos, depending on how close or far away you are zoomed in.
As outlined, it is a tool that can generate, or rather - approximate, photo-realistic ortho photos. It does so by using a number of sophisticated mechanisms to generate these. These photos are then used as textures for the specific area the photo is made for - specifically a latitude and longitude coordinate.
It is obviously not a full replacement for the real thing - satellites provide photos of how the world really is. Orthographic can only approximate the looks, and it tries to do this as best as it can using the data it knows about the specific latitude and longitude... but do not expect a complete 1:1 match of the real world with fixed coloration. It is also not meant to compete with mapping services or tools - it is merely a collection of scripts working together to offer a close approximation of how a satellite photo would look like.
It boils down into these steps:
- Acquire OSM data for the tile from my API
- Construct masks from that data, for a number of layers, from top to bottom
- Covert each mask layer to a photo-realistic layer
- Merge (blend) all layers from bottom to top
Orthographic creates zoom level 18 tiles for everything it encounters. If you want scenery to be generated, it can also optionally create normal maps for your flight simulator which makes the tiles appear more realistic without using additional geometry. For example, in X-Plane, normal maps not only define the "bumpiness" of a texture, it also defines its shininess or specularity. This is defined by the alpha value of each pixel, in the normal map image.
The final tile images are stored in DDS format with standard DCX-1 compression, which should be usable by X-Plane and Microsoft Flight Simulator.
If you want to deep-dive into the technical details of the software, you can download my whitepaper in PDF format on the project here:
(Link)
Orthographic does its very best to approximate good-looking ortho photos, as if they were taken by a satellite. However it is what it is: an approximation - it cannot replace or even get close to the actual, real world. I have tried my very best to bring in some variety, and make it so that every part generated does not repeat or look the same - like it is the case with other ortho packages I have tried, apart from Ortho4XP / AutoOrtho.
It is, at the end of the day, for a flight simulator. I believe Orthographic can strike the right balance between accuracy of the part of the world you fly in, and acceptable yet somewhat realistic looks.
Prior to publishing, there have been many iterations and hours of testing the generation of buildings. While the current state is far from perfect, it is as best I can make it - and I think we can agree that it looks good enough... for flight simulators. With the right tools in place, buildings will most likely be placed on many of these locations anyways.
Also, prior to publishing, there has been extensive testing of the code that generates the normal maps to make water as best looking as possible. And trust me, this has been an interesting challenge (to say the least).
It does a really good job at generating good-looking photo tiles, and knows how to correct Mercator distortion to render these tiles.
It also does a good job at making sure the tiles are seamless, and knows where a tile needs to be seamless, while at the same time, it also knows when it can pick something and be creative.
During development it also learned how to make a few things look more realistic - namely (hopefully good enough, or believable) shadows for certain elements.
Of course, an algorithm of this magnitude can only go so far. Also, this is a one-man project - which means I do not have the monetary resources to make this the ultimate ortho photo solution that works without a satellite... but still, I believe to have done a fairly good job - that is for you to decide. Our planet is vast and so is the data available for it - over time Orthographic will learn more and more how to make use of that data.
In other words, it fails to generate parts of the world where there is no OSM data available. At this time, Orthographic gets creative to fill in the gaps.
At this time, it also falls short in generating the 3D geometry for a tile. It is specialised to generate ortho photos - or in other words, textures for existing geometry.
Buildings are a challenge still - but in time the code for buildings has grown to the way it is now, and I think when blended with actual 3D geometry, the generated orthos really shine (provided the 3D geometry for buildings used the same OSM data than I did).
Apart from that I am aware that the code is most likely not the best and can be optimized. It is my first bigger Python project I dare publishing.
- Current Python version (3.10 and up)
- Python modules: Pillow (formerly PIL), requests, numpy
IMPORTANT NOTE: Make sure that Pillow is at least version 11.0. If you have it installed already, you can check the version by doing a
pip list
in either your normal installation or your virtual environment (venv) and check the output. For proper functionality, the result should show like this:
./pip list
Package Version
------------------ ---------
[...]
pillow 11.0.0
[...]
Open the file defines.py .
You will find various configuration options, each of which is documented what it does.
In this file you can also define how large you want the final products to be - you can choose between 4k resolution (2048px) or 16k resolution (4096). The choice you make here should be based on 1) how much detail you want, and 2) how much VRAM your GPU has. The larger a texture, the more VRAM is needed, and the more processing is required by the GPU. I personally go with 2048, as I have a RTX2060, so my VRAM is limited. When at altitudes of 10,000 feet and above, you will most definitely not notice the difference between 4096 and 2048.
NOTE! 4096 not yet implemented.
Also in defines.py, you will find the single layers, along with their corresponding mask blurring values. It is my strong recommendation NOT to change these values, as I have taken a lot of time to fine-tune these values.
Very simple.
First step:
python og.py LATITUDE LONGITUDE true
So for example
python og.py 51 7 true
This will generate a complete dataset containing which sources to use in which quadrant of the image grid.
Then:
python og.py LATITUDE LONGITUDE NUMBER_OF_SIMULTANEOUS_IMAGES_TO_PRODUCE
So for example
python og.py 51 7 32
This will generate 32 "orthos" at once. Which number you can use highly depends on the performance of your hardware.
This does everything for you.
ATTENTION! This process will take a considerable amount of time due to the work being involved. Please keep this in mind, especially if you seek to do this for an entire country.
For X-Plane scenery, you will need to do this once step 2 is done:
python og.py 51 7 xpscenery
This will generate the terrain mesh and associate the textures with the mesh.
I am considering hosting the finished tiles on my server, so that you only need to download the finished photos / tile packs.
As I have hosted this on my private but publicly accessible git repository, it should be clear that I am making the code available to everyone. Of course, you are free to improve (I am sure the code needs some optimisation). If you changed or improved something, and you publish it (no matter where), you MUST adhere to the license this software ships with, which is OSL 3.0.
As it is hosted on my private gitweb, and not in a public instance like GitHub, I need to be very careful and clear about this. In short it means, also legally, that you cannot download the current snapshot, post the content somewhere else, and claim you made it. Respect the time, work and energy I have invested into this project :) .