Link to here: walter.bislins.ch/RefractionSim
The Demos behind the black buttons are based on the excellent website about An Introduction to Mirages by Andrew T. Young. Please follow the links below the buttons shown as "more infos" to go to the specific page on his website where he explains the phenomena in detail (sometimes you have to press F5 to see the contents).
Intro Reset Std 2km 4.8km 9.5km Looming Towering Stooping Inferior Mirage Superior Mirage Chicago strong Looming Chicago Superior Mirage Salt Lake City Stooping Sunset FE Curved God Rays
The images of the simulation are composed of pixels. Each pixel has at least one assosiated light ray comming from the scene and carrying a color value from the surface of at least one object.
But the simulation works backwards. It calculates for each image pixel at least one light ray into the scene and checks where this ray hits the Targets. This principle as called a Ray Tracer.
Each light ray is divided into many Ray Segments. The start point and direction of the first Ray Segment is determined by the location of the image pixel with respect to the observer.
Then depending on the position and direction of the Ray Segment the Refraction Coefficient and from that the bending of the Ray Segment is calculated as described at How Custom Refraction is derived. From this bending the end position and direction of the Ray Segment can be calculated. This gives the start point of the next Ray Segment and so on.
Each Ray Segment is checked against all Targets of the scene. If the Ray Segment intersects a Target, the exact intersection point is calculated and which target coordinates are hit by the Ray Segment. The target coordinates are used to determine the color of the target at this coordinates. If the target is opaque, the calculation of the light ray ends here and the image pixel color is defined. If the Target is transparent, the color is stored for later and the calculation of the light ray continues until the next opaque Target or the Horizon is hit. Then all stored colors are combined and define the image pixel color of this light ray. It is also possible to assign multiple light rays to one pixel to get smoother edges in the image (antialiasing). This is accomplished with the Obersampling setting.
Because the simulation makes use of curved Ray Segments, only very few segments are needed, compared to simulations that use a straight Ray Segment approach, to achieve the same accuracy. This allows to simulate even Astronomical Refraction with very long light rays in a short time, see the Sunset Demo.
The simulation is written entirely in JavaScript and uses the HTML canvas element to display the rendered graphics. The Source Code of the simulation App alone, excluding the code of the modules for the graphic output, control panels ect., consists of about 5800 lines.
The bending of each light ray is dependent on the Refraction Curve along the path of the light ray. The simulation splits each light ray into a number of segments and calculates the bending of each segment and joins the segments together to a single light ray.
The curvature of a Light Ray Segment depends on the Refraction Coefficient at the location of the Ray Segment. The Refraction Coefficient depends on the atmospheric conditions at the location of the Ray Segment and the vertical direction of the light ray segment.
The atmospheric conditions are derived from the inputs in the Barometric Settings panel. You can specify two different barometric parameter sets for two different locations, eg. for the location of the observer via Baro Measure Dist at the Baro Observer panel and the location of the farthest Target or the Horizon at the Baro Target panel. If you don't specify barometric data for the second panel, the parameters from the first panel are used along the whole light path. If you specify separate target parameters, the values between are interpolated and for distances beyond that the target parameters are kept fixed.
You can enter Pressure, Pressure Altitude and some pairs of (altitude, temperature). The simulation contains a default barometric model as defined by the Standard Atmosphere. The entered parameters modify this model accordingly:
You can display the Temperature Curve, Temperature Gradient Curve and Refraction Curve by selecting Display = Baro.
The simulation can now calculate the Refraction Coefficient for any point in the atmosphere between observer and Horizon. The Refraction Coefficient, together with the vertical angle of the Ray Segment at a certain position and altitude, determine the curvature of the Ray Segment.
To calculate the Refraction Coefficient from the barometric data and the vertical angle of the Ray Segment the following equation is used:
(1) 
 
