In the previous entry, I described the story of a discussion with some flat-Earthers and how I created a refraction caculator in order to have stronger arguments. Today I'm going to write a bit about how this situation developed further (with the calculator, not with the flat-Earthers - I don't think anybody expects that I managed to convince a pseudoscientist? ;) ).
Let me just recap quickly on what the discussion concerned. It is that one of the flat-Earthers insists that some landscapes look the way they should on a flat Earth, and not how they should on a spherical Earth. He supports his claims by showing some photos he took and calculating some proportions of distances between characteristic points or sizes of some visible objects. It's actually a very reasonable approach - provided that one does everything earnestly, ie. calculates what proportions one should get on a flat Earth, and what they should be on spherical Earth. As it turns out - which is what the previous entry was about - that a fully correct analysis must even take atmospheric refraction into account, and it is negligible for most purposes.
The refraction calculator I created on this occasion had one major drawback - it allowed only for tracing a single light ray at a time. Because of this, for every photo you had to choose some specific points and calculate e.g. ratios of some angles. This actually still enables getting some interesting results, but isn't very attractive visually - it's just comparing numbers. So I came up with an idea of using computers to improve the situation a bit: what if I could create software that would simulate multiple rays at once, instead of just one, check where they hit the Earth's surface and generate a whole panorama based on that...?
Towards the panorama generator
I had one piece of the puzzle ready: path calculations for a single light ray both on a spherical and a flat Earth. The code calculating the paths was admittedly a part of the refraction calculator, but it was possible to extract it into a separate library with relative ease. I still needed something that could load terrain data from somewhere (the program needs to know somehow when a ray hits land or water) and I had to write the image generator itself.
Writing this eventually took a dozen or so hours, but, as is usually the case with me, I finished the work over two months after starting it.
The terrain data is being loaded from the DTED (Digital Terrain Elevation Data) files provided to the program. Such files can be downloaded for free from the Internet, for example from the USGS website: https://earthexplorer.usgs.gov. Every file on the website covers an area corresponding to 1 degree in latitude and longitude. In my case it caused a small technical issue.
The problem is that my generator is supposed to be able to simulate a flat Earth, and the data is indexed with latitude and longitude - values strictly related to a spherical shape. The Earth is, in fact, spherical, so there is no working around that. I had to find some kind of a mapping of spherical coordinates on a flat surface. I eventually settled on treating every data fragment of 1 degree x 1 degree as a rectangle with sides of approx. 111 km (the distance between parallels separated by 1 degree of latitude) by 111 x cos(latitude) km (the distance between meridians separated by 1 degree of longitude at a given latitude). This, of course, distorts some directions and distances, but I had no better idea. If any flat-Earther is reading this and has a better one - I'm open to suggestions.
Anyway, the program works. It's not blazingly fast, it takes about 10 minutes on my 8-core computer to generate a 960x600 image, but it manages. The code is available on GitHub: https://github.com/fizyk20/atm-raytracer
Let us now take a look at a few example results.
The views being simulated are the same ones I was analysing in the previous entry using the refraction calculator: Schneeberg seen from Praded and the mountains in New Zealand.
Let us start with the mountains, as they are less spectacular, but still interesting.
A reminder of what the view looked like:
Here is the simulation on a spherical Earth:
And here is the simulation on a flat Earth:
I already marked some features of the second simulation that disagree with the actual photo.
The arrow on the right points to a peak that is invisible in the photo - because it is hidden behind something in a nearer plane - exactly like in the spherical simulation.
The rectangle, on the other hand, marks a mountain range in the front that behaves incorrectly. If you take a close look at the photo and the spherical simulation, you can see that the range gets lower and lower until almost the very water boundary. On the flat simulation, though, because there is no hiding behind the horizon, an analogous phenomenon doesn't happen and the range should be visible much higher.
A strong argument for the spherical Earth. Ironically, the picture comes from a video titled "1000% Flat Earth Proof" ;)
So now let us take a look at Schneeberg as seen from Praded:
Let us see what a simulation on a spherical Earth will show:
It looks very similar. You can see the same ridges that are present in the photo and the very peak of Schneeberg, also just like in the photo.
So what would the view look like on a flat Earth...?
Well... there is a difference. What is more, this view is zoomed out relative to the spherical Earth simulation (the horizontal field of view is 5 degrees, for the spherical one it was 2 degrees) - otherwise the mountains didn't even fit in the picture! For a better comparison, the reddish ridge in the middle is the same one that Schneeberg is peeking over in the spherical Earth simulation...
What is happening here? Again, the main reason for such a view is the lack of hiding behind the horizon. On a spherical Earth, the distance of 277 km lowers the mountains enough for their peaks to be below eye level for an observer on Praded. There is no such effect on a flat Earth, so peaks taller than Praded (and Schneeberg is 500 m taller) have to be above eye level.
By the way, this simulation is a nice illustration of the numbers obtained in the previous entry. The calculations showed that the visible part of Schneeberg should be about 0,075 degrees in size on a spherical Earth, and over 0,9 degrees on a flat Earth. This huge discrepancy is clearly visible in the simulations.
What is the verdict, then? As you can see, when you have something to compare the landscapes to, it is clear that the flat Earth claim is undefendable. Of course this doesn't bother eager flat-Earthers - but this was not about that. The main goal was to have fun writing the simulator, and being able to get interesting results out of it... that's just added value ;)
I created a few more comparisons of simulations and real views in the form of video clips. They are shown below.
I also created simulations of one more panorama - a photographer Witold Ochał managed to catch a view of the Tatry mountains from a village called Szkodna in Podkarpacie, Poland. Here are the results of comparing the simulations to reality:
I think that the video clips above speak for themselves.