We all know the earth is not flat (well, apart from members of the Flat Earth Society).

Popular belief says that in the middle ages, sailors didn’t want to sail too far from their home port in case they fell off the edge of the world (though a quick bit of research on Wikipedia would suggest that this is a bit of a myth).

The earth is a complex shape, mathematically defined as a geoid (TL;TD – Wikipedia) or, more simply, it can be represented as an **Oblate Spheroid** (“oblate” because it is slightly oblong in appearance, “spheroid” because it is almost a sphere, but not quite) or rotated ellipsoid. VentusAR allows you to see far enough that we need to correct for curvature and ensure that the terrain shown in our 3D visualisations is not considered to be flat either.

There are a couple of good reasons for doing this: It makes our visualisations accurate when using a large viewing distance and it is required to be compliant with SNH standards for visualising windfarms. You’ll hear us talking alot about SNH standards for visualising windfarms over the next few weeks and months. We are in the process of making VentusAR capable of producing photomontages, wirelines and panoramas that are compliant with SNH Standards. So this is the first of several changes we’ve made to VentusAR to make the process of producing photomontages quicker (and therefore cheaper). Stay tuned to future blogs to hear what else we are doing.

Not correcting for earth curvature can make a huge difference to what can and cannot be seen. Over a viewing distance of 30km, a 60m turbine could drop completely out of sight. Consider the scene below: not correcting for earth curvature would suggest the tips of the turbine would be visible over the terrain. However because of earth curvature, the turbine tips would actually be hidden below the terrain.

SNH have produced guidance on how to include Earth Curvature and Atmospheric Refraction in your visualisations. Their requirements are published in their updated Visualising Windfarms guidance (v 2.1) – See Annex D on page 50. There are two corrections we need to make to calculate how much of a windfarm would be hidden behind the terrain: Earth Curvature and Atmospheric refraction.

# Curvature

Curvature is the most significant component that has an effect on how much of a windfarm is hidden behind the terrain. It is then a case of using Pythagoras theorem to calculate the height drop on the object. The equation used to calculate the vertical correction (the number of metres we should drop an object) due to earth curvature is shown below. [Note: there is an approximation in this formula, however unless you can see a distance approaching the radius of the earth – 6367km – it has a negligible effect on the maths].

Where:

**h**is the vertical correction in meters**c**is the distance from viewer to object in meters**r**is the radius of the earth in meters (6,367,000)

# Refraction

In reality, rays of light in sightlines are also curved downwards due to refraction of light through the earth atmosphere. This has the effect of allowing you to see approximately 15% beyond the expected horizon calculated using curvature alone. The standard formula used in surveying work takes into account refraction by adding a refraction coefficient (k) to the equation. For absolute accuracy, this coefficient should be measured at both ends of the line of sight – however this is not required for visualisation and visibility analysis so a reasonable average value of 0.075 has been used.

This makes our equation for working out vertical correction:

Where:

**h**is the vertical correction in meters**c**is the distance from viewer to object in meters**r**is the radius of the earth in meters (6,367,000).**k**is the refraction co-efficient (0.075)

# Results

To give an idea of the effect of earth curvature and refraction on the visualisation produced, I’ve included a copy of the calculations as printed in the SNH guidance. To put this in context – if you were on a beach looking towards a wind turbine, over a distance of 30km a 60m wind turbine would not be visible because it is below the horizon.

Distance (c) |
Vertical Correction (h) |

5km |
1.7m |

10km |
6.7m |

15km |
15.0m |

20km |
26.7m |

25km |
41.7m |

30km |
60.1m |

# Implementation in MonoGame

It is well known that here at VentusAR, we use MonoGame to produce our visualisation screens. We have done two things to allow us to add Earth Curvature & Atmospheric Refraction to the VentusAR My View and Gallery: changed to using shaders and implemented shaders to include the vertical drop required.

## What are Shaders

(This might get a bit technical – sorry)

3D Computer Graphics are based on a **rendering pipeline**. To convert a 3D representation of the world in computer memory, a series of steps are applied to the 3D data to produce something that can be displayed on the tablet screen. This rendering pipeline needs to be completed really quickly to ensure that the animation on the screen looks smooth – 60 times a second. Advances in computer graphic have given rise to powerful graphics cards to handle this processing. MonoGame allows developers to customize the processing that happens at different stages of this pipeline using **shaders**. As the shader functionality is very flexible, there are lots of possibilities of what developers can do with a shader: apply lighting to a 3D scene, change the texture on an object, change the position of an object.

Summary: A shader is an operation that happens during the graphics rendering pipeline and can change the 3D model.

## Earth Curvature Shader

We have written an Earth Curvature Shader that calculates the vertical drop (described above) based on the distance from the observer (mobile tablet) to the point in the 3D scene. As we chose to implement this as a shader, doing these calculations are quick: the visualisation screens can update 60 times a second to provide high quality animation and smooth motion. If it would help anyone, the implementation of the shader we are using can be found at VentusAR_TerrainShaderDiffuse.fx (please note: this is a .txt file, you will need to rename the shader file to be .fx)

# Usage in VentusAR

We could never think of a time that users of VentusAR would not want to include Earth Curvature & Atmospheric refraction in their visualisations. So we have included it in the model every time the My View or Gallery is used (we don’t use it in the Fly Through, but as that evolves we may start to include it there). All visualisations produced with VentusAR 2.2 or later will include Earth Curvature and so be compliant with SNH guidelines.