This project uses density wave theory to create a galaxy here is where I learned about density wave theory: https://beltoforion.de/en/spiral_galaxy_renderer/ (their galaxies look way cooler)