The Earthview project aims to render orbital visuals for the OpenSource flight simulator Flightgear as the default terrain mesh is intended to provide low altitude visuals and is poorly suited to Earth orbit. Earthview however shares the Atmosphere simulation with the Atmospheric Light Scattering rendering framework which does a real-time simulation of the most important light scattering processes in air.

The basic task is simply enough - bring a sphere into the scene and texture it using hires Earth surface imagery. NASA provides a large database of visual and other data on the planet, and all textures are derived from public domain material on the NASA Visible Earth page.

The blue marble from far away.

Things get more complicated when one starts looking into the details of the appearance to make the simulation really close to pictures taken from the Shuttle or the International Space Station while at the same texture loading times and memory occupancy should remain reasonable.

Earth from Space

NASA provides 24k textures for eight regions of the planet which, for easy usage by graphics cards, need to reduced to 16k textures. These show terrain in stunning detail - dependent on latitude, a pixel represents an area of around 500 m x 500 m. Even from an unstable low orbit of 100 km this looks impressive, from ISS orbit of about 300 km it looks clearly stunning.

Madagascar seen from the North.

However, when zooming into a region, the view gets inevitably pixelized. Using GLSL shader techniques it is possible to give the illusion of an even higher texture quality. Mixing in an overlay texture and using a noise function to blend color values of adjacent pixels, small details and irregularities can be generated which distract from the pixel nature of the raw image. This way, the smallest details are generated at areas of just 12 m x 12 m - which even when zooming into part of the visible scene keeps the illusion of looking at real visuals for a long time.

Details of Madagascar's coastline.

The terrain in low light

At noon, the sun is high in the sky and even very rugged terrain doesn't cast shades. This is different at low light, and one technique to render how the light sculpts the relief during morning and evening is the usage of a normal map (this doesn't fully describe the lengthening of shadows in very low light which could be achieved by a heightmap, but it is computationally much lighter).

Supplying a normal map based on NASA terrain elevation data nicely sculpts out the ranges of Nevada at sunrise.

Nevada in low light.

Of course things are never quite as simple - what makes things complicated is the fact that Earth has an atmosphere. This allows light to leak into the formally shaded region - but only where it is not shadowed by the bulk of Earth itself. In normal rendering, ambient light is used to simulate the effect of an atmosphere, but for the whole of Earth there is of course no ambient light (barring star and moonlight) in space. So the equations of diffuse light interaction with surface normals have to be modified to take into account both the scattering of light into the darkness and the average shade cast by Earth, otherwise the visuals start to look unrealistic.

The Himalaya range and the Indian subcontinent.


A large part of what we see of Earth from space is actually clouds and large-scale weather systems. NASA supplies 8k cloud textures which can be used to texture a second sphere above the terrain. While the resulting resolution of 2 km x 2 km per pixel is not not as good as for the terrain, for clouds some degree of diffuseness can usually be tolerated more easily.

However, clouds can be augmented with procedural GLSL techniques the same way as terrain. Using a hires structure texture and noise modulated with the original texture, apparent details at the level of 100 m x 100 m can be generated which is enough to represent even single small Cumulus clouds.

Another important aspect is that clouds have their own relief structure - often more so than mountain ranges actually, towering Cumulonimbus clouds in the tropics regularly reach 12 km vertical size. While NASA does not supply a relief texture for clouds, such information can in fact be derived runtime by sampling the alpha gradient of the texture along the light direction and constructing a cloud normal from this. Using this technique brings out the subtle relief of clouds illuminated by low light.

Details of clouds, with the relief brought out nicely by low light.

Another very characteristic property of clouds is that they cast shadows onto the terrain underneath - which are, especially on bright desert sand, very prominently visible and give a sense of depth to the scene. By referencing the cloud texture with a sun-angle dependent offset in the terrain shader, such shadows can be rendered with good quality.

Clouds casting their shadows over Siberia.

Environment conditions and weather

Clouds rendered as described above are static, there is no real weather happening. For admiring Earth from orbit this is quite sufficient, but for a simulation of spaceflight, this poses some problems: For instance, a landing site that is shown in poor weather once will always be in poor weather, no matter how long the simulation is run. Thus, for use in a spaceflight simulation, it's desirable to have at least some degree of environent response.

One relatively simple idea is to rotate the cloudsphere relative to Earth. While this breaks the cloud shadows on the terrain and doesn't satisfy meteorologists (as the original NASA textures show clouds as they're generated in the specific interaction of winds with the terrain) that delivers plausible visuals of a weather change.

Central Europe in fine weather.

Central Europe with a front moving in.

Another parameter that can be influenced is the amount and composition of haze rendered on the planet. From orbit, a straight view ray down goes through the equivalent of about 10 km of air at sea level density. From the slant angle of the view to the Earth sphere, the amount of air travsersed is thus fairly easily to compute, and this can be used to render fog for a given mean visibility on the surface.

Night over France.

Of somewhat lesser importance is the relative degree of dry vs. wet haze. This regulates the colors generated by Rayleigh scattering in the dusk and dawn zones when the sunlight has to travserse long paths through the atmosphere. More dry haze leads to a pronounced red-shift of the illumination, whereas wet haze makes the twilight zone more grey. A combined variation of cloudsphere rotation angle, haze density and composition can already give a big variation to the visuals observed from orbit.

Night over France - different haze distribution.


The most pronounced feature of Earth visible after nightfall is man-made - countless lights in the cities and along major roads create a glittering display tracing the densely populated areas.

Night lights of cities and roads.

NASA supplies night light textures, and these can be used in combination with procedural noise to generate the appearance of a very fine-grained and gritty distribution of light sources which gradually come on as the dusk approaches and passes over a location.

Night lights of cities and roads.

Combined with the relief shading for clouds and the Rayleigh coloring of the terminator, scenes of stunning beauty can be found when the terminator line passes over cloud formations.

A dramatic sunset.

The future

While Earthview in the current version 2.0 (merged into the 2017.1.0 development version of Flightgear) is a mature framework, there are still ways left in which it could be augmented. One idea discussed is to encode the seasonal variation of sea ice in free texture channel and draw it, another shot worth a try is to modulate the amount of haze in the scene by a local haze probability. A yet more advanced technique would be to not use a static cloud texture but instead use runtime texture compositing to move different weather systems on the texture sheet. Clearly of making the environment and weather even more dynamic has an enormous appeal.

Looking towards new challenges.

More information

Back to main index     Back to rendering

Created by Thorsten Renk 2016 - see the disclaimer and contact information.