# Gaia Sky 2.2.0

Planetary surfaces, keyframed camera, new scripting and more

Today we are releasing a brand new version (2.2.0) of Gaia Sky with several major changes and new features. To sum up, github reports 1071 changed files, with 81672 additions and 31763 deletions. Gitlab displays a “Too many changes to show” banner, as their cap is at a 1000 files. This makes it by far the largest release ever, followed by version 1.5.0 in the summer of 2017.

So, what are all these changes? What are the new features? This post attempts to answer this questions in somewhat detail.

If you are impatient, go ahead and download Gaia Sky 2.2.0. The program should recognize your data is outdated (if you come from 2.1.7) and offer an update. Otherwise, you can just go ahead and remove the data folder altogether and redownload everything again.

## Planetary surfaces

We have been working to enable the representation of height using elevation maps and tessellation and/or parallax mapping. Long story short, both options are now available in Gaia Sky, which bundles elevation maps for the Earth, Moon, Mars and Mercury. Additionally, we have included the possibility to procedurally generate the elevation maps. Right now it is only used for Callisto, the moon of Jupiter.

This has been a long and arduous path, entailing the introduction of a new pipeline of tessellation shaders, as well as a rewrite of the existing shaders to represent elevation via parallax mapping.

In all cases, a map is also generated in CPU memory, so that the elevation data is also available to the camera to avoid clips into the planets and moons.

Check out the videos here and here for tessellation, and here for parallax mapping.

## Logarithmic depth buffer and Milky Way model

We have implemented a logarithmic depth buffer to eliminate the depth buffer problems at especially large scales. Usually, the depth buffer is implemented with this non-linear function

$$d = {{{1 \over z} - {1 \over z_n}} \over {{1 \over z_f} - {1 \over z_n}}},$$

where $$z_n$$ is the near clipping value of the visible frustum, and $$z_f$$ is the far value. $$z$$ is the fragment distance from the camera and $$d$$ is the depth value that we’ll put in the z-buffer. Instead, we changed it to this:

$$d = {log(K * z + 1) \over log(K * z_f + 1)}$$

where $$K$$ is a constant that controls the resolution close to the viewer.

This allows us to better utilize the depth buffer at galactic and extracgalactic scales. In particular, paired with a few dither shaders, it enabled us to update the old, image-based Milky Way model to a new particle-based one sporting different components for gas, dust, HII regions and stars:

Also, using the new z-buffer we could rework the mesh rendering to better represent the galactic dust. Here is a video:

## Game mode

A new game mode has been implemented. This mode uses the default WASD + Mouse control scheme of most games to control the camera. Additionally, when the camera is in Game mode and close to a planet or moon, gravity will kick in and suck the player towards the surface. Use SPACE to move up (and fly), and C to move down. Use SHIFT to ‘run’.

## Reflections

We have implemented skydome reflections into the shaders to be able to represent the metallic materials of Gaia with more fidelity. The skydome cubemap has been generated using the 360 mode of Gaia Sky. See this tweet for a video, or the image below to a debug showcase.

## Orbits

The orbits have been revamped. In addition to a new fading orbit trail rendering mode, we have a background updater which recomputes the orbits when they get outdated. This ensures the planetary orbits based on a sampled VSOP87 stay up to date at all times.

## Tone mapping

This feature could still be considered experimental. We have implemented a few post-processing tone mapping algorithms to attempt a high dynamic range output. The most interesting of them all is the automatic tone mapping, which computes the average and maximum luminosity values of the previous frame and uses them to automatically adjust the exposure. True HDR required to move the back buffer to a float buffer (with 16 bits per channel) instead of the regular 8-bit buffer.

The tone mapping options available are:

• None – no tone mapping will be applied
• Manual – user-set exposure value
• Filmic
• Uncharted
• ACES
• Automatic

## Velocity vectors

Proper motion representation has gotten a bit of an overhaul. Here are the changes.

• Velocity vectors are now part of the component types
• Velocity vector coloring can no be choosen
• Direction – encodes different directions in different colors
• Speed – color map using the speed as input
• Has radial velocity – stars with RV are in red, the rest are in blue
• Redshift from Sun – red-blue colormap representing the redshift from the sun (RV)
• Redshift from camera – red-blue colormap representing the redshift from the camera (RV)
• Single color – use a plain blue for all stars

## Scripting

We have moved away from Jython and to Py4J for scripting. Please see this dedicated post on the topic for more information.

• Improved debug interface with information on Video memory (only ATI and NVIDIA).
• Comprehensive warnings in object search.
• Startup object can be configured in the properties file.
• Decouple keyboard bindings from actions. Definition is now in keyboard.mappings file.
• Checksums from MD5 to SHA256.
• Info panel on mode switches.
• New Ultra graphics quality mode with +8K textures. Download the hi-resolution texture pack to enjoy it. Beefy graphics card recommended.
• Added starburst texture to lens flare.
• Improved skins and theming by setting the input fields, select boxes and check boxes to the theme color.
• Moved all shaders and pipeline to OpenGL 4.x.
• Integer mesh indices for larger meshes.
• Sane crash reporting. If Gaia Sky crashes, you can find the crash log in \$GS_DATA/crashreports, which is usually at ~/.local/share/gaiasky/crashreports in Linux, and [HOME]\.gaiasky\crashreports in Windows/macOS.
• Migration to Java 11. Please make sure you are using Java 11+ to run Gaia Sky. Windows and macOS versions already bundle their own JVM.
• We have moved on to LWJGL3 as the backend, fixing the issues present mostly in macOS due to pixel scaling.
• Scripting API parameter checks.
• Many bug fixes and some code refactorings.