Atmosphere Appstate - Sun, Moon, Clouds, Stars

I’ve converted and improved upon the work of a guy called Andreas Olofsson to a more modern appstate.

There are several things you can play with. There is a calendar (for setting the date and time of day) and a speed multiplier for the length of a day cycle (24 hours). You can also alter the amount of stars at night quite easily if you take a look at the code. One thing I wanted to improve on is using perlin noise to generate the clouds. It would be so much nicer to be able to control the cloud density like that. I may do that at some point. It would also be nice to have the daylight change over the year like real life (gets darker earlier in winter, etc).

https://github.com/jayfella/DayNightCycle

And a quick video just to show you what it actually looks like… Just note that the speed is multiplied by 4800 in the video just to quickly show you a whole cycle.

11 Likes

Thanks

btw, when running i got

RendererException: compile error in: ShaderSource[name=Shaders/Sky/Stars.frag, defines, type=Fragment, language=GLSL100]
0(8) : error C7532: global variable gl_PointCoord requires "#version 120" or later

I changed it to FragmentShader GLSL120: Shaders/Sky/Stars.frag in StarBase.j3md and it works fine now.

Oh. Yeah sorry, ill push a change shortly.

EDIT: done.

1 Like

Impressive work!
I’ve seen something similar in the Game Engine Gems, Vol. 1, chapter 15 and 16:

They also included the position of the player on the earth (longitude + latitude) in their computation. Therefore, near to the poles you really have white nights, for example.

Maybe this gives you some ideas for your project.
I can give you the code (was available on the CD of that book) if you like.