Time of Day - Dynamic Sky Dome


Latest Changelog

Time of Day is a package to render realistic dynamic sky domes with day and night cycle, realistic celestials, dynamic clouds and physically based atmospheric scattering.

Sky

  • Physically based sky shading
  • Rayleigh & Mie scattering
  • Highly customizable
  • Sun and moon god rays
  • Aerial perspective

Lighting

  • Full PBR & HDR support
  • Realtime ambient light
  • Realtime reflections

Clouds

  • Physically based cloud shading
  • Semi-volumetric cloud layers
  • Dynamically batched cloud billboards
  • Adjustable wind speed & direction
  • Configurable coverage and shading
  • Correctly projected cloud shadows

Time & Location

  • Dynamic day & night cycle
  • Adjustable time progression curve
  • Full longitude, latitude & time zone support
  • Full Gregorian calendar support
  • Realistic sun position
  • Realistic moon position and phase
  • Realistic star constellations

Performance & Requirements

  • Extremely optimized shaders & scripts
  • Zero dynamic memory allocations
  • Supports shader model 2.0
  • Supports all platforms
  • Supports linear & gamma color space
  • Supports forward & deferred rendering
  • Supports HDR & LDR rendering
  • Supports virtual reality hardware
  • Supports single-pass stereo rendering

Links

Screenshots





7 Likes

You by chance have a web build of this so we can see the TOD and clouds animating?

I just uploaded a web player demo. It has a user interface to configure some of the parameters so that you can get an impression of what is possible to achieve with the package. The automatic day/night cycle is disabled in the demo, you just set the time of day with the upper most slider.

Version 1.2 just got released with a number of fixes and new features. It is now possible to adjust the sunlight falloff at sunrise and sunset. The cloud system has been greatly improved with a nicer overall look and parameters to adjust cloud color (dark or light clouds), coverage density and cloud shape to your liking.

Version 1.2 Changelog:

  • Fixed some bugs regarding linear vs. gamma space rendering
  • Fixed some issues with the horizon fadeout
  • Adjusted sun and moon size
  • Optimized sun and fog color calculation
  • Greatly improved visual quality of the cloud system
  • Added parameter to control cloud tone, allowing for dark clouds
  • Added improved stars texture at night
  • Added parameter to control the sun color falloff speed

How is the performance on mobile devices? Especially on the first generation iPad.

Sunrise/sunset is a bit red…otherwise, very nice!

Never seen a red sky, need to tweak or remove that area of the transition :slight_smile:

This is the most red sky you might see on some special winter mornings here at a latitude of 52° N.

One problem is that the game camera will always show a smaller part than the human field of view, but overall the sky is way to red. I’ve seen similar problems with the “silverlining” clouds sky package that will always show a red horizon in winter at this latitude (actually this is correct because of missing haze) but this won’t be such a huge problem when the terrain has some slight hills.

Beside the need of fixing the red sky, will you later add date, latitude and longitude to your package?

I also would like to see a webplayer without any trees and hills to see more of the clouds and horizon before I can think of buying.

Thanks for the feedback guys.

First of all, about the red sky: V1.2 added a parameter to configure the sunlight falloff, if you set his parameter very low (e.g. 0.1) you can completely remove the red stage of the sunset/sunrise. I forgot to add this to the webplayer before, but you can test it in the new one I just uploaded. If you have any other questions or suggestions regarding the scattering calculation feel free to post them.

About the performance on iOS: I only have a third generation iPad (the first one with a retina display) and it handles it really well (reaching the 30 FPS cap in my test). The second generation iPad tends to have a better performance than the third generation (because it only has to fill 1/4 of the pixels), so it should work even better there. I cannot say anything about the first generation iPad however because I never got the chance to run the package on one.

Date, longitude and latitude are actually already in there. However, for the time being only date and latitude influence the sun’s position. I can of course also add the calculation for longitude if this is a thing a lot of people would like to see, so far I just assumed this is nothing too many people would need.

Last but not least I added a second web player demo scene that consists of 4 cubes and the sky dome. You can choose the scene you want to load, so the web player link did not change.

Thanks again for your replies, please continue to post anything you would like to see changed or added.

EDIT: If the web player does not ask you what scene to load, just refresh the page. The old one might still be in your cache.

Sorry to see that 4.x is required, I’m still on 3.5 :frowning:

The package does actually work with Unity 3.x, but I submitted it to the Asset Store with 4.x and apparently they limit the usage to 4.x because of that. I just tried to export it as a package in 4.x and import it into 3.x but it looks like the asset export format is incompatible between major releases of Unity. I’ll look what I can do to submit the next update with 3.x so that you can download it properly.

