Awesome looking planets | EVE Online

Awesome looking planets

2010-01-19 - Publié par CCP Mannapi

"We need awesome looking planets" - Torfi Frans.

The scrum team responsible for the updated planet graphics in Dominion was Team Oli Dan. Here we will explain how the planets came into existence; but the team also redid the star field background, created sovereignty structures, fighter bombers, and factional ships.

We have several types of planets in EVE: Gas giants, Temperate (Earthlike), Barren, Ocean, Storm, Ice and Lava. In addition we have moons, which from a programmer's perspective are also planets. A new type was added in Dominion, the mysterious Plasma planets.

In order to make an omelet you have to break some eggs

Height maps

Almost all the shaders use a height map at its base and this texture determines much of the surface features. It is generated by blending two textures together to get variations. The textures are grayscale and square, but they are combined with different scale and position. Our artists created different types of height maps for the different worlds we were creating. For instance, the Ice planet textures are very cracked and craggy, while the Temperate planet textures are based on height maps of Earth.

Preprocessing

The aforementioned texture combination is static during the rendering of the planet, and it is wasteful to do the same calculation for every pixel rendered, every frame. We decided to optimize the process by generating a new texture from the height maps as a preprocess. We use the GPU to render this texture using a novel Render Job system in Trinity, our graphics engine. The texture generated has four channels, 2 for the normal components and the other two contain the transformed height maps.

The size of the pre-generated texture depends on the distance from the player, and changes if the player decides to zoom in. Another thing we did was estimate the distances to planets before warping to have the correct sized textures generated when the players fly past them at break neck speeds.

Poles

Mapping a sphere with a rectangular texture is always a problem. Our solution was to have two texture coordinates, a planar projection for the poles and spherical projection for the belly. We then interpolate between them, making sure there are no discontinuities.

Detail of a Temperate planet.

Clouds

We soon realized that the clouds are the most noticeable feature of a planet and they needed to look very good. These textures are the biggest textures used by the planets, 2048x2048 pixels when your client is set to ‘High' texture quality.

The shader starts by adding a shadow underneath the clouds to give them some depth. We have the direction to the sun in texture space so we simply make a new lookup into the cloud texture but shift it by a certain amount. We then perform a regular texture lookup into the cloud texture and add it on top.

The cloud maps each have a corresponding pole texture mapped using the pole coordinates. Where these overlap with the belly texture we combine them using a max() function.

Varying the ocean coverage on a planet

Light Scattering

Physical accuracy was important for us to make a believable atmosphere. Scattering controls the color of the atmosphere as well as making the light terminator creep further into the dark side of the planet, since the light is bouncing inside the atmosphere. We started by calculating the atmospheric scattering in real time, but ended on a pre-baked solution. Scattering is view dependant so we created a lookup texture where the view dependant factor is on one axis and the light direction dependant factor was on the other.

The atmosphere on the horizon was treated differently. There we have separate geometry and calculate the bulk of the scattering equations in the vertex shader, but feed the result to the pixel shader and complete the calculations there. This gives us the nice effect that light behind the planet will still scatter towards the camera.

Let there be city lights

Some of the Temperate planets are inhabited and their cities can be seen from space. We use one texture covered in UV texture coordinate patches, spherical mapped, to provide surrogate texture coordinates. The texture coordinates fetched are used to look up into a texture atlas. We then mask the fringes of these patches with a separate grayscale texture. The UV patch textures were baked in Maya.

The UV lookup map and the corresponding mask

The UV texture can be quite small, but the mask needs to be of a higher resolution. The atlas texture has corresponding patches.

Atlas texture

This gives us the option of getting much higher texel density on the surface and since we can rotate the patches and mirror them we get a lot of variations from a single atlas texture.

Early ring test

Rings

The ring geometry is a plane. We generate texture coordinates for the ring and map it with a sort of cross section texture. The shadow of the planet is calculated for the rings.

The gas giant rings posed a bit of a problem. Both the planet and the rings are transparent, and the rings circle the planet, which causes a draw order issue. If we draw the planet first and the rings after, the horizon of the planet will look wrong. If we render the rings first then they can't go in front of the planet. The solution was to render the rings in two parts and clip the pixels in the pixel shader. The two parts were then given different sorting values to make sure the planet would be rendered in between.

A moon in Jessica

Shader Model 2

For the Shader Model 2 shaders (SM2) we needed to cut considerable corners. We created the Shader Model 3 shaders (SM3) very modular, so that every step, such as ocean, or vegetation, is a method. For the SM2 shaders we rely even more on the preprocessing step. Instead of making the height map/normal map combo, we render a color texture, with a specular factor. SM2 is limited to 64-pixel shader instructions so we split the preprocessing into multiple passes using the same exact modules as in the Shader Model 3 shaders.

In the end

The last whole month was spent optimizing (LODs, texture sizes) and ironing out the last kinks. Planets were quite a big risk factor for the release but in the end fallout from the release on TQ was minimal.

Thank you and fly safe!

  • CCP Mannapi