Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Time of Day - Dynamic Sky Dome

Discussion in 'Assets and Asset Store' started by andererandre, Mar 4, 2013.

  1. gbv30

    gbv30

    Joined:
    Apr 15, 2015
    Posts:
    11
    That's not exactly what I meant. I wanted to know if I can get for example one day which lasts 22hours and a night only two hours.
    If I set the day to 10 minutes. Then, I'll have a night of 5 minutes.
    So, how could I do to get a very short night?
     
    Last edited: Sep 1, 2015
  2. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Oh, that. You have to check "Use Time Curve" on TOD_Time and adjust the time curve to look like this:



    The steepness of the curve specifies the speed of the time progression at a certain time (X axis = hour), so the curve in the screenshot makes time progress very quickly from 9 PM to 3 AM, and stretches the day out. The sum of nighttime and daytime is still the same you specified as "Day Length In Minutes", but nighttime progresses a lot quicker.
     
    Tethys and hopeful like this.
  3. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    401
    Thanks for the addition/correction. I always thought that pointed to the Computer Time and never investigated it since I already had my own conversion.

    Cheers
     
  4. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Excellent thanks guys, that was all I needed to know :) ToD was already best option even without knowing a weather system could be tied to it. I'm still learning the ropes in Unity but it's always good to know which assets to buy.
     
  5. exploitedtaken

    exploitedtaken

    Joined:
    Feb 25, 2014
    Posts:
    19
    you should add global fog support for deferred lighting. forward is really bad for lighting.
     
  6. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    This is already the case? The fog image effect that's included in Time of Day (TOD_Scattering) supports both forward and deferred lighting. The Unity global fog image effect also works in combination with the automatic fog color option in Time of Day, if you prefer that - assuming the standard assets in your project are up to date.
     
  7. exploitedtaken

    exploitedtaken

    Joined:
    Feb 25, 2014
    Posts:
    19
    It is not working like forward rendering fog, at least for me.
     
  8. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I don't understand what you're trying to say. What's "it" and what do you mean by "working like forward rendering fog"?

    The global fog image effect that's part of the Unity standard assets is meant to be used to add fog to opaque objects when using deferred rendering. Time of Day can adjust the color of this fog by setting the Fog.Mode inspector variable to "Color" or "Directional".

    The TOD_Scattering image effect is a custom fog-like image effect that uses atmospheric scattering to calculate a per-pixel fog color. It works in both forward and deferred rendering in Unity 5.
     
  9. exploitedtaken

    exploitedtaken

    Joined:
    Feb 25, 2014
    Posts:
    19
    Sorry my mistake, i didn't know it works with global fog-scattering automatic color etc. It works great now and great asset btw.
     

    Attached Files:

  10. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    It's very strange, but we are still having this weird issue with Time of Day where anytime I am working on the project and open a scene with TOD in it, work on the scene, save and change scenes and then all of my resources used up. :/

    Just now I opened Unity and opened my Loading scene. Loading loads in selected character and has UI prefab in it. From there it fires up my Photon room and loads into play scene. First time load in I have 114 FPS while playing (initially I have 200+ but when world is done generating I am down to 114). I NEED this FPS as this is with many game items turned off.

    Anywho, I stop Unity, which then takes me back to Loading scene. I open my play scene, make a change, hit save, load Loading scene. Hit play and BOOM, instead of starting with 200+ fps scene starts at 50+ FPS and goes down to 30-high 20's once scene is done loading. I can recreate this effect all day long on any machine (well at least on the 3 I have tested on, all with different versions of windows and different hardware setups and one of the test setups is a fresh project with only TOD in it).

    So as a result, I have to restart my Unity EVERY TIME I work on any scene that has TOD in it after it is saved. I am not sure what else to do at this point - awesome asset - probably the best Day/Night cycle on the asset store and I also have ARS weather so would love to stick with TOD.... but I hate restarting Unity 20 times an hour. :/ I also hate to say anything negative about this asset because of how awesome it is - I just want it to work without killing my project. :p
     
  11. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    As I wrote in my last reply regarding this issue, you have to dig deeper in the profiler in order to debug it:

     
  12. Deleted User

    Deleted User

    Guest

    Is it easy to make it sync with photon?
     
  13. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Took me about 30 minutes to get the major items synced up using Forge, so I imagine the process is pretty simple for Photon as well.
     
  14. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Hi, I have two points to ask.

    1. is it possible to disable the procedural skybox of Unity 5? The Time Of Day material is automatically assigned, but I can't remove it. Is it really needed since this assets was already working without it in Unity 4? I'm just trying to optimize the most for mobile.

    2. I'm rendering a CubeMap using the sample script in the Unity manual. It renders only the Unity Procedural skybox and the clouds. It's missing the atmosphere and the moon. What's going wrong?

    Thanks
     
  15. proso

    proso

    Joined:
    May 24, 2012
    Posts:
    67
    Hi,

    I have a question. Does someone know how the get and set de time/date cycle parameters in Playmaker or with the uGui slider?

    Thanks
     
  16. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @plzdiekthxbye Any answer on this?
     
  17. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Hi there, will there be any plans of adding the Milky Way?
     
  18. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    You need to synchronize a single value to synchronize date and time (Cycle.Ticks). This should be easy to do with any networking solution.

    The procedural skybox is assigned but unused if the camera is set to "solid color" clear flags, so it won't affect performance. It's required for all the Unity 5 editor baking features (GI, reflection probes, ...) which is why I'm always assigning it.

    If you want to render a cubemap at night, use the "Space" child object (see the FAQ section in the docs for more info on how to set it up). You can't just render a cubemap at day unless you manually adjust its position in the render queue, but it'll always look weird to combine a static skybox with a dynamic day and night cycle, so I don't recommend it. By definition a skybox at day would either have to render before the atmosphere, and therefore be covered up by the atmosphere, or after the atmosphere, and therefore cover up the atmosphere.

    It should work the same way it does for variables in other scripts. The time variable is in the TOD_Sky script, under Cycle.Hour.

    I have vague plans to ship a cubemap of it, but there's a bunch of licensing stuff to take into account. If you have a cubemap with an appropriate license for your use case, you can add it yourself by assigning it to the "Space" child object (see the FAQ section in the docs for more info on how to set it up).
     
  19. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Quick question regarding the sky dome:
    In previous versions we scaled it to fit the scene/clipping distance. Now after upgrading it seems to be dynamically sized, and to a very low value. I have not waded through the thread yet, but I would really appreciate an explanation regarding why and how to get back to the situation we had previously. As it is now, the skydome is not rendered behind our terrain and water for example...

    Thanks in advance!
     
  20. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    The TOD_Camera script handles scaling of the sky dome. You can specify a scaling factor or disable automatic scaling entirely if you prefer that. TOD_Camera should only be on your main camera, i.e. if you have 2 cameras for VR it should only be on one of them.
     
  21. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I don't have a cycling. I need a cubemap to reflect the sky, with the atmosphere and the moon (it's a manually placed planed that uses the moon shader) in day time.
    Anyway I realized that to render them correctly I have to set the camera that generates the cubemap to Solid Color with the same settings I have in game. The default setting for a new camera was with Skybox. That's why it renders wrong.
     
  22. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    interesting... and if you have 3 cameras (3 screen) you need only one for example to the central?
    how it handles the scaling skydome?
     
  23. proso

    proso

    Joined:
    May 24, 2012
    Posts:
    67
    Hi plzdiekthxbye,
    I tried exactly this for days now. I can find a lot of variables, but not the one to change time. Is there a workaroud. Maybe an example to change it with the uGui slider via a script? I hope you or someone else can help me, I'm really stuck :(

    Thanks
     
  24. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I was talking about a VR setup when I wrote this since I didn't know whether or not he was using one. For a simple 3 screen setup you can center and scale the sky dome around every single one of the 3 cameras by attaching the script to all of them, but if you look at it with a VR device you'll notice that things don't look quite right.

    Looks like the uGUI slider inspector doesn't support classes within classes. I don't know if this is by design or not, but you can work around it by attaching a custom script to the slider that wraps your time adjustment methods.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class TimeSlider : MonoBehaviour
    4. {
    5.     public void SetTime(float time)
    6.     {
    7.         TOD_Sky.Instance.Cycle.Hour = time;
    8.     }
    9. }


    You can subscribe to the slider changes via code as well if you prefer that (UnityEngine.UI.Slider.onValueChanged.AddListener). All of this is part of the basic UI tutorials.
     
  25. DxStd_IgnatPribylov

    DxStd_IgnatPribylov

    Joined:
    Sep 24, 2015
    Posts:
    30
  26. proso

    proso

    Joined:
    May 24, 2012
    Posts:
    67
    Thanks you very much, this works great! You're my todays hero ;)
     
  27. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
  28. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I started working on the next update a few weeks ago but have since been quite busy with my primary job. No ETA yet.
     
    SarperS likes this.
  29. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    Any idea how to fix far trees wrong illumination when tree billboard start to kick in?
     
  30. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    So I found the possible problem, if I disable scattering (but I don't want to do that) the far distant trees (are billboards actually) render correctly. If I enable, seems scattering don't affect those billboards. I am super sure that's the problem because I've played with tree billboard distance and only those who are billboard don't receive scattering. Any fix to that?
     
  31. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    I would love to see the atmospheric scattering more integrated into time of day, the clouds are not affected by it and this gives unrealistic results. The Fogginess value could also steer the atmospheric scattering.
     
    hopeful likes this.
  32. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    Regardless of my feedback in the previous post, you gotta love TOD:
    TOD1.gif
     
    hopeful likes this.
  33. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    See my reply here, plus the attached shader as a workaround in case you want to stick with the legacy Unity Tree Creator trees: http://forum.unity3d.com/threads/time-of-day-dynamic-sky-dome.172763/page-23#post-2154889

    Fogginess affects the color of the scattering image effect, but I won't make it affect its density since that should be specified by the weather parameters of your particular project. Choosing the right fog density greatly depends on the scene layout and the art style, so it wouldn't make sense for me to preconfigure values for that.

    You do bring up a valid point with the clouds, but there's no trivial solution for it since clouds cannot write usable depth values (they're so far away that all of them would write the maximum value). There are workarounds for it and looking into those is definitely on my list, but in the meantime you can simply decrease the cloud opacity as the fog intensity ramps up in your scene.
     

    Attached Files:

    ghiboz likes this.
  34. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    Thanks for update, only Unity TreeCreator have that problem, SpeedTree works fine.
     
  35. sao

    sao

    Joined:
    Sep 2, 2014
    Posts:
    4
    Hi there, just bought TOD, it's really full of amazing features!
    But I'm stuck with one problem now. Our scene is a large procedurally generated world and in order to catch up witch floating point errors we make use of floating origin and periodically shift everything in the scene to (0, 0, 0) incl. of course the camera, making the transition seamless to the user.
    Now the problem is that TOD clouds jitter when those jumps are made. I've been trying to figure something out with TOD_Animation.CloudUV but can't find a smart way to do that.

    Do you have suggestion how this can be resolved? I just add that we have longitude/latitude information available before and after the jump is made if that helps to make required calculations.
     
  36. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    I have a strange issue, when i enable the TOD_Rays script, the reflection probes seem to render incorrectly, in the reflection the sky is all black between the clouds, as soon as i disable the TOD_Rays its ok.
    Project is set to deferred & linear. Latest version of TOD. Any idea what could cause this?

    Another thing, i am not sure about is the TOD_Shadows, should they be correct regarding the cloud position? It seems they are not. Looking at the sun, no cloud anywhere near the sun and still we get cloud shadows sometimes and the other way around.

    Third question, what would be the easiest way to know if there is a cloud above the camera position?
     
  37. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    For my third question... we found a hackish solution, we use a 1x1 render texture and grab only the alpha channel from the zenit of the cloud object. However even though it is only one pixel, it takes around 0.4 ms and we would like to find a better way to get the alpha of the clouds above. We dont want to spend a day or 2 to dig in the guts of TOD just to recreate in script what you do in the shaders, so if you know a good way to get the exact cloud coverage above, that would be great. 1px on the very zenit would be enough.

    Thanks
     
  38. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    Apologies if this has been answered anywhere (and if so, can someone point me towards it?), but why won't particle effects work if ToD is active in the editor?

    In order to see their visuals, I have to disable the main ToD script. Is there any correction for this?

    Thanks.
     
  39. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    There will be an inspector variable to toggle this behaviour in the next update, but until then you can manually patch TOD_Animation - simply make OffsetUV always return Vector3.zero.

    You must have the "Clear" game object included in your reflection probe pass. Change its layer to a layer that isn't included in the reflection probe and everything should work fine again.

    There's a known issue with the TOD_Shadows cloud position when using different cloud scales. This will be fixed in the next update.

    I have some plans to add something like SampleAtmosphere for clouds, but it's not the highest priority thing right now. You can implement a rough solution yourself by using the CloudUV / CloudOffset coordinates stored in TOD_Animation and sampling the cloud texture on the CPU using those. That being said, the proper solution would indeed be a render texture, so it might be a good idea to look into why it takes 0.4ms to render it and report the cause of this to Unity.

    Unity confirmed this as a bug on their end and are working on a fix. If I remember correctly it was caused by calling certain math methods in edit mode, so there's little I can do to work around it on my end. I don't know if it's still present in the latest Unity 5 release - are you on the latest version?
     
  40. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    I'm using Unity 5.1.1 at the moment. I tried 5.2 but I had some weird experiences with that so I rolled back to my previous version - I've not grabbed 5.2.1 yet to see if that's any better.

    I'll just have to have a workaround of disabling ToD whilst in editor mode and script it to activate once in play mode.

    Thanks for the reply.
     
  41. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    Thanks for the infos! Changing the layer did indeed the trick for the rays. I expected it to have to do with the clear object but i didn't think about changing the layer. We also solved the rendertxture delay.
    To the cloudshadow issue: For now, what cloud scale would work with the shadows? If you have a fix could you send me the lines that have to be changed? We have to present our project pretty soon and it would nice to have this working.

    Again my compliments for this wonderful asset and your code is beautiful. If you find a way to get the clouds to work with the atmospheric scattering, TOD will be absolutely flawless. Just sayin to motivate you to go that extra mile ;)
     
  42. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,192
    This looks great! Any plans of implementing weather effects? Also, are there any real-time cloud shadows?
     
  43. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Not sure if this has been mentioned before, I cannot simulate any particle effects, to see how my changes effect them, in any scene that has TOD in it. It just doesn't go when hitting simulate. The only way to test a particle system in a scene that has TOD, without hitting the play button, is to manually scrub through the controller to make it work. Could be related to the performance issues I am getting or maybe it's something totally separate.
     
    Last edited: Oct 23, 2015
  44. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    @Tethys - disable the tod_sky script and the particle effects work again in the editor. I've done this and added a line in the tod_camera Start() section to re-enable it if it's in play mode
     
    Tethys likes this.
  45. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
  46. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    The default value should fit best. I don't have a fix to send you yet since it's one of the last things I still need to do before I can release the new update.

    For cloud shadows there's the TOD_Shadows image effect (see docs for details). No plans for weather particle effects since in my opinion those depend on the scene and art style (you can also check the Asset Store). There's a weather manager in the example scripts folder to get you started.

    See my reply above:

     
  47. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Looks awesome I just have one question.

    Is it possible to set have different cloud settings with longitude, latitude so you can have clouds in the east and clear in the west? preferably what I want is like cloud systems where each cloud system has different settings and speeds.
     
  48. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Ahh I was not aware of this Unity bug, thank you for the information and apologies for being so n00bish. :)
     
  49. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I just bought the asset and I have discovered a bit of a problem. Maybe it was addressed already, but 23 pages a lot to skim over. Sometime around the 19th hour or so, my whole terrain flashes white for a second. I'm using RTP and just dropped ToD into the RTP Terrain demo scene. I'm on Unity 5.2. Is this a known issue?

    Also, I will reveal my ignorance in case anyone else comes across the issue. When I first put ToD in the scene, there was horrible flickering if the time progression was turned on. I was a dumb dumb and didn't remove the existing directional light from the scene. Taking that out fixed the problem.
     
  50. joeconstable97

    joeconstable97

    Joined:
    Jul 30, 2013
    Posts:
    49
    Hey, I've recently come across an issue when using Image Effects across multiple cameras with this asset and was wondering if maybe someone could help me.

    This is my setup:
    upload_2015-10-29_10-5-41.png

    The Main Camera renders the world, the First Person Camera renders weapons and such and the Image Effects camera is where bloom, tonemapping, etc. is held and rendered (allowing both the Main Camera and First Person Camera to have said effects)

    The issue comes when I try to use the Scattering image effect from this asset. when I place it on the Main Camera (I can't put it on the Image Effects camera because it doesn't store any depth information) this is the result:
    upload_2015-10-29_10-8-27.png

    The sky goes black! The moon, sun and stars all still render though. It seems to me that the colour the sky actually goes actually the colour chosen for the Main Camera to render as the background. I have tried using the Global Fog effect but to no avail. It just simply doesn't render any fog.

    Also - maybe this will help come up with a solution - when I use the Cloud Shadows image effect the clouds don't render but the rest of the sky (moon, sun, stars, atmosphere, etc) does.

    Thanks