I'm making a planet/space simulator and I am wondering what would be the best way to render a realistic star background. My requirements are:
- Is based on the procedurally-generated stars surrounding the system the player is in.
- Can be dynamically updated periodically as player moves a significant distance to show motion parallax.
- Is HDR (high-dynamic range). I want the stars to have realistic brightness compared to the sun, which is also calibrated in realistic units (Watts/m^2). This means they will probably not be visible unless looking away from bright objects (sun, planets, etc.). Eye adaptation should make fainter stars more visible slowly over time.
- Is high-resolution, i.e. should have enough resolution for largest of today's monitors (e.g. 2K vertical), and not show any aliasing at lower resolutions.
- Is efficient in both memory and GPU time.
- I'm not planning on doing any cartoon-y colorful nebula backgrounds like in No Man's Sky. That is not very realistic, real nebulae don't look like that up close. It's just the blackness of space and many stars, each with different brightness and color.
- The number of stars that are visible is around 10,000. I only need objects that would be visible to the naked eye.
The options seem to be:
- float16 RGB Cube map - This would use an uncompressed 16F texture to draw the stars like a normal skybox. The texture can be regenerated occasionally as the player moves. This would be fast but not very memory efficient. It would need to be at least 2048px in size to have sufficient resolution for stars to occupy 1 pixel. That means 192 MB with mip maps - ouch! Considering that most of the texture would be black, it's hard to justify this.
- Sprites/Particles - Here I would treat each star as a tiny quad (4px or so in size) at infinity with a texture map from an atlas containing stars of various types. I can give each star a different color and brightness using a custom vertex attribute. This can also draw galaxies using different parts of the texture atlas. Since the number of stars is only around 10,000 it's not much more expensive than rendering an average-sized mesh. It's probably pretty memory efficient and reasonably fast, and scales well to any resolution. Less memory bandwidth due to smaller textures, and faster to regenerate. However it won't scale well to very large numbers of stars.
- ????
So far I'm leaning towards the sprites method. I could also possibly combine the ideas - use sprites for stars drawn on top of a lower resolution cube map for really far away stuff. Does anyone have any feedback on these ideas or any pointers?