Speaking of the next update, please do send me all feature requests via personal message, email or a post in this thread so that I can prioritize the things you guys want to see in my development schedule. So far the ideas for 1.3 are to add an optional lens flare effect (this is a little hard as most lens flares look incredibly unrealistic and I’m trying to create a realistically looking one) and some sort of automatic weather manager (which may include rain and snow particle effects).

The problem with sky domes (spheres…) is the clipping distance view when the skydome has to be very large ( in a big scenery, terrain…), because, in order to “see” the whole sky without clipping artifacts you have to use necessarily a very large far clipping distance (adding draw calls) or use a second camera, adding complexity to the scene.

I would say a second camera is not a bad thing at all. It can help a lot with z-fighting issues. And cubic skies just look terrible artificial.

Would be really good to have an option to use latitude, longitude and UTC.

Thanks for working on getting this in Unity 3, plz. If this is a hassle, I may end up upgrading to Unity 4. I’m still very much on the fence, though.

I agree that a 2nd camera is a good thing, it keeps my main camera from having a huge draw distance.

Could you may provide an android apk demo? =)

You can adjust the sky dome such that it is exactly as big as your clipping distance. The sky dome won’t change its appearence just because you scale it up or down, I made sure of that. You are of course free to use two cameras, but my package is not limited by your clipping plane in any way because you can just adjust the sky dome scale according to your project’s settings.

While the package should run on Android I personally don’t develop for it. I do own one of the free Unity Android 3.x licenses they gave away ahead of the 4.x announcement, but I have never used it. If there’s an issue I will look into it, but I cannot provide any Android examples for now as I focus on Desktop and iOS development.

I’ll look what I can do in 1.3 regarding these things. What I probably won’t do is to calculate the sun and moon position based on the exact real-life date because it will just add a huge overhead for an effect that barely anyone will ever notice. I also don’t want it to become too earth-specific as the package should be applicable to all sorts of planets as good as possible.

Speaking of 1.3, I might look into completing the height parameter that will allow the sky dome to adjust according to the viewer’s height in the world. The basis for this is already implemented but there are some things left to do and it would allow the sky dome to be used in flight simulator games, given that you use it together with a volumetric cloud system.

Time for a quick development update: I locked myself into my coding cave and sat down to optimize the package performance for mobile.

I benchmarked the absolute worst-case scenario that the complete sky dome has to be rendered (no occlusions by other objects). If for example half the sky dome is occluded by other objects, the frame rate will double.

Before the optimizations:
iPhone 4 / iPad 1: 10-15 FPS
iPhone 5 / iPad 3: 30-40 FPS

After the optimizations:
iPhone 4 / iPad 1: 40+ FPS (EDIT: after some further optimizations I am now at 60 FPS on the iPhone 4)
iPhone 5 / iPad 3: 60+ FPS (iOS does not render frame rates above 60)

This was mainly achieved without any visual loss in quality. I did however implement a mobile version of the cloud shader with two changes compared to the desktop version: the “Cloud Sharpness” and “Cloud Shading” parameters are being ignored. This is because these parameters have to be applied per-pixel, which would cost 10+ FPS on the iPhone 4 and iPad 1. Newer generations are able to do these calculations while still reaching the frame rate cap of 60, so you might be able to use the desktop version of the cloud shader there. You can also achieve the same effect the “Cloud Sharpness” parameter has by just editing the cloud noise texture manually. I might add different versions of this texture to the package if this is something people would like to see.

Completely disabling the cloud layer also greatly improves the frame rate, so if you don’t need any clouds you could probably also get 60 FPS on the iPhone 4 and iPad 1.

In other news, the downgrade of the project from 4.x to 3.x is a little bothersome, but I will try to get this done some time this week. All that and an improved implementation for latitude / longitude are planned to be released in a few weeks or even days, so stay tuned.

Thanks for making the effort to support 3.x, and the optimizations are great news!

A few things that happened today:

  • The project is now on Unity 3.5 so the next update should make the package available for download for 3.x users
  • After some further work on the shaders I now have 50-60 FPS on my iPhone 4
  • I added a realistic sun lens flare effect and an additional parameter for how much the sky color is being influenced by the sunlight and therefore the sun angle, resulting in some pretty neat new sunset configurations - a few examples with different parameters:



  • The moon has been reworked a little (added a lens flare, reworked the moon phase rendering), leading to a better overall look:


Does that mean 100% of the screen was filled by the sky dome during the tests?