Galaxy Generator

Unity 5 Galaxy Generator

This is my take on how to generate a galaxy, or something that looks a little like a galaxy. GalaxyGenerator
There is no real world galaxy theory involved at all, but after trawling the internet i found an example to generate a 2D spiral galaxy implementing the generate a spiral arm technique then add more spirals arms as desired till the effect is to your liking. This technique works fairly well except for an issue where by if too many stars are generated near to the centre of the galaxy you end up with a noticeable line of stars this is even more noticeable the more spiral arms you add. My solution to this was to limit the stars towards the start of the spiral then generate the galaxy nucleus separately.

At some point in the future i will be adding options to change galaxy type and maybe add in some cloudiness to the spirals to make it look more realistic but for now this serves my purpose  because i was only looking to generate star positions for a new project i am starting.

If enough people are interested i will sort out posting a package in the asset store, but if you want the source just drop me an email.

Current Builds

PC Standalone PC build, saves the Galaxy data to an xml file.
WEB Player Old style WEB player version soon to be depreciated but it still  runs on some web browsers, saves Galaxy Data to Playerprefs registry entry
WebGL Player  All new WebGL player, only runs on some browsers, firefox seems to be the best  browser to use at the moment, saves Galaxy Data to Playerprefs registry entry


Comments are closed