Search Unity

Time of Day - Dynamic Sky Dome

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

  1. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I just submitted 2.0.8 in which I tweaked those threshold values out of the box.
     
    snowcult likes this.
  2. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Awesome, thank you very much for the speedy tweak.
     
  3. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Is there somewhere we can learn more about the weather system? I'm a bit unsure about how it works, and the docs don't really explain it.

    For example, in my project, every day and night is exactly the same, how does it progress from one weather to the next?
     
  4. davylew

    davylew

    Joined:
    Mar 14, 2014
    Posts:
    10
    I have been test using Time of day with skyshop and alloy shaders.
    case Time of day using Ambient light and Direct Light affect scene , I just putting Ambient Light to affect skyshop shader.
    btw: skyshop have some bugs to change or bleeding skybox maps in runtime, so for the IBL specular rightnow is fixed.


    QQ图片20140603195316.jpg QQ图片20140603195321.jpg QQ图片20140603195316.jpg QQ图片20140603195326.jpg QQ图片20140603195330.jpg
     
    RomBinDaHouse, Tethys and snowcult like this.
  5. davylew

    davylew

    Joined:
    Mar 14, 2014
    Posts:
    10
    Hi plzdiekthxbye, I think u can add stars twinkle effect and using star maps alpha channel to Glow effects , rightnow i can't get hight brightness stars.
     
  6. proso

    proso

    Joined:
    May 24, 2012
    Posts:
    67
    Hi, Your asset looks great! I'm looking for a correct lat/lon-based sun animation. I've got 1 question: How does this asset handle daylight saving?
     
  7. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    are there any updates on cloud quality planned? I think that's the weakest part of this package
     
  8. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    You have to manually set the weather. If you want to do this in a script based on some rules or probabilities you can do so by accessing the weather enums and setting them to whatever your script calculated they should be. Time of Day is meant to provide a good looking sky dome with atmospheric scattering - doing weather randomization is simply not the ambition of this package. If you want an all-in-one solution to do this you can check out the ARS Weather System for Time of Day, which is not made by me.

    Improving the night sky is definitely planned for the next major release, but I can't give an ETA at this point.

    The package itself doesn't switch to daylight saving automatically simply because the time stored by Time of Day is the solar time. I would recommend only applying daylight saving to the time if you want to display it and not on the sky dome.

    Planned yes, but they were postponed since I don't have the time to implement the shaders at the moment as I'm currently busy working on the new version of Rust. I know that PhobicGunner implemented ray marched clouds for Time of Day, you could ask him if he'd be interested in sharing those with you.
     
  9. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Ouch, that costs nearly as muchas ToD lol. I'll figure something out. Thanks.
     
  10. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Time of Day 2.0.8 is now available for download. As always, the changelog can be found in the online docs.
     
    snowcult likes this.
  11. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Anyone else get a crash on import with the new patch? Happened to me, now none of my scripts (even defaults) will compile. All I did was import the new ToD.
     
  12. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I did a few tests and could not reproduce this in any of them. Do you have meta files enabled? Then, and ONLY then you could try to delete the Library folder in your project and let Unity recreate it. DON'T do this if you're not 100% sure that you have meta files enabled in your project!
     
  13. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    @plzdiekthxbye - As always thanks for the updates and great product. In addition, thank you for linking the ARS weather system, I was looking for weather that would play well with your product and this is PERFECT. At a dirt cheap price of $55, buying that weather system was a no-brainer, gratitude!

    2 1/2 years into using Unity and I still am not 100% sure what the best update method is. It seems like if I try to just update the package through the store it only updates new files, not ones that already exist. So, I just delete the folder in windows, then drag it back into the project (the new one) from a fresh empty project that I get the updated version in. Is this a good way to do it or is there something easier?

    Lastly, I'm using Unity Pro water and it looks crappy when going into night (shader doesn't seem to change with the light). Is there a better water shader anyone can recommend that works well with dynamic lighting? I'm always open to suggestions. :) Thanks again!
     
  14. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    I ended up reimporting all assets and I"m good now. Sorry for leaving worry on your post.
     
  15. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Hi,
    "Progress Time" in TOD_Time no longer works in new version 2.0.8...
    I'm using Unity 4.5
     
  16. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I can reproduce this and will submit a hotfix today. If you need the hotfix ahead of time, please send me an email with your invoice # and I'll send you a link.
     
  17. ThunderTruck

    ThunderTruck

    Joined:
    Sep 25, 2013
    Posts:
    61
    Hi, I have sent a message in your support form,
    I don't find your email, anyway I did not hurry, I replaced the script with the previous version 2.07 and it seems to work. I don't have problem to wait for the update fix in Unity assetstore

    Thanks
     
  18. danger726

    danger726

    Joined:
    Aug 19, 2012
    Posts:
    184
    Hey plzdiekthxbye, I've just integrated your awesome asset into my game! I had to make one or two changes to get it to work properly with HDR, and to apply the atmospheric scattering to my terrain shaders. I've submitted the details in your support email form in case you want to consider them for a future release.

    In the meantime, here are some screen grabs of my game with your time-of-day system...



    More images can be found here: http://dangersam.tumblr.com/ :)
     
    snowcult likes this.
  19. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    RAD-looking shots!



    Hey we're all interested :D yeah but seriously ToD in HDR bugs me a bit. In theory, no matter the weather, the daytime sky is always extremely bright. But ToD seems to render in a fairly low range, so any tonemapping that is applied just dulls it into a lame gray. Just naively bumping its Brightness property to 8 or something doesn't solve a thing. I upped its Contrast property a little bit and it does help, but doesn't look as vibrant as it could and should, like in your screens.. would you care to share your ToD inspector properties with us? I've tweaked things for many hours, days even, but haven't quite gotten there!
     
  20. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Thanks a lot for the HDR tweaks you sent me.

    For everybody else: Replace "fixed3 color: COLOR" with "half4 color: TEXCOORD0" in the shader structs to keep the calculated colors from clamping. He also attached a fix for an issue that could apparently happen with high Atmosphere.Brightness values and HDR rendering: Change sun shader "Blend OneMinusDstColor One" to "Blend One One" and multiply the sun color by Atmosphere.Brightness. I haven't tested the latter but I'll make sure to give it a try and include it in the next TOD update if it makes sense.

    Is this something more people would be interested in? I don't think I want to put a full terrain shader in there, simply because most projects use heavily custom versions of terrain shaders. However, I could imagine adding a .cginc file that offers access to the TOD calculations to sample a custom fog color in your terrain shaders.
     
  21. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Totally! A cginc would be genius, people already have the choice of RTP, forst/ATS etc. and can sooner or later come up with ways to integrate. Some like me also have quite custom homegrown concoctions for terrain and distance-fog etc. (Right now what I do for fog, since I have a custom deferred, is render the whole sky into the full screen and then in post blit the G-buffers on top, so I can fade out into the sky with distance. Get's me the correct fade color for every pixel, trouble is distant clouds showing through and only then does the distant geometry appear translucent, which it shouldn't. Sometimes it looks cool, like clouds hovering over mountains, but as they move through the geometry it becomes apparent. That's why I asked earlier about your alpha outputs etc.)

    So anyway, have all my votes on the cginc for the next update, and the other tweaks generously provided by @danger726
     
    Last edited: Jun 13, 2014
  22. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I saw an earlier post about the Time not working that a hot fix was released for, but I couldn't find the original post about the problem, so I'm not sure that's what i'm experiencing . Anyway, with the default settings and no latitude and longitude specified, the sun/daylight responds as you would expect to the hour. But if I set the lat/long the hour cycle is off. Hour 0 is dawn, hour 6 is about noon, hour 12 is late afternoon. It appears to be about 6 hours off.

    Also, when the sun hits the horizon, the mesh travels below the horizon but the light follows the horizon. Is this intended? Thanks.

    (the new forum does not allow me to add a title to my post, if it says "Reply to Thread", that's why :/ )

    tod.png
     
  23. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    The time bug in 2.0.8 has been fixed in 2.0.9, but what you describe is not a bug. You have to manually set the UTC time zone (one line below longitude) to match your geographic location. The problem with time zones is that I can't really calculate them since they're only very losely related to the location and greatly depend on the country you're in. If you set UTC to the correct offset (for Germany that would be UTC+1, just google your country to find out yours) the time of day will fit nicely again.

    This is in fact intended but the behaviour is configurable. The reason it's like that by default is to keep the sunlight from coming from beneath your terrain. This forced minimum height of the light source can be set by adjusting Light.MinimumHeight (can easily be set via inspector).
     
  24. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Thanks!

    I have questions about sun shafts and lens flare. I cannot get the sun shafts to work in my project. have several cameras, some part of prefabs from other assets. Others basic cameras I've created. In your demo scene, I am able to experiment with the settings at run time. In my scene, I can tell that it isn't working. Are there other considerations? Also, the effect is more of a halo around the sun. it does not have the same 'reach' as the unity Image effect. Is there a setting i'm missing.

    In the release notes you mention adding lens flare and then improving it. But I didn't see setting for it. And if I add my own, it's not aligned with the sun. Thanks again.
     
  25. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    It's hard to tell exactly what's wrong from your description, but if you setup the sun shafts according to the manual and as I did in the demo scene they should work just fine. I would recommend disabling some cameras to see when exactly this problem occurs to be able to debug it a little better.

    Are you using the Unity lens flare system? Make sure the sky dome is positioned in a way that it's always centered around the camera you render the lens flare on. The TOD_Camera script can help you with that (see manual for instructions).
     
  26. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Hi,

    id did not read true all the thread and hope this has not be asked to many.

    Do i can activate something at a given time with time of day?
    I mean can let time of day switch on my lights in the evening and of in the morning or can i let a merchant do not sell at night as examples?
    I read this feature on another weather system and would like to know if time of day also can do this or will do this in a planned future update.
     
  27. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    There are some scripts to enable and disable lights, particles, renderers and audio sources based on the time of day or some weather condition in the "Examples" folder - you should be able to modify those to do whatever you like, for example your merchant situation.
     
  28. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    I have the worst luck updating TOD, lol.



    Going to try redownloading the package.

    Edit: Getting a little old having all my scripts fail to compile after whenever I update ToD. It only every happens when upgrading ToD. And, this is a new project on a new partition in a new installation of Unity3D. So... no idea what that issue is.
     
    Last edited: Jun 16, 2014
  29. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Tethys and snowcult like this.
  30. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    That is some nice looking sky!
     
  31. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Before I spend many hours or days figuring out how to represent the current-frame sky-dome in a Spherical-Harmonic, a simple question to @plzdiekthxbye --- are you anywhere in the package by any chance perhaps already using any SHs?

    If not, no prob --- but if yes, would be crucial to know :D
     
  32. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Not using any spherical harmonics directly, sorry to disappoint. What are you planning to use them for?
     
  33. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    No prob. Right now I'm generating a skydome-only cubemap rendertexture (with auto-mip but they suck for cubes) which I then sample into for essentially "diffuse-IBL" in-place of old-school ambient lighting. The surface's per-pixel normal vector is the cubemap lookup (not the reflect(norm,view) vector, just the normal) and bam, beautiful ambient/indirect lighting.

    But!.. still that's a cubemap fetch per pixel per frame which is a bit too wasteful for my taste just for ambient and given all the other per-pixel stuff I'm already doing and planning for. And for ambient I only need an extremely low-resolution mip-level of that cubemap (or simply an extremely low-res cubemap) and they don't smooth over nicely at all across cube-faces.

    Anyway, with SH I can basically avoid this cube-fetch (and also generating it) and still get the approximately/perceptually same directional-ambient/environment-diffuse contribution, well some 93-97% of it :D

    The catch? Figuring out how they work, and then I'll need to perform quite a few calls of your TOD_Sky.SampleAtmosphere method to generate SH coefficients per frame. (I hope it's superfast and designed for multiple calls within a frame without recomputing redundant stuff! :D :D) Then send it over to my deferred lighting-as-postprocess pass as uniforms and figure out how to reconstruct some directional incoming light from those very SH9 coefficients somehow (no idea yet how) projected from my CPU-side SampleAtmo calls.

    So I wasn't sure if for any reason or other you already had a SH representation of the hemisphere somewhere in your codebase, which would save me the SampleAtmo calls. But since not, no prob, I'm gonna work it out somehow.
     
  34. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    That one I tried before, but as you said without properly blurring the cubemaps (only mipmap blur) it sadly doesn't look too good.

    There are 2 InverseTransformDirection in SampleAtmosphere that I can remove to speed it up a little. Other than that it uses the same precalculated values the shader uses - won't get faster than that. I'll make sure to include that change in the next update.

    I love the idea of using SH's as ambient light, best of luck with it!
     
  35. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589


    That'd be much appreciated, thanks in advance! Could I request another very tiny, zero-effort addition plz? It would be super-awesome if you could include in your Shaders folder a totally empty text file named timeOfDay.cginc or whatever, yes totally empty but nonetheless #include it from every .shader file?

    This means zero overhead for normal ToD use but if someone ever needs to customize every single vertex shader --- which indeed for paraboloid reflections I need to do --- would make life somewhat easier. Right now I open all your 13 shader files individually, in each place an #include to my skyrefl.cginc and replace mul(UNITY_MATRIX_MVP, v.vertex) with my own SKYVERT #define. Not a problem to do this once for 13 files, but ToD still does get updates every couple of weeks or so, so would be supercool if it came with an empty include file that I could either -- not import -- or re-edit once per update instead of 13 files per update :)

    So, just this simple empty.cginc #include and I'll happily forgo earth-shadow-in-atmosphere for another 1 or 2 years and moreover try to send a huge pile of nontangible karma your way somehow :p
     
  36. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Actually I realize it's a bit of a tall order to ask of you, so you may very well reject my humble request, and it's OK if you do..

    BUT... :D

    If you do decide the little empty.cginc file is feasible, then it would be super crazy freaking awesome to have the cginc look like this:

    Code (csharp):
    1.  
    2. #define TOD_TRANSFORM_VERT(vert) mul(UNITY_MATRIX_MVP, vert)
    3.  
    And in the 13 shaders only once in your lifetime and once per file replace

    Code (csharp):
    1.  
    2. o.position=mul(UNITY_MATRIX_MVP, v.vertex); // some have o.pos instead
    3.  
    with

    Code (csharp):
    1.  
    2. o.position=TOD_TRANSFORM_VERT(v.vertex);
    3.  
    I know.. a bit crazy to ask this.. I can live without it if not possible, manually replacing this in my local copy once per update won't kill me after all.

    Still, it won't add any overhead whatsoever so if you're feeling like "sure, whatever", I'd be super-freaking-amazed :D
     
  37. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I love what you're doing with your project Phil! I think I can add this as well since it won't affect readability or performance for everybody who doesn't want to use it.
     
  38. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Yay, made my day! So much appreciated. :D:D:D Gonna post some super-stunning ToD shots here in a few days ideally equivalent to the above Skyshop shots once I get to that point (with my own shaders) "but in realtime" ;)

    Oh yeah: oh damn I feel a little bad about this but someone mentioned "star twinkles". For us HDR+linear folks, rather than twinkles, would be a great option for both star and sun shaders to just have them output a higher-than-1 intensity. Now every HDR pipeline has its own concept of max intensity so just user-scalable of course. This would trigger natural bloom and the sun would no longer look weirdly flat when reflecting it on a surface via a dynamically rendered HDR reflection texture. 90% of the time specular highlight alleviates this but at some angles, especially on water, the two mix oddly. Not including the sun in the reflection is a dirty hack I've used for a while but not really a solution during ocean sunsets, especially as the specular highlight goes smaller and smaller. Including the sun in the refl will with the right normal-perturbed water reflection have it shining nicely all across the surface, but at the current LDR intensity it's no use ..

    Damn I'm writing another book here. Yeah just perhaps consider allowing for a user-scalable max intensity that you can default to 1 (so no change in visuals for existing and LDR users). I don't think the whole atmo needs to account for this, sun and stars should be sufficient.

    Thanks again in advance for the upcoming cginc with #define!
     
    Last edited: Jun 26, 2014
  39. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Let me quote the changelog of 2.1.0:
    • Added Stars.Brightness parameter (increase this to make stars get affected by bloom image effects)
    • Improved stars texture to better work with the new brightness parameter
    • Improved visual quality of the atmosphere when using HDR
    I can do the same for the sun mesh, no problem.
     
    Tethys likes this.
  40. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I am trying to access the sun/light properties. I need to enable or disable shadows fro performance reasons. I am getting the error "There is no 'Light' attached to the "Sky Dome" game object...". How can I accomplish this? Thanks.

    Code (CSharp):
    1.     private TOD_Sky sky;
    2.    
    3.     void Awake()
    4.     {
    5.         sky = GameObject.Find ("Sky Dome").GetComponent<TOD_Sky>();
    6.     }
    7.  
    8.     public void SetToDay()
    9.     {
    10.         sky.light.shadows = LightShadows.None;
    11.         sky.Cycle.Hour = 11;
    12.     }
     
  41. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Tethys likes this.
  42. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    sorry if this was already asked but can time of day be used like in fallout and skyrim where a certain button is pressed and can set a time ahead?
     
  43. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Yes, you have to simply adjust the hour value in TOD_Sky.Cycle.
     
  44. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    very nice thanks for the info will be looking into picking this up then!
     
  45. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Quick update on the state of 2.1.0: I got a lot done over the last couple of weeks and, since we're using the prerelease version of 2.1.0 in the Rust experimental branch, testing the new features got pretty easy for me. Everything points towards a very stable next major release, though some minor things in your projects might break due to some refactoring and restructuring I had to do - nothing too serious though.

    Regarding release date: I should be able to submit it to the Asset Store late July or early August.
     
  46. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Glad to hear it, I always hunger for updates of ToD, it keeps getting better usually :D

    Well damn, but thanks for the advance warning.. After you submit, give us a quick rundown of what might break here ;)
     
  47. bbedwell

    bbedwell

    Joined:
    Nov 5, 2012
    Posts:
    37
    Could you explain your workflow please?
     
  48. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    We are developing a mobile game and we work with OpenGL ES 2.0 in Forward rendering. At that time I was using Marmoset without problems and with any special workflow. From about 3 months we coded custom shaders and we stopped using Marmoset, so I can't say anything about the last updates.
     
  49. bbedwell

    bbedwell

    Joined:
    Nov 5, 2012
    Posts:
    37
    I see. We are looking into using a time of day plugin for a dusk to dawn effect but using Skyshop to get the look on our models. I am hoping to use Skyshop's ability to merge HDR skies (day to night) for the models and have a time of day plugin to give the sky changing.
     
  50. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Of course I can't be sure, but for what I know about Marmoset and ToD it should work fine.