📜 ⬆️ ⬇️

Space Engine - Universe in the palm of your hand

My God, it's full of stars!
Arthur C. Clarke

As a child, how many of us never dreamed of “plowing the expanses of the universe,” like Captain Picard, strolling around uncharted planets of distant worlds, seeing dawns of double or triple stars, diving into the atmospheres of gas giants, dropping ships into black holes? And I, too, is no exception. Of course, part of this dream embodied books, movies and "Elite" -nye games. But all the romance in them was destroyed by the banal buy-sell and pi-piu in the “liquid” space at the speeds of the aircraft of the First World War. And those few virtual worlds lacked the freedom, detail and scale of the real universe.

At the beginning of the millennium, I met MojoWorld and was shocked by its capabilities. Finally, it was possible to wander around other planets and photograph local sights. He became the first swallow, which gave hope that the full-scale cosmic worlds are technically possible. But, unfortunately, the performance of a decade-old iron was not enough to transfer all the beauties in real time. Yes, and the planets were just dead landscapes.
')
But now, just over a year ago, I accidentally stumbled upon the Space Engine universe, and it just blew my brain and spread it across the floor with my scale and incredible detail.


How does all this look?


The first thing that catches your eye is the real size of our universe. What are hundreds of billions of galaxies and hundreds of billions of stars in each of them? - just dry numbers in an astronomy textbook. But here, all this is felt in its own skin. And you begin to understand how our humanity, with all its petty problems and mouse wars, is insignificant in comparison with the magnitude and incomprehensibility of the Universe. No, we are not grains of sand, or even dust, we are nothing at all. And no one will even notice if our sun suddenly goes out tomorrow and another civilization will sink into oblivion, without leaving any heritage behind.

In addition, the absolute freedom of movement is surprising. You can fly anywhere with seamless transitions between the surface of the planets, the orbit, the stars and galaxies.


Yes, this is not a “through the universe” screensaver; here every flying star can be visited, wandered around its planets, their satellites and asteroids.

Of course, in the Space Engine, as in any other self-respecting planetarium (for example, the recently mentioned Celestia), there is a display of the orbits of space bodies and detailed information on them, and time management, and various eclipses (including from the planetary rings), and the ability to render in fisheye projection for planetarium projectors. But the most important thing is that it is not limited to the catalogs of HIPPARCOS stars and NGC / IC galaxies (which also exist), but generates in general the entire visible universe with all types of objects that can be found in it. But this is based solely on scientific data and current theories and models, which allows the Space Engine to be used as a complete (and incredibly beautiful) manual on astronomy.

Here you can see with your own eyes the cosmic pac-man. Although in reality, this is a black hole with a gravitational lens against the background of the blue supergiant:


Meet the rise of a double star (there are even eightfold stars):


Visit neighboring and not very galaxies, nebulae, star clusters. Learn what red giants, neutron stars, and more look like. I will not spoil much, just leave a few pictures.











By the way, what do you think the planet will look like, which is always facing one of its sides to the star? Meet the tidal-synchronized (it turns out that way) desert. On the one hand, the night and the permafrost, on the other - the surface burned by a star and a huge super-cyclone that never stops.


As in Celestia, the Space Engine can be downloaded official additions to the textures of the planets of the solar system and some of their satellites in high resolution. For example, the basic configuration "weighs" 500 MB, and the full size of all add-ons is about 10 GB.

What else is missing?


Unfortunately, a lot more. Space is much more diverse and amazing than everything that has already been implemented in the Space Engine, but with each version the author carefully transfers a piece of this into his universe. For example, in the picture with a black hole and a blue giant for complete happiness, there is not enough accretion disk and jets, which are still in the plans. Also, while the plans are comets tails, quasars, individual stones in planetary rings and dozens of other details that will make the universe even more complete, accurate and beautiful. So there is still a lot of work.

What else can you do?


At the moment, the program is a free interactive planetarium with the beginnings of a space simulator (that is, you can fly on the shuttle over the surfaces of the planets and drop ships into black holes now).



In the future, based on the same engine, it is planned to develop an MMO game with a focus on space exploration, searching for artifacts, building and developing colonies and bases on planets, asteroids, or gas giants orbits. No teleportation, "liquid" space and Hollywood "pi-piu". And what to share in such a huge universe?

In order to fly between planets and stars, you have to remember at least the basics of astronomy, the trajectories of celestial bodies, what is the first, second, third cosmic velocity, characteristic velocity, specific impulse and other attributes of real space travel. You will also have to monitor the fuel and reactive mass consumption (yes, these are potentially different things) in order not to stay “suddenly” in open space without the possibility of returning to habitable systems. Planned and ship designer, as in the Kerbal Space Program, with calculations of the basic dynamic characteristics, as well as the strength and stability of the structure. The only “fantastic” assumption is the hyper-drive providing superluminal overflights. Without it, IMO will be impossible.

How is all this possible?