source  
where^{'} 

Note: The constants in the equation above are slightly different in different parts of the world due to different mean atmospheric conditions. Their visual differences are minute but must be taken into account on precise survey measurements over long distances.
The curvature of the Ray Segment is then calculated by the following equation:
(2) 
 
where^{'} 

Note: The same equations are used for Globe and Flat Earth, because the physics of Refraction is not dependent on the shape of the earth. The curvature or flatness of the air gradient is taken into account by the simulator. The equations do NOT assume a globe earth! The radius of the earth R_{E} in the equation is due to the way the Refraction Coefficient k is defined. k could be defined as the curvature of the light ray without scaling it with the readius of the earth. You can modify (1) accordingly so that you can calculate the curvature of the light ray directly without any reference to the radius of the earth:
(3) 
 
where^{'} 

The App can be called with some URL parameters to set a specific stored App State:
On the Save/Restore Panel click Get App URL to get an URL from the current state of the App. Copy this URL into any WebForm (e.g. YouTube comment). Clicking the link will call this page with the saved state.
The parameters may be combined in one URL, eg. &demo=Sunset&tab=Targets
A Scene is composed of a list of Targets. A Target can be an Image or a Pattern.
Each Target can be positioned and rotated individually.
A Target can be sized as needed. This is important if you use images that show a certain scene like a skyline.
A Target can have Boundaries/Limits or it can be infinetely extended in any direction. If a Target is an image without boundary limits, the image is repeated.
Targets can be made partially transparent. Simulated Light Rays are sent through the scene until they hit an opaque Target or exceed the Horizon limit.
To create a new Target, open the Targets panel and click on New. A copy of an internal Target Template is created. You can also create a Copy of the current selected Target by clicking Clone and then change some parameters. Or you can create one of the Preset Targets.
Note: Targets are treated differently in the Model Flat Earth and Globe Earth. On the Flat Earth model the targets are always flat planes. On the Globe Model the same targets are wraped around the globe, so targets that are not entirely vertical are curved. This allows to create targets like water images that are flat on the Flat Earth display but curved on the Globe Earth display.
Note: For some scenes the order of the Targets may be important. You can move the Targets in the sequence with the buttons Move Up and Move Down.
Because each simulated Light Ray is dividet into many Ray Segments, a limit must be defined so that the calculation is stopped if no opaque Target is hit. This limit is called the Horizon.
A color gradient can be specified for the Horizon, so that a light ray hitting the horizon has a defined color assigned to it. The specified Horizon Distance limits how far a light ray has to be calculated.
In the simulation each light ray is dividet into many Ray Segments. For each Ray Segment the Ray Curvature is calculated separately from the Refraction Coefficient at the position of the Ray Segment, see How Custom Refraction is derived.
The Ray Curvature is the bending of a simulated Ray Segment. The Ray Curvature is derived from the Refraction Coefficient and the vertical angle of the Ray Segment at its position.
The Refraction Coefficient is a measure of the Ray Curvature of a light ray with respect to the radius of the earth. The Refraction Coefficient is defined as:
(4) 
 
where^{'} 

A value of k = 0 means the Ray Segment is straight. A value of k = 1 means the Ray Segment has the same curvature radius as the earth. Ray segments with negative Coefficients are bent upwards.
The Refraction Coefficient can be calculated from atmospheric properties such as Pressure, Temperature and Temperature Gradient at any position of a light ray segment. It also depends on the vertical angle of the ray segment, see equation (1).
The Refraction Coefficient in reality is slightly different at each location of a light ray from the observer to the Target. In practical applications like survey a mean Refraction Coefficient may be used as an approximation. The simulation calculates the individual Refraction Coefficient for each Ray Segment along the whole way from the observer to a target.
The Refraction Curve describes the Refraction Coefficient as a function of altitude, so each altitude is a certain Refraction Coefficient assigned. The Refraction Curve is derived from the Barometric Settings, see How Custom Refraction is derived.
The simulation calculates two Refraction Curves, one for the observer location and one for a Target location the user can specify. For all locations between observer and target the Refraction Coefficient is derived by interpolating the Refraction Coefficient from this two curves according to the altitude and location of a Ray Segment. If no Barometric Settings are defined for a target location, the observer Refraction Curve is used everywhere.
The Pressure changes with altitude. Such a change is described by a Pressure Curve, which gives the Pressure as a function of altitude.
The simulation uses the Standard Atmosphere as the basis for the Pressure Curve but modifies it according to the user specified Pressure entered in the Barometric Settings.
The temperature changes with altitude. Such a change is described by a Temperature Curve, which gives the Temperature as a function of altitude.
The simulation uses some discrete user specified temperature values to calculate a smooth Temperature Curve through these points. The calculated curve blends into the curve as defined by the Standard Atmosphere above the highest specified Temperature point.
The Temperature Gradient describes the change in Temperature at each altitude. Mathematically it is the Derivative of the Temperature Curve with respect to altitude.
The simulation calculates a Temperature Gradient Curve from the Temperature Curve.
The Temperature Gradient Curve is a mathematically curve that connects all Temperature Gradient values for a specific altitude and is derived from the Temperature Curve. The Temperature Gradient Curve is used in the calculation of the Refraction Curve.
The Standard Atmosphere defines curves for Temperature, Pressure, air Density and Temperature Gradient for each altitude up to about 85 km. These curves are derived from mean values and used as a reference in many applications, eg. in aviation.
The simulation contains the Standard Atmosphere model and uses it for regions the user does not provide atmospheric data data.
Great work!
Nevertheless, dispite maybe it would be antiscientific, but it would be very curious and even funny to see the picture with flat earth and negative refraction with its radius equal to the radius of spherical earth
Nocolas, already implemented!
Press the button FE Curved above the displays. To see the correspondig Rays bending upwards select Display = Rays below the right display.
To get the same observations on the Flat Earth due to refraction there must be an impossible Temperature Gradient of −15°C/100m every day!
It's super great! The same picture on the Flat Earth really impossible due to the properties of atmosphere and it's gasses. But there is vacuum and maybe there is aether. And it could be more dense closer to Earth surface. And lightspeed could be faster in this denser aether. A littlebit. And produce very stable negative refraction. Hypothetically.
I really don't believe that you've surrendered to the problem of measuring of terrestrial refraction. Moreover, you was very close to the truth. Some correction of method and formulas,maybe... I guess, one middle point only needed.
Nicolas, if you know a method to align at least 3 measuring rods exactly parallel at a distance of about some 100 m or more each, let me know. The only way I can think of is to measure the angle to a fix star at each location at the same latitude at the same time. But this only will work if you believe that stars are very far away, much more than what flat earther believe.
We have instruments that measure refraction directly using 2 lasers with different wave lengths which are reflected from a target. But this method is nothing a layman can use. This instruments are cutting edge technology and have to be extremely precise, because the difference in the light paths are extremely small. This instruments are very expensive.
But anyway, we have multiple ways to measure refraction and correct the measurements accordingly. And we always get a drop with distance as expected by the WGS84 globe model.
Nowadayas we use directly GPS to acquire 3D coordinates of any point on earth or in space. Jesse drove over the Causeway bridge with his car equipped with GPS recorders. He then plotted the data. And guess what, the bridge curves with a radius corresponding to the accepted radius of the earth. This experiment will be repeated with much more details this winter.
Oh, I've just mistaken too with your method, with what I wanted to change with it. You are right.
But I have another method. It measures change of declination of vertical line (or not exactly vertical)due to the distance of measuring. It is just modified method of measuring the distances between top and bottom points of bridge vertical supports. I propose to use mountain slope. Distance between two points depends from refraction, but difference doesn't so much. (Really, this method is not so simple. For example, if to measure distances to low and upper point from lower point, the measurement will show declining due to refraction, not for declining itself)
Really the fixed star is the most precise method, of course
And there is more simple method to detect the declining of axes: using vertical declination measured between two points in both directions, and geometric properties of parallel lines crossed by third line, but refraction will affect the result. Meanwhile the first method doesn't depend of refraction.
If to talk about Flat Earth and our beliefs, my model of Flat Earth ( really I'm not a flatearther, but I've built the model of Flat Earth, or rather flat part of huge jupiterlike planet, on my view, the only possible, if to be flat). According to my model, all terrestrial bodies ( the Sun and Moon too) that we see, or don't exist at all, or situated in absolutely other places (but in the same configuration ). And there is Dome above Earth, that doesn't rotate, that wasn't built, but had grown itself long time ago, that is a living organism, and it has a holographic function and other functions. And there is no any conspiracy, spacecrafts work, and show us real photos, but Dome works too. And we may rely on stars that Dome shows, but it is only our belief, that it is shown in that way, that we need.
Hi, I guess I found an error in refr calc.
https://ibb.co/
Water texture does not go to true horizon level, check several times.
Nick, thank you for your feedback.
It's not an error but something I can improve. You have to insert a value at Horizon Dist other than auto on the Rendering panel, because auto sets the horizon too near if the target is not behind the curvature of the globe. The rendering of the ground stops at the horizon sphere, which is in your case too near.
The horizon in the simulator is a sphere with radius Horizon Dist. If a light ray hits this sphere the ray tracer stops there, even if the real globe or FE horizon is much farther away. This limit is there to speed up the calculation, because it limits the number of light segments that have to be calculated. So depending on the scene you are trying to create, you have to manually enter a suitable horizon distance depending on the observer height. Try 50 to 100 km. This should do it.
I will improve the calculation of the auto horizon to set it some factor behind the globe horizon.
The atmospheric refraction works the opposite way  it lowers distant objects, and it also widens them at the very end, which is why the Sun and the Moon look elliptical at rise and set. The formula for the Earth's "curvature" is the formula for the atmospheric refraction! It explains the bending of rays in your Dome model, too!
Ivo: The atmospheric refraction works the opposite way  it lowers distant objects, and it also widens them at the very end, which is why the Sun and the Moon look elliptical at rise and set.
What is your evidence? Show me your measurements or references to experiments that support your claim. Because surveyors know since centuries its not as you claim. It's measured uncountable times. Here is the proof that not light is responsible for the apparent curve but the earth itself is curved. The data points you see are recorded by GPS, which is not dependent on refraction and shows the real physical locations of the points in space, independent of what the shape of the earth is. I can click on the points to calculate the curvature radius that the data points describe. It matches the expected radius of the earth for this locations.
The laws of refraction state that light gets bent to the denser medium, which in the atmosphere is commonly at the ground. So light gets bent down except in small layers over warm ground at temperature inversions, which causes mirages. If light gets bent down, objects appear higher, the earth appeas flatter than it is.
I have never observed things at the horizon getting wider. Did you ever measure this on a video of a moon set or sunset with solar filter? Refraction gets stronger near the surface, so the bottom parts of sun and moon get lifted more then the top parts, which makes them appear vertically squeezed. It is modeled in my App here. Left simulation without refraction, right with custom refraction that causes mirages at the horizon. Note that the whole sun is raised from below the horizon by refraction. It is common knowledge that the sun has already set when it appears just above the horitzon, which proves that the simulation is accurate.
Ivo: The formula for the Earth's "curvature" is the formula for the atmospheric refraction! It explains the bending of rays in your Dome model, too!
(5) 
 
where^{'} 

Note: the equation 8 inches per miles squared is an approxomation to this exact equation for the curvature drop.
(6) 
 
with  
where^{'} 

Look this equations the same? No! Similar yes, but the earth's curvature is commonly not the same as the curvature of light due to refraction. And the light ray is bent down in the same direction as the curvature of the earth, in the direction of denser air, not upward. This means objects appear raised on normal refraction and the globe looks flatter than it is.
You can have negative refraction in small layers on temperature inversions. To get negative refraction as demandet to let the flat earth appear like the globe, you need a temperature gradient of at least 15° Celsius per 100 m, all the way up to about 10 km every day. You have to agree that this is physically impossible.
I have simulated a refraction for the flat earth that makes it look like the globe for the lower 300 m which requires a temperature drop of −45°C from the surface to 300 m. Click here for this simulation.
Choose Refraction = Zero below the left image to see how this looks like without refraction on the flat earth. Choose Refraction = Standard and Model = Globe to compare with the globe model under standard refraction.
The evidence is all the evidence of apparent disappearing bottoms of objects in the distance, which globalists love to point out, but forget to observe how looking left or right nothing is curving, whatsoever. So, if objects are disappearing from the bottom in the distance, but nothing is curving left or right of them, then the explanation is obvious  atmospheric refraction, which lowers them to the observer. This is their apparent look to an observer with a naked eye. If an observer has a tool, like a high zoom camera, he may be able to observe more of the object. The atmospheric refraction depends on the conditions of the atmosphere, too, but those are small effects on short distances. For long distances by average you can use this formula to calculate it: x * X / 8000 in miles!
You can't use globalist GPS to prove the globe  that's redundant! So, objects get lower and lower with distance, is this earth's curvature or is it atmospheric refraction? It's all relative on how you want to look at it!
You have a picture of elliptical Sun at sunset  it's wider! Yes, I have pictures of sunsets with a solar filter, and they are all elliptical. Same with the Moon! Think of it as smaller Sun at sunset, but wider. In some pictures, the Sun is even wider than at noon time! The close it gets to the horizon, the wider it gets, and then it disappears. In some cases, there are mirages that stretch it down and make it look like a half sun, but that is an illusion!
Ivo: The evidence is all the evidence of apparent disappearing bottoms of objects in the distance, which globalists love to point out, but forget to observe how looking left or right nothing is curving, whatsoever.
This is not true. First if you are near the surface, you can't see left to right curvature because you are in the center of your horizon. The horizon is the same distance all around you and raises to the same level all around you. So how do you expect to see the curvature if the horizon is only some miles away from you? But if you gain altitude, you start to see the circular horizon around you more and more from above, so there will be a left to right curvature increase with altitude.
Watch FlatEarth: Finding the curvature of the Earth for an explanation with animations and example images that show how much curvature you can expect to see from left to right and under what conditions.
Ivo: So, if objects are disappearing from the bottom in the distance, but nothing is curving left or right of them, then the explanation is obvious  atmospheric refraction, which lowers them to the observer.
The physics of light propagation through a medium with a density gradient as in the atmosphere implies that light gets bend down, which makes distant objects appear raised, not lowered. That's why we can see farther than the geometric horizon of the earth.
Ivo: The atmospheric refraction depends on the conditions of the atmosphere, too, but those are small effects on short distances. For long distances by average you can use this formula to calculate it: x * x / 8000 in miles!
What does this formula calculate exactly? The apparent drop of objects due to refraction? You are telling correctly that refraction depends on the atmospheric conditions. But I don't see any term for pressure, temperature, density, temperature gradient or humidity in your formula. An equations that depends on atmospheric parameters has this parameters in it. Your equation is not even a valid equation (what units has x, what is it equating, where is the left hand side of the equation?)
Ivo: You can't use globalist GPS to prove the globe  that's redundant!
You don't know how GPS works and you seem to assume it is bases on a spherical model. That is not quite right.
GPS consists of more than 24 satellites whose positions and velocities in space are known extrem precisely. A GPS receiver measures its distance from multiple satellites in view and calculates from this distances its position in space. It is irrelevant whether you are on a flat earth, a globe or in outer space. This works the same way for any location.
So the primary measurements of GPS is a position in space as x,y,z coordinates with the origin at the center of the orbits of the satellites (which is the center of the earth, what ever shape it has). If you measure million points distributed over the surface of the earth, you get millions x,y,z coordinates in space. This coordinate system is called ECEF (earth centered earth fixed).
If you plot this x,y,z coordinates in a 3D software the point cloud exhibits the physical shape of the surface of the earth. If the earth is flat, then all points would lie on a clearly recognizable plane in space. If the earth is a globe, then all points would lie on a clearly recognizable sphere.
Guess what: The points in space exhibit a shperical shape. All this points confirm the measurements global surveyors have made in the last few centuries.
Here is an example of a flight around the world showing 18,857 with GPS recorded points in x,y,z coordinates. They lie all in some altitude above a sphere.
Flight around the world, recorded with GPS in x,y,z space coordinates
The reason why most people think GPS is globe based is because they get latitude, longitude and elevation from their devices, not x,y,z coordinates. But this is only to simplify things for us humans. The raw x,y,z coordinates are useless for us on the surface of the planet. So they are converted into spherical coordinates latitide, longitude and elevation. This is a transformation of the coordinate system and does not move the points in space onto a globe or flat earth. The points stay where the are, but their location in space is described in another coordinate system, that is more usefull for us to navigate around. This globe model is called en.wikipedia.org WGS84. The corresponding Geoid, that defines mean sea level for each point on earth depending on the local gravitaional field is called Earth Gravity Model EGM96. Yes, gravity is an important part of GPS to calculate accurate elevations. Without the taking the Geoid into account the elevations would be hundreds of meters wrong.
So using GPS is the easiest way to figure out the real shape of anything in space by measuring many points of the surface of the thing. You can do this for mountains, lakes, rivers, roads, countries or the whole world. We have measured the shape of the earth in this way to cm accuracy in the last few decades and it confirms the measurements of the globe by centuries of geodetic surveyors.
Today all navigation is based on the WGS84 globe model of GPS, using internally the x,y,z space coordinates to calculate paths and distances on the globe. If you would project those points onto a flat earth, all distances would be wrong, because projections move the points and the distance between moved points are commonly not the same anymore. That's why nobody ever can come up with a flat earth map, that gets all distances right.
Ivo: You have a picture of elliptical Sun at sunset  it's wider! Yes, I have pictures of sunsets with a solar filter, and they are all elliptical. Same with the Moon! Think of it as smaller Sun at sunset, but wider. In some pictures, the Sun is even wider than at noon time! The close it gets to the horizon, the wider it gets, and then it disappears.
The image on the right shows that the sun does not get wider but squeezed vertically. It's width is constant. Note that as the sun approaches the horizon, it gets also pushed up. At the end the real sun has already set while it's image is just touching the horizon, somewhat depending on refraction of course. On standard refraction the apparent angular lift at the horizon is about 0.5°, which is about the angular size of the sun.
Hi, can you add to Advanced Earth Curvature Calculator the outline (contour) option of all continents for flat earth (azimutal projection) and globe? It would be nice to see continents on FE from 100 km height.
It is me again. Can you add target image from URL to your Advanced Earth Curvature Calculator like in the refraction simulator?