Tuesday, March 13, 2012

Star Coloring


In my mad rushes to complete large portions of the game for various school projects over the last year, the galaxy generator has kind of fallen by the wayside. Because it's such an important part of the game's concept, I'm going to be giving it a little more love in the days to come. Starting with stars.

I hadn't really given much thought to how to color stars initially, and they're all just generated as white regardless of their temperature. Using the table on wikipedia (http://en.wikipedia.org/wiki/Stellar_classification) I created a gradient of colors which I can lerp between to find the color of each star based on its temperature. The range is from 3700K to 33000K. Anything above or below those limits just gets the end color.

The actual coloring for the rendering will be done in the star shader, which has yet to be started but should prove to be interesting to write.

Once I've got coloring done I plan to start work on generating the starfield skybox textures based on the player's actual position in the galaxy. The size and colors of the stars in the starfield will be representative of the color of the actual stars, as well as their distance from the current system.

No comments:

Post a Comment