The birth of a star is a wild and magnificent thing.

It's also momentous, taking place over millions of years, in dense, cold clouds of molecular gas and dust, where clusters of stars form together. It's not a process we're likely ever going to be able to observe from start to finish - but an absolutely spectacular simulation brings us closer than we've ever been.

It's called STARFORGE (Star Formation in Gaseous Environments), and using it, astronomers have been able to simulate for the first time an entire molecular cloud of forming stars, a region known as a stellar nursery, all in glorious three-dimensional high resolution.

This will be able to help astronomers study star formation in greater detail, comparing it to real protostars (stars that aren't fully grown up yet) at different formation stages, to help figure processes at play.

"How stars form is very much a central question in astrophysics," said astrophysicist Claude-André Faucher-Giguère of Northwestern University.

"It's been a very challenging question to explore because of the range of physical processes involved. This new simulation will help us directly address fundamental questions we could not definitively answer before."

We think we have a handle on the broad strokes of star formation. First, you start with a clump of molecular gas, usually found in a cloud of the stuff. With enough density, the clump collapses under its own gravity to form a protostar, which starts to spin.

This spin causes the material in the cloud around it to form a disk, which spools into the growing star like water down a drain, inexorably drawn in by its strengthening gravitational pull.

When the star gains enough mass, there will be enough heat and pressure in the core to ignite nuclear fusion, wherein hydrogen atoms fuse to form helium. The leftover material in the disk forms planets and asteroids and all that other junk.

However, this all takes place in a dense cloud, which means it's hard for us to take a squiz at it. And because it takes place over millions of years, any single protostar we observe is just one single snapshot of a much longer, larger, and very complicated event.

To build STARFORGE, a team of astronomers led by Michael Grudić from Northwestern University had to take multiple physical phenomena into account, including temperatures, gravity, magnetic fields, gas dynamics, and the powerful stellar winds and plasma jets that emit from baby stars, known as stellar feedback.

They ran their simulations on one of the world's most powerful supercomputers, the University of Texas's Frontera, for nearly 100 days. The result seen in one video is a thing of beauty - an entire stellar nursery, and the formation of the stars within from start to finish.

"People have been simulating star formation for a couple decades now, but STARFORGE is a quantum leap in technology," Grudić said.

"Other models have only been able to simulate a tiny patch of the cloud where stars form - not the entire cloud in high resolution. Without seeing the big picture, we miss a lot of factors that might influence the star's outcome."

The simulated cloud in the video, a huge object 20,000 times more massive than the Sun, starts out just hanging out in space. Over time, the gas is pushed around by forces such as interstellar winds and shock waves, which create regions of higher density that can gravitationally collapse into protostars. A second video simulates a 200,000-solar mass cloud.

As a star forms and grows, it starts to produce a powerful stellar wind. In addition, material falling into the star starts to interact with the star's magnetic fields; some of it is siphoned away, flowing along magnetic field lines to the poles, where it is blasted into space in the form of powerful plasma jets.

Both these forms of feedback push away at the surrounding gas, which cuts off the flow of material, preventing the star from growing any further.

Recent research, based on observational data, suggested that stellar feedback may not play as large a role in determining the mass of a star as we thought.

But the team's research showed the opposite. When they ran the simulation without jets, they ended up with much, much bigger stars. With the jets included, the stars ended up being more normal sizes.

"Jets disrupt the inflow of gas toward the star," Grudić explained.

"They essentially blow away gas that would have ended up in the star and increased its mass. People have suspected this might be happening, but, by simulating the entire system, we have a robust understanding of how it works."

This also beautifully demonstrates STARFORGE's potential. By starting with a scenario as close to the real Universe as possible, astronomers can explore the many different physical processes at work in stellar nurseries.

Turning these processes on and off can help determine which ones play an important role, and could help answer crucial questions about the Universe.

The research has been published in the Monthly Notices of the Royal Astronomical Society.