General Relativity 3: Volumetric Accretion Disks and Live Event!
Today’s blog post is the last in a series of posts describing the new features in our next major update, which we are calling “General Relativity”. In this post we’re talking about volumetric accretion disks.
Please note that everything you see below is still a work in progress – it is very close to what you will see on release, but the final version will likely have some additional tweaks.
Implementation and Quality/Performance Settings
Previous versions of SpaceEngine (starting from 0.980) had flat, two-dimensional accretion disks: this was a “fast and cheap” solution, and worked even on lower-end PCs. Volumetric disks require more powerful hardware, since the shaders have to integrate the emission and opacity of multiple points of a volume along a ray. This volume contains procedurally-generated and animated noise, which are used to create the shape of the hot plasma “clouds” rotating around the central black hole. But things are even more complicated, since we also have to integrate light rays in a warped space-time! This is the only way to correctly render objects (like the accretion disk) near the event horizon.
Fortunately, the solution for the performance issue is trivial: simply render the volume at a lower resolution. Kerr black holes already use this technique, as was mentioned in a previous blog post. SpaceEngine renders black holes in two passes: a low-resolution computation pass, and a full-resolution upscaling pass. The computation pass computes the geodesic (ray-tracing in a warped space-time) while also integrating the brightness and opacity of the accretion disk, and stores the result in two (low-res) textures: a deflection vector, and an integrated disk brightness/opacity. The upscaling pass then samples these textures using upscaling filters to create the final effect. The first texture is used to distort the background image, and the second one is superimposed over the first. In order to achieve the desired results, we made use of multiple filters in the upscaling pass: linear, bicubic and lanczos, with- and without-sharpness passes, and CAS algorithm (AMD FidelityFX Contrast Adaptive Sharpening). These filters will also now be used selectively for galaxies, nebulae, aurora, comet tails and volumetric planetary rings in a similar way; different objects show better results with different upscaling filters.
The low-resolution pass also uses some animated noise to reduce banding artifacts, and the resulting image is then upscaled in the second pass. This adds a somewhat “snowy” effect, which may eventually be reduced in further updates.
Settings for “Gravitational lensing precision” and “Volumetric objects resolution - While moving” will affect performance greatly, especially when close to the event horizon. You may adjust them at your discretion to achieve your preferred balance of quality and speed.
Accretion disks are also fully animated, as shown in the video below, and incorporate astrophysical jets – powerful streams of very hot matter ejecting away from the plane of the disk at almost the speed of light. Old versions of SpaceEngine used sprites to render jets (similar to comet tails), but that was a “quick and dirty” solution. Since those “jets” were rendered separately, they were not warped by the gravitational lensing effect, and looked out of place. Now, with everything rendered by a single shader, the jets are correctly warped and show the correct effects; but this adds the limitation that jets cannot be very long, since they can’t go outside the shader rendering volume (which is a sphere, typically limited by the edge of the accretion disk).
You may notice in the video above that the disk animation changes its speed – or even reverses – as the camera moves around. This is intended: the geodesic integration code takes light travel time into account; if you move the virtual camera at faster-than-light speeds away from the black hole, you will see a “time reversal” effect, with the disk appearing to flow backwards in time. Of course, this is just a simulation effect, since in reality nothing can move faster than light.
The accretion disk is also hotter toward the center, and cooler toward the edge, corresponding to the results of the equations. It also shows a strong Doppler shift effect: the side that moves toward the observer appears hotter and brighter than the one moving away (something which was also visible before on the old 2D disks). The “hot spot” on the accretion disk now generates the lens flare effect, which can be occluded by an opaque object, and also by the disk itself (which is done analytically). New ray-traced jets also demonstrate the Doppler shift depending on perspective:
As of this release, the new volumetric accretion disks and jets have been fully integrated into the engine, along with Kerr black holes and wormholes. This means that SpaceEngine scripts have all parameters needed to create these objects, and the planet editor allows you to change some of them in real-time. Of course, SpaceEngine generates procedural values for all parameters (except wormholes, which are not generated procedurally at all since they’re not natural objects). However, we should note that some values are constant and not randomized, because using randomization may shift the seed of succeeding bodies in the system, so randomization is delayed for version 0.991, though accretion disk and jet parameters depend on black hole mass and accretion rate, which is already generated.
You’ll also find accretion disks generated around neutron stars and (more rarely) white dwarfs.
Reproducing Famous Black Holes in SpaceEngine
We have also been trying to faithfully reproduce the accretion disks around some famous objects, such as the supermassive black holes at the center of M 87 and the Milky Way, and some well-known stellar-mass black holes like SS 433 and Cygnus X-1.
For example, based on known data, the accretion disk around the Milky Way’s black hole (known as Sagittarius A*) is almost transparent and is hot and geometrically thick (i.e. “puffy”), with a very low radiative efficiency – almost none of the energy in the disk, perhaps just one part per million, is emitted as light. This hot, advection-dominated disk produces strong outflows, similar to stellar winds, that fuel a broad jet, which accelerates in the directions perpendicular to the disk, carrying much (perhaps most) of the matter away before it can reach the black hole – maybe as little as 1% of it reaches the event horizon, with the rest being flung out into the galaxy or shot into distant orbit around the black hole to return again in the future. Matter is accreted onto this disk at a very slow rate, less than one millionth of a solar mass per year – not much more than the famous black hole Cygnus X-1, which is smaller by a factor of 50,000! We are living in an inactive galaxy, with a starving central black hole, but it may be that this is why we are alive in the first place…
If you observe this 4 million solar mass black hole long enough in real time, you may see movement in the gas clouds near the event horizon. SpaceEngine calculates the disk rotation period at 3 Rg radii and reports it in the object’s info table: this is about 18 minutes for Sagittarius A*, so it’s actually visible on human scales. This effect can best be observed near the central black holes of globular clusters such as M 4, since these have masses of hundreds to thousands of solar masses, and a disk rotation period of about 10 seconds (The video above shows an example of one such black hole). Smaller stellar-mass black holes, such as SS 433 B, are just 5-50 solar masses, and their accretion disks rotate incredibly fast, making thousands of revolutions per second: you would have to slow down time to be able to see its animation properly.
Actually, all accretion disks rotate at almost the same linear speed (about the speed of light at 3 Rg): the apparent difference is influenced by the size of the black hole. In the galaxy M 87, the central black hole – known as Powehi or M 87* – has a mass of 6.5 billion suns, and an event horizon almost 250 astronomical units wide (3.5 times the orbit of Pluto!); as a result, the accreting gas takes about 20 days to complete one revolution at 3 Rg radii, even moving at almost the speed of light!
It’s also worth noting that in visible light, the Milky Way and M 87 black hole would not look like the images shown by the Event Horizon Telescope (EHT), since those images are produced from radio frequency data. SpaceEngine renders everything in the visible part of the light spectrum, so what you see of these objects in the program is likely to be a pretty good approximation of what the objects would really “look like” if you could see them with your eyes. In radio waves, even very dense accretion disks look transparent, and the sensitivity of the EHT allows it to capture only the innermost, hottest and brightest parts of the disk – it doesn’t look like a disk, more like a “shell” around the black hole, due to the way the image is created. They are also affected by motion blur since, as we said above, gas rotates around Sagittarius A* in just 18 minutes, which is comparable to the EHT’s exposure time.
Finally, it is worth noting that intermediate-mass black holes (hundreds to thousands of solar masses, between stellar-mass and supermassive), like the one shown below, are suspected to exist in the center of at least some globular star clusters, and SpaceEngine currently generates them at the center of every globular cluster, but the existence of such objects has not been definitively confirmed by astronomers.
Looking Toward the Future
The next steps for black holes and accretion disks will be improvements to visual quality and performance, and further integration with the engine. Stellar-mass black holes in a binary system must have matter flowing from its companion star onto the accretion disk, and the shape of accretion disks could be much more complex, especially if taking into account magnetic fields. Supermassive black holes should illuminate planets in neighboring star systems (and quasars could do this for their entire host galaxy!) and larger, more active objects should have jets capable of extending beyond the edge of the galaxy.
There’s always more to do, and we’re always thinking of improvements we can make, but this is a major step forward in terms of how gravitational effects are modeled within the engine, and we’re very happy with the work so far. We hope you will be, too!
We will be announcing the public beta for the GR update in the near future, so stay tuned for more!
Join Us for a Live Event!
To celebrate this milestone, answer more of your questions, and give you a real-time tour of the GR update – including the accretion disks! – we will be hosting a live event on Friday, September 2 at 17:00 UTC (1:00 PM Eastern Daylight Time for those in North America). This event will include a livestream of SpaceEngine on our official YouTube channel – mirrored on Discord for those who can’t access YouTube – as well as a live Q&A (question and answer) session with members of the dev team on the official SpaceEngine Discord server! We’re really excited to show off our work for you and answer your questions, so we hope you’ll join us!