Jump to content
  • Advertisement

Recommended Posts

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.

 

Share this post


Link to post
Share on other sites
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/

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Posted (edited)

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.

Edited by l0calh05t

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!