Night sky star rendering

Started by
3 comments, last by l0calh05t 5 years ago

I'm trying to figure out a good way to draw a realistic night sky consisting of stars with wildy varying magnitudes. There is the classic and easy solution of baking everything into a skybox, but not only does this require an exorbitantly high resolution to look nice and sharp, it also limits the potential dynamicity of the night sky. Using points to do the job then seems desirable, but how the points should be rendered exactly still leaves me uncertain. Taking inspiration from existing star-rendering implementations, there are a few different techniques with their own ups and downs. Crucially, aliasing shouldn't plague the image quality, as naïve single-pixel points will look strange indeed when the camera shifts its orientation ever so slightly. Another aspect to consider is the implementation of glares from bright stars. Ideally, this should be done in a post-process bloom pass, but this may not be sufficient for tiny points in the sky that may take up just one pixel of the screen. Glares could instead be drawn as a part of the star-rendering process, but this requires some extra consideration if it should work in tandem with tone mapping and exposure control. Finally, there's the question of how large the stars can appear to be. In the real world, stars are far too tiny for the eye to perceive the actual shape of, let alone a pixel at conventional resolutions, so a realistic star should never occupy more than a quad on the screen, excluding the glare. However, if the desire for a fictional night sky arises, there may a need to include an extra parameter of apparent size into the equation. Some examples of implementations inflate the apparent sizes of all stars, even if they are very faint, which I think looks unappealing and unrealistic.

 

Advertisement

Just out of curiosity: could you build a set of plane pairs to achieve this? One plane would hold the color information, the other some alpha mapping (for size and intensity), and then you could apply some post process to one or both planes. Maybe it is possible even with just one sphere-pair, perhaps.

 

(also, maybe this more interesting information http://www.eastshade.com/creating-a-dynamic-sky-in-unity/

Don't know if your engine supports that. But my first idea would be to use a skydome instead of a set of planes. Then use actual particle effects for the fancy stars.

That way, you can design them individually. And it also should make your parallax issue much less noticeable. You could even throw meshes into your sky if you like.

Just make sure, that

- the texture is visible from the inside of your sky sphere.

- your camera is setup in such a way that it'll use a second camera's output that'll only renders the sky as a background.

If you haven't seen it yet, this paper may be of interest to you: https://graphics.stanford.edu/~henrik/papers/nightsky/nightsky.pdf

To reduce the aliasing problem, you probably want to round up the size of your stars to render quads/circles 1 pixel in size (to avoid "missing" them during rasterization), but you should then scale the intensity accordingly (so a star that should only cover 10% of a pixel's area should be reduced to 10% intensity). Combined with MSAA/SSAA aliasing shouldn't be too bad, I think.

Post-process blur should work just fine, though you could try experimenting with pre-convolved sprites too. If you go with the pre-convolved variant, you could maybe achieve fake supersampling by using a texture array with array indices mapped to positions within each pixel.

This topic is closed to new replies.

Advertisement