Dear Unity 5: Please make the Sun realistic. (account for atmosphere)

[EDIT]
My original question about the Sun has been solved.

However, I would like to extend this question (and the request) to the addition of a Night Sky and a secondary celestial body on the sky, namely the Moon (which, as the looking-up-aficionados among us know, rises 6 hours after the sun).

I suppose it’s relatively trivial to add a second sun by editing the procedural skybox shader, but it needs a texture/phases and whatnot, and we still need to be able to blend to stars. For my purposes, I’m assuming any clouds should be handled in a separate shader/object(s) in the game world.

And as a temporary solution, as it has been asked on SO, how could we blend between the Unity 5 Procedural Skybox, and a regular Night Sky Skybox?

Thanks!

PS: I would like to edit the thread title to “please add Night Sky support”, but I can’t…


Here’s the original post:

I am not trying to be a smartass, but when you show off that you can have a directional light which is represented by a star in the sky, and that you can rotate it so that the sky gets golden at dusk, you’re not accounting for the star’s size and color.

When the star is close to the horizon, on a planet which has an atmosphere, the star appears big and red-ish (color depends on the star and atmosphere I guess). Either way, what we have now is how the sunset looks on Mars, not Earth.

Until you fix this, what are people’s thoughts on what would be a nice way to simulate this myself? Should I just make a quad with a sun on it, place it at the end of the skybox and parent it to the directional light, and handle movement, size, color and other distortions myself?
Is there a way to access the part of Unity code that specifies which colors the sky takes at which times of day? Alternatively, how are they calculated?

Cheers

Well, I’d rather know about whether I can edit the existing sun/sky system than buy a $60 assetstore project. Alternatively, I can make my own “sun” from scratch in an afternoon probably.

Anyway, I noticed that my puny human brain was playing tricks on me all my life, and that the celestial bodies are in fact not being magnified by the earth’s atmosphere when they’re at the equator. See some explanations here: Moon illusion - Wikipedia

However, the various contributing factors to this illusion from real life, aren’t as easy to have in games. So it would be tremendously convenient if we could actually change the scale of the sun/moon.

As for changing its color, that is an actual thing that happens because of the atmosphere, and it would be nice to have a somewhat accurate and tweakable cosmetic color on the sun.

I’m not entirely sure I could actually care less about the hemispherical color attenuation of the sun. If someone wants an amazing sky, atmospheric simulation or mind-blowing sun then just get it from the store.

1 Like

I don’t know how much your time is worth to you, but I bill about $100 an hour. It would take me months and months and months to even come close to anything even remotely acceptable compared to TOD, if ever. Spend $60 and your afternoon working with it. Or not. Or hey, maybe you could just write your own game engine next weekend. :smile:

Hey I only suggested a more controllable default celestial body entity in the sky, to match the existing realistic sky.

I don’t know what someone does for 14 thousand dollars a month, for months and months and months, but it ain’t this. Also, writing your own game engine in a couple of weekends can also just be standard student work. And not everyone wants to spend $60 on something which may or may not be AAA and may or may not be overpriced, or overfeatured for the relatively simple thing I already described in the first post.

I started a simple and lighthearted thread about SCIENCE, hoping to get a couple of replies with some unity 5 related insight, and nothing more. There was no need for buzz-killing meanies, who value what they care about more than the question. (at least that’s what it feels like)

Anyway, I’m outa here I guess…

1 Like

I know, I’m sorry, I was just kidding around, forgive me. I don’t think there is a lot of science to the sky system in Unity. I think it’s just there to give some light to the scene since many of the settings are dependent on a skydome. You’ll notice the default directional light in the scene isn’t called a sun, and the lighting window Sun property is blank. So really all they have provided is ambient skylight, no celestial body.

If you do decide to code something yourself, this might be a good starting point…

http://www.pixelstudio.nl/?p=138

It’s old, but probably has a lot of the code you may need. There is an old thread somewhere that people were posting improvements. I have an updated version i’ll dig up and send you if you need, PM me.

Edit:
I forgot about this guy, fantastic work…

http://scrawkblog.com/2013/06/04/ocean-with-brdf-lighting-in-unity/

hey lanefox. if you couldnt care less for the topics on this thread, why even bother posting here? your comment was absolutely useless and rude.
you guys reaaalllllyy have to stop with the “buy everything you want on the asset store” bs. there are lots of areas that unity needs to step up its game.
specially now, with unity 5 been sold as an amazing ultra global ilumination lighting whatever graphics magic software.
tudor’s request is super valid.

Because of efficiency and practicality. Product exists, is cheap, not mandatory in the base tool, would take a long time to build in if it were even on the roadmap.

Are we even talking about the same thing? The sun is just a point in a shader, you can multiply it with a float to change the size. The color is also already blended in, you just need a color picker and a blend slider. Oh noes much difficult, everybody!

Anyway, for everyone else, I found the solution myself. It turns out this is already implemented in unity 5, I just didn’t know where to find it, hence why I asked for insight.

The default sun is a hidden/internal resources material (and is actually the skybox itself (not a separate entity!)). So to get to access it, you’ll have to make your own material.
The sun is part of a procedural skybox shader which can be applied to any material. Make a new mat, and find the Skybox/Procedural shader and apply it. Then you need to find the Lighting window/tab and place this mat in the Skybox field.

So now look at your procedural skybox material. It has Sun Size and Atmosphere Thickness, which combined with the built-in distortion, fix all the problems I mentioned.

You silly ducks… Instead of telling me to make any new material and find and place the “Procedural” skybox shader on it, the code of which I can even edit, you went in the worst tangents and directions with your “recommendations”, despite me specifically asking for where to find and edit this stuff. Thanks a bunch… I’ll take my $100/hour now.

Now all we need is support for stars and a secondary celestial body to represent the Moon, with the ability to project the moon texture on it! :smile: If I have more time to screw around I may look into it more. Would also be nice to extend it to some versions with more than 2 main celestial bodies.

2 Likes