The Space Engine universe is created by almost one person, our compatriot from St. Petersburg, Vladimir Romanyuk ( SpaceEngineer ). He is an astronomer by education and profession, so that you can be sure of the scientific credibility of all simulated objects and processes. The community that has developed around its program helps to keep the catalogs of galaxies, stars and exoplanets up to date, as they are opened almost every day. Also, fans create models of ships, shuttles and other trifles to fill the universe.

The creator does not make secrets from the technical component of his world and shares his findings with the forum users. I will list some of the main points and problems that needed to be solved for the implementation of the engine.

Coordinates

One of the problems was the representation of the coordinates of objects within the universe. Who worked closely with floating-point numbers, knows how quickly they lose accuracy with distance from zero. And the accuracy of a few kiloparsec on the edge of the universe is not at all. Therefore, to store the coordinates, 64-bit fixed-point numbers and a hierarchical representation of objects are used. That is, the coordinates of galaxies are described absolutely, the stars - relative to the center of the galaxy, and the planets - relative to the star. Of course, when rendering everything has to be translated into floating point numbers, but the conversion to coordinates relative to the camera is calculated in integers. And the rendering itself takes place in layers, since no z-buffer accuracy is enough to take into account the size of the universe.

Stars and galaxies

The second problem is the generation of stars and galaxies. There are hundreds of billions of stars in the galaxy, which means that in order to display them all, you will need to generate and render terabytes of data. Of course, this is not suitable for real time. It would seem, well, we will limit the distance to the camera and we will generate and render stars only in a small volume. But then there are two more problems. Firstly, the algorithm must be deterministic, that is, despite the fact that the stars are created randomly, they must always appear in the same place. Otherwise it will be strange if we fly away from the star, and then there will be emptiness in its place. Secondly, the stars have different brightness and are visible at different distances. Dull brown dwarfs quickly disappear from sight, and bright blue giants are visible almost across the galaxy. To solve both problems, an octree tree (octree) is used, the nodes of which store the seed to generate the underlying levels, as well as the extreme brightness of the stars in this cell. In this case, brighter stars are generated at higher levels of the hierarchy, since there are significantly fewer of them than less bright ones. Thus, the generation of stars becomes absolutely deterministic and depends only on the root of the tree and the distribution of stars in the galaxy. It also allows you to quickly generate stars with the specified maximum visible brightness (which depends on the distance and absolute brightness) at any distance from the camera.

The technology of rendering galaxies and nebulae is similar to rendering volumetric clouds. That is, this is a set of sprites, which, to speed up, will be prerendered to imposters or sky boxes, depending on whether we are inside or outside.

Planets

The principle of modeling is similar to MojoWorld. His ideas were picked up by many projects with procedural planets, such as Outerra and Infinity. How it works? We take an ordinary cube, divide each of its faces into several segments, and then spherizuem, that is, as if we inflate from the inside. It turns out a ball with a cube topology. This allows the use of square textures with maximum efficiency and minimal distortion.



But evenly divide the cube into segments is not enough. Since the planet is large and it will not be possible to generate it with maximum detail for flights over the surface (again, terabytes of data will be required). LODs come to the rescue. They are implemented as follows. Each face of the cube is a quad tree root. Each tree node is a square with a fixed grid and texture resolution. If necessary (when approaching the camera), the node is divided into four, thereby increasing the detail in half. And so on until the required detail is achieved at this point.



The height map and texture for each node of the tree are created entirely on the GPU using pixel shaders of the 3rd version (therefore, it will not work to run SE on video cards that do not support them). Generation algorithms are remarkably described in the book from the creators of MojoWorld - “ Texturing and Modeling: A Procedural Approach ”. That is, they are familiar to most of the noise of Perlin and Vorleya, as well as their variations and various methods of fractalization. A separate algorithm creates large cyclones for tidal-synchronized planets.

But, purely procedural landscapes usually look too artificial. The fact is that on the planets with the atmosphere, they are subject to significant erosion, which significantly changes the outlines of mountains and valleys. Unfortunately, the classical iterative erosion algorithms are quite difficult to scale between LODs, and at the moment they are not yet implemented. But there is a simpler (positional) way to imitate this phenomenon. These are special types of noise, described in detail in the article . In short, to generate the landscape, not only Perlin noise is used, but also its derivative, which allows you to construct a gradient at each point of the landscape and simulate leaching or, on the contrary, ground inflows by shifting the base noise coordinates along this gradient. This approach already allows you to create pretty cute planets.



To simulate the atmosphere, the method used is Eric Bruneton , which was adapted for other planets with different pressures and composition.

Instead of conclusion


Already, the Space Engine is sticking the majority of planetariums and realistic space simulators (Celestia, Stellarium, Orbiter) into the belt according to the richness and beauty of space. And this is just the beginning. If at least half of what is planned will be implemented, the Space Engine will become the most complete model of our universe, aggregating all the modern knowledge of humankind from the field of astronomy. And, despite the fact that the author plans to keep the code closed, everyone can make his own contribution to the creation of the largest virtual world in existence.

PS: all thanks to the author of the program SpaceEngineer . I think he will be able to answer some questions on the engine, if any.

Links

Source: https://habr.com/ru/post/150541/


All Articles