Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Time of Day - Dynamic Sky Dome

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

  1. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    @plzdiekthxbye Thanks for the reply. Testing out the Light and Fog this eve.

    Edit/Update 2:
    Light is actually following LightIntensity in TOD_Sky which is set in Sky Dome Inspector...thus I need to understand how to access this (the Sky Dome Light Intensity under Day and Night Options) via script without hacking into your script.

    Fog has been simple connecting directly to the renderer to set the distance, however, Time of Day is controlling the color of the fog. It appears there is no external access to this fog coloring as well.


    As to Unity 5. I agree with you. 4.x should be a specific case. I have had no issues I can think of with Time of Day in Unity 5. Only thing I can think of why someone would not update at this point is not wanting to have to adjust materials and shaders. Going to have to do it at some point. Personally I have just installed/updated to Unity Pro 5.0.0f4 and no issues.

    All:
    Weather....I went away for a couple of days to unstress. I also had a few issues with phpBB that are now resolved. Once I get the Light and Fog tested this eve I will upload the assets and post the links and instructions in my forum. There are also categories in the forum for our Time of Day Community Ideas and Updates as well. See you over there. I will make a Unity forum topic with some pics and links to the forum as well.

    Forum Link: www.worldofanvarath.com/forum/
    Web Link: www.worldofanvarath.com

    Cheers
     
    Last edited: Mar 10, 2015
  2. alphakanal

    alphakanal

    Joined:
    Jan 21, 2013
    Posts:
    52
    Hi,

    the reason for the black background was using 2 ui-canvas with "screen-space camera" mode ( a camera for each / clear flags: depth only ).

    Main-cam depth 0
    UI-cam-1 depth 1
    UI-cam-2 depth 2

    Switching both UIs to "screen-space overlay" the black background was gone - but only when running in GameView. The exported Webplayer got still a black background. Same thing when export it into a Standalone ( WIn ). Both display-settings:Fantastic, Rendering Path: Deferred Lighting

    There are some more errors ( missing image effects on export ) posted here.

    Are there any issues known with the TOD using screen-space camera UI-elements or am i doing something wrong ?

    Next question :

    When using the script "LightAtNight" - the lights are turned on at 21.73 ( in my case ) how can i turn the lights on at 20.00 ? Can i set a specific time when the IsNight Value is true/false ?

    Now I'm doing it with a slightly modified LightAtNight Script:

    Code (CSharp):
    1.  
    2. protected void Update()
    3.     {
    4.  
    5.  
    6.  
    7.         int sign;
    8.  
    9.         // int sign = (sky.IsNight) ? +1 : -1;
    10.  
    11.         float time= sky.Cycle.Hour;
    12.         if ( time>= 20.8 || time<= 8 ) {
    13.             sign = 1;
    14.         } else
    15.         { sign = -1;
    16.         }
    17.  
    18.  
    19.         lerpTime = Mathf.Clamp01(lerpTime + sign * Time.deltaTime / fadeTime);
    20.  
    21.         lightComponent.intensity = Mathf.Lerp(0, lightIntensity, lerpTime);
    22.         lightComponent.enabled   = (lightComponent.intensity > 0);
    23.     }
    Sorry for asking that much - but the TOD is too awesome ;-)
     
    Last edited: Mar 10, 2015
  3. pollolan

    pollolan

    Joined:
    Mar 5, 2015
    Posts:
    6
    I apologize, but I write code only in Javascript, so that actually looks pretty hard for me. I have to ask again if a simple example code like Unistorm has done could be posted, otherwise I guess I'll have to stick with that. It honestly should take 5 minutes for you, I think...
     
  4. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Now getting all white after light bake, if I turn it off and bake with the directional light it is normal.
    What is the lighting practice with TOD and Enlightenment?
    Use Direction Light?
    I have the Brightness setting in the Sky Dome set to 1.
    Should I bake with TOD off then enable after baking?

    EDIT: Hmm, seems it was the Directional General GI, when I switched to Non Directional, it looks normal.
     
    Last edited: Mar 12, 2015
  5. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    Hi All

    I have completed Olander's Realistic Weather and posted it to the Unity forum. You can view the system and download the files from here.

    http://forum.unity3d.com/threads/fr...ers-realistic-weather-for-time-of-day.310180/

    I am hosting the files on my FTP with no password (download only) but logging into my Forum is not required. I would like that if you did but not necessary. The Light and Fog issues still persist....we will see what may be done. I have not a good understanding about how wind actually functions in Unity yet. The script and code placeholders are there but nothing including the audio has been done yet. I do have some nice wind audio that I would be more than happy to include.

    In any case. The ORW is very solid and highly performance based. Enjoy it with the fantastic Time of Day Lighting.

    Cheers
    Olander
     
    hopeful likes this.
  6. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I don't know Playmaker, but TOD_Sky.Cycle.Hour would be the variable you have to set.

    TOD_Sky.Day.LightIntensity and TOD_Sky.Night.LightIntensity, which can easily be found in the docs.

    As I wrote, it's setting the color but not the density. If you want to control the color yourself I recommend setting TOD_Sky.Fog.Mode to TOD_FogType.None and do it entirely on your end.

    You wrote in your PM that the script errors are gone after an asset reimport - is the UI issue gone as well?

    It's actually not using the time since the time of sunset depends on a variety of parameters, as it does in real life. If you want full control over the exact hour then writing your own script is the only solution. However, I can extent the LightAtNight script to allow setting a bias parameter for more control, which seems like a good idea.

    I don't write UnityScript myself, but it uses the same syntax as the C# version:

    Code (JavaScript):
    1. function Start() {
    2.     TOD_Sky.Instance.Components.Time.OnMinute += OneMinutePassed;
    3. }
    4.  
    5. function OneMinutePassed() {
    6.     Debug.Log("One minute passed.");
    7. }
    However, you will run into script compilation order issues when trying to access C# scripts from UnityScript. This requires you to place the Time of Day folder in a folder called "Plugins" so that it's compiled before your script. I just tested this (Unity 5.0f4) and it seems that you cannot access TOD_Sky.Instance.Components when you do that due to the fact that its protection level is "internal" and not "public" - I'll make sure to change that in 2.0.1, which I plan to submit this weekend. You can manually change the protection levels to "public" in TOD_Sky+API.cs, TOD_Components.cs and TOD_Time.cs until then. Sorry for the inconvenience, I haven't received a report about this issue so far, probably because most of my customers use C#.

    Enlighten works fine for me in the demo scene, and it should work with the default parameters of a new scene as long as you remove the directional light Unity places by default. Are you certain there's no second directional light in your scene?
     
    Last edited: Mar 13, 2015
  7. pollolan

    pollolan

    Joined:
    Mar 5, 2015
    Posts:
    6
    no problem, thanks for the clarification =)
     
  8. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    Look....I am not stupid....do you really think I would ask on a public forum if I could find the answer in the 'Docs'? Your scripts are also difficult to follow since you use a lot of indirect references and little commenting....although better than others.

    Your previous comment in this forum was: sky.Light <= Not TOD_Sky.Day.LightIntensity <= this works sky.Light is nothing.

    Let me ask you this....did you do a search for LightIntensity in your PDF Docs prior to posting this nonsense? Do it right now if you have not. You get Exactly 3 hits...all three are floats and the last being a Get only!

    So....off to the scripts. TOD_Parameters....search for LightIntensity....found the ones in the Inspector....it seems.
    [Tooltip("Intensity of the light source.")]
    [TOD_Min(0f)] public float LightIntensity = 1.0f;

    then this one May Be the answer... lightIntensity = Mathf.Lerp(0, Day.LightIntensity, sunVisibility);
    not quite sure....I better ask in the forums to be sure how this is being dealt with.....and I received a short 'I am Too Busy To Answer' reply that was incorrect.

    Now for Fog:
    Your New Quote:
    As I wrote, it's setting the color but not the density. If you want to control the color yourself I recommend setting TOD_Sky.Fog.Mode to TOD_FogType.None and do it entirely on your end.

    Your Previous Quote:
    I don't control the scene fog density settings at all. Only the color is adjusted. If you want to control the fog density, use RenderSettings directly.

    I Did In Fact try the RenderSettings Directly with this and only the density worked:
    RenderSettings.fogColor = c32WEATHER_FOG_DKGREY_RGBA;
    RenderSettings.fogEndDistance = fWEATHER_FOGGINESS;

    Your new quote is different than your previous quote....and you are stating 'As I Wrote'....you did not write that. Get your facts straight. So now I will test your new quote and see how it functions.



    And now we are here. Look....I come from a C (and C++) background (Old School). Porting coding style in C to C# takes some getting used to but they are similar but C you have to be much more specific. You C# coding is like most other young people these days....lacking in comments and far too many indirect variables.

    For Time of Day I am not about to reverse engineer your code to figure out how to set 4 or 5 parameters. I was hacking your code but then every time you updated....back to hacking and re-coding what was hacked because you changed how something functions. Hence.....the forums....to ask questions.

    I have been a huge supporter of Time of Day, your asset. It looks and feels very nice in game. Unity 5 has caught up to Time of Day by quite a bit....but even so....Time of Day does things with the light and color that really shine. What has always been missing is Weather. ARS made something specific to Time of Day but that does not function and the creator is doing his Caelum Weather System which does not use Time of Day at all. There are a few other weather 'things' out there but they are integrated into something already. So.....I had my ORW system that I have been wanting to port to Unity....and what a better pairing than Time of Day. Taking sales off the table.....Time of Day has an excellent Weather System....and it is completely free. You gain the bonus of free marketing. You have not been supportive at all in the integration process.

    So a little advice.....take it however you like....do not treat your best customers so rudely. Yes you may be busy but so are we. I work no less than 14hrs each and every day to produce the Genesis Toolset which lays on top of Unity. A game is actually being made as well. Yes the forums are a pain but necessary. You are not 'that' busy to not be able to answer properly.

    That is the last thing I will state on this ToD forum. Fair well.
     
  9. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    http://gfycat.com/PepperyGaseousArabianwildcat

    Sidenote: For anyone else only casually following conversation here from Oleander and not realising he actually has a weather asset, it's over here for free: http://forum.unity3d.com/threads/fr...ers-realistic-weather-for-time-of-day.310180/

    And it looks pretty neat. It's a shame that there's the possibility he won't continue to support it over this because many of us are really keen to have a functioning weather system to work with our ToD. And whilst ToD is an absolutely awesome asset, and I value it greatly (especially as someone very incredibly minimal programming knowledge), this is one feature that really is lacking and could certainly use some input from the Dev.

    Don't take this as me attacking either side, just voicing an opinion :)
     
    Last edited: Mar 14, 2015
    OnePxl likes this.
  10. alphakanal

    alphakanal

    Joined:
    Jan 21, 2013
    Posts:
    52
    Everything was gone after deleting the complete temp + library folders and restart unity:)

    Yes, it would be a good improvement to be able to set the Night Start and End Value as a puplic var in the cycle or so!
     
  11. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    First of all, I'm sorry if any of my answers here sounded unfriendly or unhelpful to you Olander. That certainly wasn't my intention. I do keep my replies in here short and to the point in an attempt to keep the thread clean and help people find the right answer to their question.

    Correct, you find three floats:
    • TOD_DayParameters.LightIntensity (== Day.LightIntensity from the TOD_Sky inspector)
    • TOD_NightParameters.LightIntensity (== Night.LightIntensity from the TOD_Sky inspector)
    • TOD_Sky.LightIntensity (getter only, lerps from day to night, basically just returns TOD_Components.Light.intensity)
    From your first question I got the impression you wanted to get the current light intensity, which can be done by either accessing LightIntensity or getting it directly from the Unity light component. Then you clarified that you wanted to get the day and night values separately, which are Day.LightIntensity and Night.LightIntensity - which I mention in my second reply.

    It's correct that sky.Light does not exist if sky is a reference to TOD_Sky and not TOD_Components - but I got the impression that in your first question ("sky.Light.Intensity does not exist") you were talking about the ".Intensity" part, which in fact has to be ".intensity" when accessing it from TOD_Components.Light, which is a reference of type UnityEngine.Light. It seems like this was a simple misunderstanding.

    I'm sorry if you feel offended by me pointing you to the docs, but the two parameters you were looking for are 2 of the 3 entries that come up when you search "LightIntensity" in the docs, and the current interpolation between those two parameters is the third entry. I wasn't pissed off by the question, but it has to be allowed to redirect to the docs where appropriate, even if it's just to let people know that they can find more information in there.

    I'm sorry but I don't understand where you're coming from here. I can only imagine you're misunderstanding what I was trying to say. You quote my two replies:
    1. "I don't control the scene fog density settings at all. Only the color is adjusted." == Time of Day does not adjust the fog density + Time of Day adjusts the fog color
    2. "It's setting the color but not the density." == Time of Day adjusts the fog color + Time of Day does not adjust the fog density
    How are those different from each other? Time of Day does not modify the fog density parameters of RenderSettings. It does adjust the fog color if Fog.Mode is set to "Color" or "Directional" - which is why you have to set it to "None" if you want to adjust the color yourself in your script.

    There's no need to hack the code, everything you're trying to do can be done without modifying the existing code at all. I'm sorry you feel like my code is hard to follow. You're the first person that feels this way, but I'll take your remark into consideration for future development.

    Thanks for your interest in Time of Day and for the work you're putting up for free. I tried to answer all of your questions to help you with the development of your weather solution. I cannot comment on the system itself since I haven't checked it out yet. Howver, if you have any more questions I'll do my best to answer them.

    I don't feel like the forums are a pain. I'm answering all questions in here to the best of my abilities until each specific issue is resolved. I won't deny that I'm busy as F*** right now and that the time between my replies in here has increased over the last few months - I used to check the forums daily, now it's closer to twice a week. This is partially due to the fact that email notifications seem to be very unreliable since the last forum update, so I have to remember to regularly check the thread myself instead of being notified by email every time someone posts in here.

    Thanks for reporting back, good to hear the issue resolved itself.
     
    Olander, OnePxl, Veljo_Hagu and 2 others like this.
  12. Olander

    Olander

    Joined:
    Sep 13, 2014
    Posts:
    405
    Apologies accepted and please accept my apologies as well. I am not going to quote anything **swallowing pride**....let's just accept them as misunderstanding.

    And yes....after doing forums for private NWN servers for 10 years to support things.....there are a pain. :)

    By the way....Lighting and Fog is working very well...Unity 5 Global Fog is simply horrible. I had to add a ground fog but it has turned out very well.

    Cheers
    O
     
    elbows likes this.
  13. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    I love a happy ending. :)
     
    Don-Gray, Paulohmm, snowcult and 3 others like this.
  14. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
  15. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    I'm so digging this plugin - I'm updating to Unity 5 and just having a bit of trouble getting my head around how it works in 5. In particular, the ambient colour gradient - I noticed by default it's set to a pretty ugly brown... any reason for this? I changed it to a nice blue grey and it looked a lot better.

    Can you clarify what the gradient corresponds to? ie - is it transitioning over time, over a distance, world space etc?

    Finally, with the new method of applying fog to a camera as an image effect, is the color still linked to the plugin somehow? Or is there a better way of doing fog in 5 with ToD?

    Thanks, this stuff is brilliant.
     
  16. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    It's the same ground color the default skybox in Unity 5 uses. If you set the ambient light to one of the new modes (gradient or spherical harmonics) it'll be used as the ground color and the upper hemisphere uses colors from the sky dome. In flat ambient light mode it's working the same way as Unity 4, which means a slight blueish gray might look better. This is really just a legacy mode though, I recommend using one of the new ambient light modes.

    There are tooltips for all the inspector variables now, when you hover over "Ambient Color" you will see: "Interpolates from left (day) to right (night)", which is true for both the day and the night gradient. The results from both gradients are in turn blended together according to the altitude of the sun.

    The default "Global Fog" image effect uses the scene fog color, which is set by TOD. This isn't the best solution however, since the color will be constant for every position, though it can depend on the view direction if TOD is set to "Directional" fog mode.

    For better results I included a scattering image effect that can be added to your camera via "Component -> Time of Day -> Camera Scattering" which does atmosphere and fog in a single pass as an image effect, which means per-pixel color calculations. This image effect isn't great in 3.0.0 yet as the fog (or aerial perspective) density increases linearly from the camera to the far clip plane. Update 3.0.1 will add a density parameter and a height falloff value and use the Cry Engine fog density calculation for pretty amazing results.
     
    hopeful, Paulohmm and elbows like this.
  17. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Ohh sounds great, any rough timeframe for 3.0.1 release then?
     
  18. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    I'll submit today. Asset Store review usually takes around 2 days.
     
    elbows likes this.
  19. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    The changelog for version 3.0.1 can now be viewed here: http://modmonkeys.net/dat/doc/timeofday/#changelog (you might have to refresh)

    The web player demo was also updated, though the visual differences are fairly minor: http://modmonkeys.net/dat/pub/timeofday/

    For a fix release 3.0.1 is pretty big, but there shouldn't be any breaking changes. I already got a couple of nice ideas for 3.1.0, the biggest of which is a pretty neat way I came up with to render real-life star constellations. No ETA on that yet though.
     
    snowcult, elbows and hopeful like this.
  20. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Awesome, thanks for the tips.

    I've noticed a few weird bugs in Unity 5, just wondering if you'e come across them?

    1) Randomly the sky turned monochrome (black and white) in editor and play mode. Re-importing the asset fixed the issue.
    2) Sometimes my sun & moon meshes randomly disappear, along with the star map. Re-importing doesn't seem to fix the issue. As a matter of fact, I'm not too sure how to get them back once they disappear! I can see them fine in the editor (even during play mode), just not in the camera views.

    Thanks, can't wait to try out the new version!
     
  21. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Never heard of that one - did the reimport fix it once and for all or merely temporarily?

    This sounds like you have your camera set to "Skybox" clear flags. This is not supported and redundant when using a custom sky dome, so use "Solid Color" instead. Version 3.0.1 will take care of that for you.
     
  22. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    I noticed something similar in a project that I upgraded from Unity 4.6 to 5, maybe it's related? In a small project where I'm using a simple skybox, I decided to import the old skyboxes from 4.6 standard assets. Then I upgraded the project and noticed the sky had these "black holes" in random spots. Looking at the 6 skybox textures, I found that they needed to be re-imported to be compatible with HDR. After doing this, the skyboxes looked fine again.

    So, perhaps these issues mickyg mentions are HDR related?
     
  23. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I'm testing the 3.0.0 on 4.6 and I had a problem with the night ambient color. It's always too dark. In the code I saw that you multiply the Night.AmbientMultiplier by the Night.ColorMultiplier * 0.25
    While this seems fine for all the other settings (moon light, rays, sky color, etc.) for the ambient is very heavy.
    I believe that all that values are already customizable and also affected by the Night.ColorMultiplier (that could be set easily to 0.25 by the user if needed).
    My workaround now was to multiply back the Night.AmbientMultiplier by 4 so to don't affect all the other values.
     
  24. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I'm setting up a day/night cycle where i need nighttime to be pretty bright (no other types of lighting), so I've boosted the Night: Light Intensity to 3, and that works just fine. However, at dawn and dusk, the scene goes completely black--I guess because neither the sun nor the moon is shining any light on the scene. I can't figure out how to boost lighting at those times. Any tips?

    thanks
    Dave
     
  25. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    3.0.1 is in the store now, just about to try it :)
     
  26. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Neat.
     
  27. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Okay, you've got me excited. I was going to ask about that the other day and forgot, as I'm doing a region specific world where constellations would add in some awesome subtle detail.
     
  28. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Your questions seem to be related. Ambient light should handle the transitional period, and apparently I'm forcing ambient light to be too dark. This indeed appears to be caused by the 0.25 multiplier you mentioned, which should indeed not be present in the ambient light equation. I'll make sure to release a 3.0.2 update in a couple of days to address this. I'll just wait a few more days to give people some time to test 3.0.1 and see if there are any other issues I'll have to fix.

    Until then the brightest ambient light you can get at night is achieved by making sure the "Ambient Color" gradient is a bright blue (rather than the dark blue it's set to by default) and "Ambient Multiplier" is set to 1. If that's not enough and you need a fix before 3.0.2 you can adjust line 474 of TOD_Sky.cs and temporarily increase the multiplier there, or alternatively remove the nightBrightness multiplier from that line altogether. Sorry for any inconveniences this may have caused.
     
  29. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thank you :)
    I love the 3.0. The graphic quality is so much better than previous versions.
    Only one thing. I took me a lot of time to understand how the gradients work and how to should be set. I search in the forum and in the guid, but I can't find any info. So I went by trial and error till I realized the logic behind them.
    Maybe could be useful to document it.
    The same for the TOD_Time curve. I still have many problems to get just a shorter night.
     
  30. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    The black and white was a once off - never seen it again after I re-imported.

    The camera was indeed set to 'Skybox' so I've fixed that and it works fine. Thanks a lot for the prompt support you give here, it's much appreciated.

    Now to download 3.0.1 and have a play!
     
  31. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I love the fog in 3.0.1, nice work :)
     
  32. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Thanks, that (the latter) did the trick! (though in my copy of TOD_sky, that line was 423 instead of 474.)
     
  33. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Anyone using Alloy Physical Shader Framework with Time Of Day?
    Using the Alloy Core shader in Cutout rendering mode, looks fine, except it doesn't show the TOD sky dome when looking through it. Normal objects do show, just not the sky.
     
  34. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845
    Has anyone used this with Android, I plan to buy this but for Android if it works and performs well. Thanks for any information.
     
  35. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    yes we use it on android and it works very very well on any device.
    I was just testing the sun shafts and it seems that it requires 32 bit buffer to work.
    The performance and the quality are amazing.
     
    Last edited: Mar 19, 2015
  36. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Do you have any specific suggestions in that regard? I can see how the TOD_Time curve is confusing - I should add images to the explanation in the docs. The description of the gradients (if you hover over them) says they interpolate from left (day) to right (night), which seems pretty straightforward to me. However, I realize that I programmed the feature, so I probably don't have the best judgement on that. How would you explain them to someone who never used them before? Would it be a good idea to give them their own section in the docs, maybe with an example and some images?

    Are you on the latest version of Unity and TOD? I know someone who had this issue with his cutout shader, but for him the issue resolved itself after updating. A Unity library rebuild might also help.

    As mcmorry said, Time of Day is extremely optimized. Should you target very old mobile devices there are also quite a few parameters you can dial back, which allows Time of Day to perform perfectly even on very demanding devices like the iPhone 4.
     
  37. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I didn't expect to see tooltips hovering the settings so I didn't try. Anyway the documentation is always the best place to access all the features, in detail, with some screenshots in this case.

    The tooltip of the sky says "interpolate from left (day) to right (night)", but actually it doesn't work like this (or at least this is what I understood). The leftmost color is applied during all day and the gradient is used just for the sunset and also for the sunrise (going from right to left). So the gradient cover only about 2 or 3 hours (depending on the latitude value), and not the whole day.
    I was personally expecting to have the gradient covering all the day hours from the early morning to the evening, linearly (about 12 - 16 hours for the day). So for example the left could correspond at 5am (just when the day start), the center to mid day, and the right would be the end of the day. This would also allow to set different colors for sunrise and sunset.
     
  38. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Apologies if this has been covered; I scanned the last few pages of the thread and didn't see it.

    Anyway, I upgraded to Unity 5 and have ToD 3.0.1, and I'm using the GlobalFog image effect new to Unity 5. The issue I'm running into is that fog no longer obscures the skybox. So if I set the global fog to 1, it obscures all of the geometry around me but I can still see the skybox crystal clear.

    I've tried increasing the Atmosphere.Fogginess value to 1 as well, but it just makes the skybox a solid color (obscuring the clouds and sun), but it still isn't affected by the global fog.

    I know that there were some big changes to the fog system in Unity 5, but am I missing something I should be doing if I want global fog to also affect the skybox? In Unity 4.6, I had everything set up so that fog obscured the ToD skybox as well.
     
  39. weasel47

    weasel47

    Joined:
    Mar 9, 2014
    Posts:
    26
    Is it possible to make the new Scattering effect play nicely with Horizon[On]? The Horizon[On] geometry seems to get treated as if it's infinitely far away, getting fully-fogged by the Scattering effect. I don't know which asset would need to be modified for them to work together better...
     
  40. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Note taken. It used to work as you suggested, but I felt like it would be easier to have a constant color for the entire daytime. Having different colors for sunset and sunrise is a decent point though, so I might switch back to the way you suggested.

    Fog always worked that way. If fog were to affect the sky dome (objects in infinity) then the sky dome would always receive maximum fog and look extremely weird next to slightly fogged objects in the foreground. You can use the TOD_Scattering image effect to have smooth transitions from fog color to sky color and add a slight additional colored fog using the Unity fog image effect. You could also look into something like fog volumes to fog certain parts of your scene.

    The scattering image effect, as any fog-like image effect, requires proper depth values on any objects it affects. This is something you'd have to discuss with the author of Horizon[On]. The alternative would be to exclude Horizon[On] from fog altogether by rendering it after "ImageEffectOpaque" image effects - something almost all shaders that don't write to depth should do.
     
  41. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    3.0.1 should now use the queue setup that guarantees best compatibility. I'll post my findings and thought process here for reference, it might be useful for your asset as well. (Source)
    • Unity Background (1000)
    • Space: Background+10
    • Sun: Background+20
    • Moon: Background+30
    • Atmosphere: Background+40 (Only rendered if TOD_Scattering is not used.)
    • Unity Geometry (2000)
    • Unity AlphaTest (2450)
    • Unity ImageEffectOpaque (Directly after Geometry+500, since everything up to that point is considered opaque by Unity and should write correct depth values. This is for example used by fog image effects. If TOD_Scattering is used both aerial perspective and the atmosphere are done here as a combined image effect, and they assume everything that has been rendered before either wrote to depth or is intentionally considered to be at infinity, like the Time of Day space, sun and moon objects.)
    • Clear Alpha: Transparent-480 (Only rendered if TOD_Rays is used. Assures the alpha channel is cleared before rendering transparent objects so that god rays can properly get blocked by transparent objects that don't write to depth but do write to alpha.)
    • Cloud Layers: Transparent-470
    • Cloud Billboards: Transparent-460
    • Unity Transparent (3000)
    • Unity ImageEffect (This is for example used by god rays.)
    I hope this explains the exact reasoning for every queue position. There's not any wiggle room for any individual part of this as far as I can see, other than "Clear Alpha", "Cloud Layers" and "Cloud Billboards" can be anywhere between "ImageEffectOpaque" and "Transparent" - so the exact offsets for those are somewhat arbitrary, I just thought it would be best to render them as early as possible relative to all other transparent objects. I might even offset them by an additonal -10 in one of the next releases for them to directly follow ImageEffectOpaque (which is hardcoded to come after 2500 aka Geometry+500 aka Transparent-500).
     
  42. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    Ya that was why I asked about Android, I have seen some assets work great with Iphone, but not so great for certain Android, also HAVE wasted enough money on assets just to find out there are not great, or they aren't working for my game the way I want. This is not a hobby so being and indie, I need to watch the money I spend and make sure its worth it...
     
  43. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    845

    Thanks.
     
  44. charnold

    charnold

    Joined:
    Mar 31, 2014
    Posts:
    31
    Problem: no time of day skydome rendered on iOS Device (but correctly rendered in iOS Simulator and unity editor)

    I've tested this with a small project (new unity project with the time of day prefab and a cube added).

    Time of Day Version: 3.0.1
    Unity 5.0.0p2
    iOS Device: iPhone 5s iOS 8.2 (12D508)

    Test-Project:
    https://dl.dropboxusercontent.com/u/56014495/TimeOfDayTest.zip

    Screenshots:

    iOS Device:


    iOS Simulator:
     
  45. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Loving the new skies and scattering in the latest time of day :)
     

    Attached Files:

    hopeful likes this.
  46. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Thanks for the repro project. I can't reproduce your issue on my iPhone 5. However, I do see the sky dome getting clipped a bit at the far clipping plane, which disappears with a dome scale factor of 0.9 on the TOD_Camera script - so please give that a try and report back. Should it not work, try commenting out the line Offset 1000, 1000 in all shaders, since that's the only change in 3.0.1 that might explain something like that.

    Nice, great to hear you like it!
     
  47. charnold

    charnold

    Joined:
    Mar 31, 2014
    Posts:
    31
    - a dome scale factor of 0.9 made no difference
    - commenting out offset 1000, 1000 in all shaders solved the problem!
     
  48. andererandre

    andererandre

    Joined:
    Dec 17, 2010
    Posts:
    683
    Thanks for reporting back so quickly. I'll revert the offset value in 3.0.2 then (which I'll submit to the Asset Store either today or tomorrow) until I figure out why it's causing that problem on some hardware.
     
    OnePxl likes this.
  49. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Could you provide a little more detail on how scattering works? The documentation doesn't have any information on what it does; it's just an auto-generated line. There's no explanation of the variables inside the script.

    When I play around with values, it just seems to increase the sun's horizon glow, but doesn't do much to the rest of the sky.

    Also, to back up a few steps, the problem I'm trying to solve is that when I increase fog in my scene, the skybox is really bright against otherwise fogged objects, and it looks weird:

    Screen Shot 2015-03-23 at 10.06.59 AM.png

    Are there other knobs I could be turning to make that look more consistent, even if I'm not relying on GlobalFog to do it? I just want to get a consistently foggy look across the scene, and have it apply to the sky as well. If there are other ways to achieve that effect, I'm game.
     
  50. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Another quick question: how do I get this to apply to clouds? I was able to crank the values up enough to get good fogging of the skybox (combo of Atmosphere fogginess and Scattering Global Density), but even when they're both cranked to 1 the clouds still show:

    Screen Shot 2015-03-23 at 10.19.14 AM.png

    Is there something I should be doing to affect the clouds as well?