Search Unity

TENKOKU - Dynamic Sky

Discussion in 'Assets and Asset Store' started by chingwa, Apr 12, 2015.

  1. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Came across these sun set time lapses, might be useful :)
     
  2. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hey Guys,
    I've been away traveling for the last week so I apologize for the delay in getting back to everyone. I'll go through and answer questions below...

    @Kenaz
    This is hardcoded in Tenkoku based on the overcast amount, it tries to model the more diffuse light coming from overcast skies. I'll see about doing diffuse lighting with a different technique in the next update, but if this is really a problem for you then you could comment out line 2147 in the TenkokuModule.cs script...
    Code (CSharp):
    1. //lightObjectWorld.shadowStrength = Mathf.Lerp(1.0f,0.25f,weather_OvercastAmt);
    @Ludo97
    In order for time to move make sure you have 'Advance Time' checkmark on and the multiplier set to 1 or greater. Though to really notice time moving this will have to be much higher... like 20 or 100.

    @TheEndersWAR
    That cloud ref is great. Tenkoku doesn't do true volumetrics, though I've been looking into this possibility in the future. It's a bit too early for me to speculate much about this though. You could possibly use other volumetric cloud solutions or mesh cloud assets, though you'd need to tie these into the tenkoku weather and lighting yourself.

    @Apolyon6k
    Multiple suns is not impossible to do, but Tenkoku is not setup for it "out of the box". Since it assumes an earth-based sky you would need to do a bit of code-hacking in order to get this working properly. Adding a second sun object would be fairly easy, but getting custom movement and tying it into lighting would involve some custom coding.

    @FractalCore
    Actually I just double-checked this in the C version and it' busted, you're right (though this should still be working in .js version). I'll get this fixed for the next update... sorry 'bout that! Also looks like you're right about the probe sizing as well. I'll double this up.

    @veddycent
    Thanks for the link, some of those sunrises are gorgeous :)
     
    Kenaz and BackwoodsGaming like this.
  3. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Possible bug, maybe a use case issue. When using the newest version in non-Multi Lighting mode it cuts the sun Light_World out about 5-10 degrees above the horizon. If running in Multi Lighting the sun works fine, but then the moon has no light at all.
     
  4. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @CaptainMurphy Hmmm... can you give me a specific date/time/latitude to test? I'll see if I can find out what's going on.
     
  5. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    All I did was import Tenkoku Dynamic Sky 1.1.0a then drag the Tenkoku DynamicSky prefab into my scene. From what I can tell, all the relevant scripts are in C#. You mean there's an option between Java and C#?

    How do I get a Java version?
     
  6. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @FractalCore So here's the thing, Tenkoku was originally in .JS up until this current version, which is now in C# by default. There is a .JS version of this release available for registered customers from my website, but this is the last version that will be available in .JS... all further development will be in the C# version. If you'd like to use the .JS version instead you can register for free download access here: http://tanukidigital.com/tenkoku/index.php?register=1

    So, I wouldn't call it a substandard version, it just has an error that the original js version doesn't have. I can probably fix this sometime today... if you send me an email at konnichiwa[at]tanukidigital I can send you a small patch for the C# version that addresses these errors. :)

    EDIT: (Nevermind, the .JS version is busted too... just double-checked)
     
    Last edited: May 13, 2016
  7. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Here is a new project, added Tenkoku and AQUAS and that is all. Using stock prefab, no changes other than time. I did, however, repeat this with multiple latitudes and it is the same for all.

    At the final point where the light is on you can see the specular in the water.



    A minute later the light is turned off and the specular is gone.



    Not a massive deal and isn't huge for using AQUAS, but with Ceto it is massively obvious that the specular disappears at sunset.
     
  8. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @CaptainMurphy Thanks for the details! I have this fixed and will email you a patch.

    @FractalCore I now have a patch that will fix this in the C# version. Email me and I'll send it to you.
     
  9. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @chingwa The patch worked perfect, thanks!

    I meant to mention this before, but you may want to set Tenkoku_DecodeData to be public. Kinda hard to get to it otherwise. ;)

    So far I gotta say the swap from using the JS to C# asset was completely painless. Great job!
     
  10. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
  11. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Ok @chingwa, next bug. Now that the sun goes down ok it doesn't make the moons light align correctly. With these settings there is no moon lighting.


    I found that by checking "Allow Multi Lighting" that it turns on the moon light.


    Now, the scene is stopped, Multi Lighting is checked and saved and the scene restarted.


    If I uncheck and re-check Multi Lighting it works again.
     
  12. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Thanks @CaptainMurphy I sent you a fix for the moon lighting not turning on correctly. But note that with multi-light turned off there won't be pixel lighting effects (such as specular or shadows) from the moon lighting. In general I recommend multi-lighting to be turned on, but it does cause some increased performance cost so those who have performance issues may want to keep this off.

    The first image you posted above is not offset moon lighting, it's just the moon object reflection in the water (which is what I would expect when multi-light is turned off).
     
  13. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    That was actually part of a message I had started typing, then found that another asset had hidden a directional light pointing straight down that wasn't visible except at night. :rolleyes:

    I sorta expected the first behaviors, but the switching off/on was a new one, lol. The patch worked perfect, though. Thanks!
     
    chingwa likes this.
  14. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I've only had time to try it briefly so far but there did seem like quite a lot of potential to get kode80's volumetric clouds working with Tenkoku. When I turned the cloud colour settings for kode80's clouds to very dark colors they started to match up quite well with the sky colours of Tenkoku, though I'm sure something more could be achieved by even a very simple integration between the two. The other advantage of kode80's clouds is that the source is available and although a commercial license should be obtained for relevant uses of their clouds, it is so easy to try them out for free.

    https://github.com/kode80/kode80CloudsUnity3D

    If you are interested in providing your own solution built into Tenkoku one day then I just noticed the most excellent Keijiro Takahashi has made and shared a cloud system that works via a heavily modified procedural skybox shader:

    https://github.com/keijiro/CloudSkybox
     
    chingwa likes this.
  15. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Thanks @elbows ! I had taken a look at integrating the kode80 clouds, just for kicks. It seemed to work nicely but I found the clouds cost too much in performance (at least the early version I tried) and decided to look at them again at a later date. I've looked at everything keijiro has posted on that github... but of course as soon as I don't look at it for a week he goes and posts clouds! :D Thanks for the heads up... I'll take a look at this soon.
     
  16. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
  17. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    Hi, I recently bought Tenkoku but I couldn't find a pdf document (though most of it is self-explanatory). I was wondering if we are able to add lens flares to the sun, and if so, how, because I can't seem to find where the actual light source is coming from.
     
  18. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Deckard_89 You can find documentation here:
    http://www.tanukidigital.com/tenkoku/documentation/tenkoku_documentation.pdf

    That being said I don't think it talks about sun flares. The best way to add one is by going to the Tenkoku-->SkySphere-->LIGHT_World object and adding it to the "Flare" slot. There is an included flare texture included with Tenkoku under Textures/Lightflares... but it has not been setup on the light. You can use this one or use your own. I have plans to do a pixel-based light flare in the future that works better with occlusion than standard unity flares.
     
  19. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
  20. NoobTaco

    NoobTaco

    Joined:
    Mar 24, 2015
    Posts:
    18
    Is the Speed Curve working in the latest (c#) build? I can't seem to get it to work no matter what I try.

    I am trying to do a 24 hour day cycle in one hour real time. I want 40 day and 20 Night in my cycle but nothing I try seems to work.
     
  21. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @NoobTaco The speedcurve is bugged in the current version. Send me an email at konnichiwa[at]tanukidigital.com and I can send you a patch fix for this.
     
    NoobTaco and Bagnol like this.
  22. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @chingwa Would you say the bug was...unfore-C-n?
     
    chingwa likes this.
  23. TD10074405

    TD10074405

    Joined:
    Aug 23, 2014
    Posts:
    35
    @chingwa I have a weird issue in Unity 5.4Beta, when ever I change a setting and then run the game with "Dynamic sky prefab" attached I get a whole host of errors relating to "load" not being allowed to be called from a monobehaviour on the editor script, if I set the time to system time and date it has less issues but they're still there, it freezes the game and pauses it (in the inspector) however if I click the unpause button it will continue, however if I pause and go into settings to change anything it will start giving me a huge amount of errors again.

    Errors are as follows:
     
  24. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Bagnol It wasn't completely unfor-C-n, as it's also bugged in the original version as well. I've been trying to think up a JS related pun for the last 5 minutes but have failed. I think you win this round! :D

    @TD10074405 Aren't betas wonderful? I'll take a look and see if I can figure out what's going on. I don't usually support Unity betas though as they are constantly breaking things that ought naught be broken. I assume you're using the C# version of Tenkoku 1.1.0? Thanks for the heads up!
     
    Last edited: May 19, 2016
    TD10074405 and Bagnol like this.
  25. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Hi chingwa,
    I'm using speedtree to render my trees and I'm having a slight issue with lighting at night time. My billboards are receiving correct lighting from the night but the loaded in trees are in full shadow and not updated when I change the moon light settings. Is there a workaround for this or is it a bug?
     
  26. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @wightwhale I'm not sure what the issue is here... it might possibly be an issue with the included reflection probe, which you can turn off under the Tenkoku configuration tab, just to see if ti makes a difference. If you can post or email/PM me a screenshot or video it would probably give me a better idea what's going on. I haven't seen any issues with speedtrees here on my end, so I'm sure we can figure out what the problem is.
     
  27. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I tried toggling the reflection probes but it doesn't seem to do anything. I noticed when I change the day of the month from 6 to 9 the nearby trees are not lit but the billboards are. Image 2.png Image 3.png Image 4.png
     
  28. TD10074405

    TD10074405

    Joined:
    Aug 23, 2014
    Posts:
    35
    @chingwa I am indeed using the C# version, didnt know I could download any other (not that I would, everything else is in C# so why would I?), I just downloaded the latest version from the store again and still no joy. I did happen to run a clean build (and cleaned the assembly/build in Monodevelop) last night and not get any errors for a while until I started playing with settings, one setting triggered it again but not sure which one exactly!

    I both hate and love Beta's 1 hand Beta's are great for showcasing new software, methods etc on the otherhand some companies including Unity appear to like to change drastic things between x.3 and x.4 Beta versions!

    And no worries, thought I'd give you a heads up now rather than in a few weeks/months when the full 5.4 was out and causing this for hundreds of people!
     
  29. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @wightwhale Do the billboards update after you move the camera a little? There is an (annoying) issue with billboards only updating when they detect a new camera position... I assume it's a performance setting so that they aren't just updating themselves all the time. The problem is this is built into the bowels of Unity and they don't expose an option for this. There is a way to force update billboards through code (at least there used to be) but it does indeed cause some performance issues. I haven't done this in a long time though (this problem has been around in Unity for YEARS). I'll dig around my files and see if I can find the code.

    @TD10074405 Yeah Thanks. I have an idea what is causing this and hope to have an update soon... definitely before the beta reaches full release stage. (there is a JS version available, but only for this current version. It will have the same issue in the beta I'm sure. Future updateswill be in C# only, so no reason not to stick with the main C# version).
     
  30. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Yes I know about that issue, but that's a different issue. The issue I have is the close up trees (non billboard) aren't getting any light from the moon light amount. The sun rendering works great, when I slide the light amount up and down it updates the close trees as well as the billboard trees. However when I slide the light amount on the moon rendering the close trees don't change with the light amount value.
     

    Attached Files:

  31. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @wightwhale Oh I see. Hmmm. The first thing I would try is to set "Allow Multi-Lighting" to on in the Tenkoku configuration panel. Then just to make sure it's working right check the Tenkoku-->SkySphere-->LIGHT_NightSky object and make sure the "Render Mode" is set to "Important". After doing this do you still have the same trouble with the moon lighting?
     
  32. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I don't see that setting for allow multi lighting.
     
  33. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    oh i see it in your patch notes i'll update to the newest version
     
  34. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I updated, thanks for making it c# now btw, don't need to put your plugin in standard asset folder anymore. And when I updated the problem was fixed. I did however notice that when I did check allow multi lighting the error returned. So my issue is 'fixed' but it appears the issue persists.
     
  35. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Glad it's all working for you now! :)
     
  36. impactit

    impactit

    Joined:
    Jan 28, 2015
    Posts:
    41
    Hey

    I have a strange problem with shadows on the characters of MORPH 3D, shadow to the ground seems to be incomplete. This happens only when "TENKOKU Dynamic Sky", each different type of light gives corect shadow. Any ideas how to solve this problem.

    Screens here

    Another problem, as you can see in the screenshot, is performance. The number of frames is reduced by almost half (!!). Any ideas how to fix it?
     
  37. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @impactit The shadow can be fixed by going to the Tenkoku-->SkySphere-->LIGHT_World object and lowering the 'bias' setting. I'll make sure this is lower by default in future updates.

    Performance is probably being affected by the built-in reflection probe. In the Tenkoku 'configuration' tab you can either lower the probe update FPS setting, OR you can disable it entirely. Reflection probes are usually necessaryin Unity 5 which is why I included it, but you may be able to disable it in your scene and setup your own probes if necessary. You can also edit the Tenkoku-->SkySphere-->Tenkoku_ReflectionProbe object to render fewer layers, which should also increase performance (depending on the objects you have on those layers).
     
  38. impactit

    impactit

    Joined:
    Jan 28, 2015
    Posts:
    41
    I played with options including disabling 'reflection probe' but I do not see much difference. I will examine this issue, because it is crucial for the entire scene :)
     
  39. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    Hi, is there an easy way to get the current moon phase? Im trying to setup UI to show whether it is waning, waxing, full, or a new moon. I tried a few of the public variables that have moon in their name but nothing seemed to change when I was moving the day slider around. Thanks
     
  40. slukac

    slukac

    Joined:
    Apr 24, 2016
    Posts:
    1
    Hi!

    Is there any way to change the intensity of the shadows? I've loaded a model in my scene (lit with the tenkoku dynamicSky settings) but when I get to the shadow side of the object, the model is virtually black. I've tried to change the settings in Tenkoku DynamicSky / SkySphere / LIGHT_World / (Shadow) Strength. But the setting can't be changed.

    Am I doing something wrong or is there another way to get the shadow intensity down?
     
  41. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @judah4 This is interesting... Tenkoku doesn't actually calculate a value for the Moon Phase because the moon is automatically lit based on the relationship between it and the sun position. There is a way to calculate the phase mathematically though, by getting the angle between the current positions. I'll add a moonPhase variable to the next update, but in the meantime you can use the following to calculate this on your own...

    Step 1) You need to declare a couple variable to be public so you can do some calculations with them outside the Tenkoku component. Open up the TenkokuModule.cs file (under /scripts) and search for the following two values around line 143:
    Code (CSharp):
    1. GameObject sunlightObject;
    2. Transform moonObject;
    These need to be changed to be public like this:
    Code (CSharp):
    1. Public GameObject sunlightObject;
    2. Public Transform moonlightObject;
    Step 2) Now outside Tenkoku in your own C# component you can compare these and calculate the phase like so:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CalculateMoonPhase : MonoBehaviour {
    5.  
    6.     public float moonPhase;
    7.     public float moonAmt;
    8.  
    9.     private Tenkoku.Core.TenkokuModule tenkokuModule;
    10.  
    11.     void Start () {
    12.         tenkokuModule = GameObject.Find("Tenkoku DynamicSky").GetComponent<Tenkoku.Core.TenkokuModule>() as Tenkoku.Core.TenkokuModule;
    13.     }
    14.  
    15.  
    16.     void LateUpdate () {
    17.  
    18.         //Calculate Moon Coverage
    19.         moonAmt = Quaternion.Angle(tenkokuModule.sunlightObject.transform.rotation,tenkokuModule.moonlightObject.transform.rotation) / 180.0f;
    20.  
    21.         // MANUAL QUATERNION ANGLE CALCULATION
    22.         // We do this instead of Unity's Quaternion.Angle() function because we don't want it automatically clamped.
    23.         Quaternion res = tenkokuModule.moonlightObject.transform.rotation * Quaternion.Inverse(tenkokuModule.sunlightObject.transform.rotation);
    24.         moonPhase =  (Mathf.Acos(res.w) * 2.0f * 57.2957795f) / 360f;
    25.  
    26.     }
    27. }
    The above code sets the moonPhase as a float between 0.0 - 1.0...
    0.0 = new moon
    0.25 = waning moon
    0.5 = full moon
    0.75 = waxing moon
    1.0 = new moon

    It also gives a value for the overall coverage of the moon from 0.0 - 1.0 (moonAmt). This is useful to determine how much light the moon is reflecting, where 0.0 would be a new moon and 1.0 would be a full moon.

    Hope this answers your question, and again I'll have a moonPhase variable built in for the next update.
     
    judah4 likes this.
  42. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @slukac In the current version the shadow intensity is automatically clamped. However I have a small patch update with this and a few other fixes, if you'd like to try it then send me an email to konnichiwa[at]tanukidigital.com
     
    ksam2 likes this.
  43. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    Thank you! This seems to work except sometimes around dawn something happens and the value inverts. I noticed when the phase was around .6 and suddenly switch to .3. I was able to do it again when the game time was set to 6/21/2015 transitioning from 3 am to 4 am.
     
  44. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hmmm... I'll test these values and see if I can narrow down the issue!
     
    judah4 likes this.
  45. Pyroman311

    Pyroman311

    Joined:
    Aug 14, 2010
    Posts:
    87
    I apologize if this has been asked before but, how do you have both sun and moon shafts? Adding two "Sun Shafts" scripts no longer works.
     
  46. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Can we adjust ambient light intensity? does the ambient supports gradient mode?

    Can we stop time?
     
  47. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Pyroman311 You're right! I'll look into this for the next update. In the meantime you can add a standard Unity Flare effect and use the LIGHT_Moon object as the position reference point.

    @ksam2 Yes you can adjust the ambient light intensity and tint (using the ambient tint color, under 'configuration'). Currently it only supports single-color ambient. I'll look into adding gradient ambient and inheriting the sky color soon. Time can be stopped completely, slowed down, or sped up as you need it... use the 'advance time' checkbox and set a timespeed multiplier.
     
    ksam2 likes this.
  48. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    How should I change directional light color? I can't find it
     
  49. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Crossway the directional light in Tenkoku is automatically adjusted based on time/date etc. You can edit the brightness of it under the sun settings in 'celestial settings'. You can also adjust some of the overall tinting under 'configuration'. However if you want to specifically adjust only the sun lighting color then you need to open and adjust the color ramp texture listed as 'color texture' under 'configuration'. This texture controls color gradients over time for different aspects of the system.... you can adjust just the sun color gradient if you need to.
     
  50. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Hi Chingwa,

    I finally broke down and bought Tenkoku but having some issues. They may be conflicts with shaders I have in my scene.

    First of all, I am having the terrible dark black shadows that were mentioned above.

    Also, the light from Tenkoku seems to wash out my terrain, making it all a yellow color. I have tried changing the lights, ambient and whatever, but doesn't see to help. The shine is horrible, as if my terrain is flooded.

    I do use Distingo so maybe that is the problem. How does RTP work with Tenkoku?