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) 
 
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.