The following describes a procedure for generating a planet map. Making planetary scale terrain quite quickly come to the limits of a computer system. Number of computations increases quadratically with respect to the decrease in distance between grid points. This is the main reason why planetary scale maps are not available so far. The second reason–the need to implement a global river network and linking it with a relief. Problems arising here are related to the Big Data problems.

### The double cone as an approximation of the sphere

The first desire, which arises here, is to avoid the calculation of trigonometric functions, but when dealing with the sphere geometry it is not possible. There is a way to create spherical texture by creating it firstly on the faces of a regular polyhedron, such as the cube, and then mapping it onto a sphere. It is clear that the polyhedron corners should give distortions. Application of this method to a large planet would cause too much noticeable distortions. I’m using a different kind of this approach.

*Without breaks we map the sphere of a planet surface on the two round cones conjuncted by their bases on the equator plane.* On the next image is the possible sphere and double cone relation (vertical cut); cones height can be different as well as cones base radius, depending on the mapping.

We will do terrain generation process on the two cones and, on the last step, map it on the initial sphere. Of course, the distortions cannot be avoided, but by making the mapping in different ways, it is possible to distribute resulting distortions differently on the sphere. The good news: we completely get rid of the calculating trigonometric functions.

As a working mapping we use the option in which the cones conjunction line coincides with the sphere equator and the distance along meridians preserved. Then the cone length is equal to πR/2, R–the sphere radius. In vertical direction we avoid distortions at all; distortions in horizontal direction grow linearly starting from equator, and near the poles increase of distortions diminish, reaching the maximum π/2≅1.57. Distribution of the horizontal (longitude) distortions are on the figure.

This mapping is well suited to the planets in which the oceans or white spots are near the poles. At the equator or in the middle latitudes distortions are hardly visually observable (the distortion introduced by the selected basic grid may be more noticeable).

### Two-level map generation

Even after simplification by using a conical projection, calculations for the entire planet have high memory consumption. To solve this problem, we resort to the two-level generation. At first we generate base or global grid of heights (global height mesh). The main parameter of the grid is gn, which defines the grid divisions number of one quarters of the equator to be equal to 2^{gn}. The process of generating heights on the main grid identifies the planet mainlands. Also, the sea level can be defined here by the ratio of the number of grid points fall into the land or ocean.

Examples of planets made up to present time have gn=7. That is rather modest value and, in the process of algorithms optimization and hardware improvement, we will be able to significantly increase the gn value for new planets.

Now we describe the process of the base grid constructing. Divide the equator with 4*2^{gn} points to the same segments of the length l, then skip on the zero meridian the length l to the north, and divide the current parallel with 4*(2^{gn}-1) points to the same segments of the length l. Continue the process on to the north pole, reducing with each iteration the number of points on each of the following parallels by 4. The same should be done with the southern hemisphere. Each point of the global grid defines a rhombus on the double cones (the pole points are exceptions, they have no corresponding rhombuses), as result all the double cones is divided into rhombuses. Note that these rhombuses are on the surfaces of the round cones, but not on a plane. On the next figure is a view of the quarter of the top cone with a grid of rhombuses for gn=2 (without any claim to accuracy; but it is useful for understanding the base grid).

The transition to the specified base grid on the twin cones leads to an important result: the points of the base grid (without poles) can be arranged in an array of dimensions (2^{gn}, 4*2^{gn}). To do this, allocate points of the southern cone and the equator in an array maintaining their relative positions, and then put the northern cone points in empty array locations, maintaining their relative positions (I also turn each row around, but that is not necessary). As a consequence, many of the algorithms on the cones implementation look easier than their counterparts on the sphere.

A relief on the base grid are usually consists of a few large landmass areas. Achieving the division of the land into separate areas is important for parallelism, as the river system is constructed for each part of the land independently. On the figure is a model depicting the distribution of heights on the base grid.

The next level is the local grid in each rhombus where we build a relief based on the known height values at the vertices of the rhombus (they belong to the base grid). Thus, the final relief will be some type of multi-fractal.

The main parameter of the local grid is ln, which specifies the number of grid steps in two directions: 2^{ln}+1 and 2*2^{ln}+1 respectively. Example of a rhombus with the local grid when ln=3 is on the next figure.

Currently, examples of the planets use the local grid with ln=8.

*It is possible to implement the algorithm to generate a planet relief in which only the relief data of one rhombus must be in the memory at all time.* Some other data related to the nearby rhombuses also must be present, but it is not as big as compared to all relief data. This allows the generation of a high-resolution planet relief. The further development of the project will allow bigger ln values.

Model the medium-sized island. Rhombuses can be seen here.

### Rivers and Lakes

Two-level generation demanded the specific algorithm for rivers which comprises individual pieces. The river construction takes place after creating base height mesh, but before the final relief generation. See schematic representation of the rivers of a small island on the figure.

Lakes emerge as places of local minimum in the base grid. The objective was to determine some polygon which contains this local minimum point.