Search Unity

TENKOKU - Dynamic Sky

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

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Thank you, that's very helpful!
     
  2. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    210
    Hey @chingwa I'm looking into making a custom time date format with Tenkoku. I want to have just 4 months, January, April, July and October and each of these months would only have ~10 days in them. The idea is to put the 4 seasons into the game which would be represented by those 4 months. The reason why there would be only 4 months with 10 days each is because it simply takes too long for a whole real life year, even with a speedup of 72, to pass.

    How would I adapt the scripts to work that way? My main problem is transitioning between the months without teleporting the sun and other celestial problems as well as reducing the number of days in a month. I took a look at the TenkokuCalculations script but I'm not sure where to start. The thing is that I want to keep the realistic features that each of the months provides or is being influenced by, such as longitude, latitude, celestial positions and so on, while at the same time removing the rest of the months of the year. Any idea where I could start?

    I managed to reduce the number of days in a month to a flat 10 by changing the RecalculateLeapYear method's monthLength variable. However as expected, that makes the sky skip across several frames when going from day 10 to 1, likely due to the TenkokuCalculations script
     
    Last edited: Aug 24, 2019
  3. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hi @Radu392 This is indeed an interesting problem. The option to compress time is built in but this only factors time on a day by day basis. It is a good idea to also include the ability to compress the entire year. This introduces some challenges however due to the way the TenkokuCalculations component arrives at it's positioning information.

    Internally Time and date info is plugged into the calc component, and an azimuth and altitude value is output back to the system for each celestial element. Without having sat down and done some programming tests, I would guess what needs to happen is a double calculation for each element, the first at the current input time, and a second at the altered output time based on some kind of "year compression" value. Then these two datapoints are lerped between each other using a factor of that year compression value in order to get a smooth transition in the base data, before the azimuth/altitude is plugged into actual Vector3 positions. (of course this will up the computation cost unfortunately).

    This is not something I can just give you easy advice about. I'm not 100% sure if it'll work,actually, and I also don't want to frustrate you by telling you to go plinking around different points in the codebase. I'll sit down with the code and see if I can come up with a solution here.

    I don't think I would be able to simply lock the sky values to particular months. Attempts to do this would inevitably give stutters in the positions at various times, as you see from your tests already. But I think an overall year compression value would work for this situation, what do you think?
     
  4. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Thank you. Did you have a chance to look into the code to fix the compatibility bug?
     
  5. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    210
    Thanks chingwa, I've actually settled on sacrificing some of the realism for gameplay purposes. I added my 4 seasons on top of the code and a static counter for the number of days elapsed since the beginning of time. Every 10 days, the seasons will change and in my case, that would only affect the temperature which in turn will affect a whole bunch of things but not celestial objects positions. The player would be none the wiser, since only the seasons would appear on screen, not the actual tenkoku months which will continue to work as normal.

    Maybe I'll come back some time later to this problem, but for now, the position of the sun in the sky is not a top priority. Thanks for the help!
     
  6. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hi, I was testing the demo and I found an error. When the moon moves between 23:59 and 00:00 it do a jump. Is it already solved or is it in the process of being solved?

    Also another question, have you implemented moon phases or do you have plans to implement them?

    upload_2019-10-10_13-11-14.png

    upload_2019-10-10_13-11-24.png
     
  7. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Duende Moon phases are implemented. Changing the date (time of year) will change the position of the moon and thus also change the phase of the moon. I believe the moon is jumping because in the demo the time is not advancing the date as it goes past midnight, so the mmon is jumping into the previous day's position each time. Oops. This is not an issue in the full package. I'll look into putting out an updated demo that fixes this error, thanks for pointing this out!
     
    Duende likes this.
  8. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Thank you for responding so quickly. :)

    I have two more questions: Is the light during the night influenced by the moon phase? That is, during the full moon is there more light than during the new moon? And the other question, is it easy to access the information of what moon phase there is that day?
     
  9. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Yes, the moon phase does gradually affect the amount of moon scene lighting, until there is no moon lighting at all during a new moon. There is also a generalized night lighting setting (separate from the moon directional lighting) where you can adjust the overall lightness/darkness of night scenes (going to a very realistic pitch black if you so desire).

    As far as moon phase info is concerned, it is not accessible through the Tenkoku interface but there is a built-in variable called 'moonPhase' that can be accessed through code that will give you the current moon phase. The example below will work as long as you have Tenkoku somewhere in your Unity scene.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class DisplayMoonPhase : MonoBehaviour {
    5.  
    6.     private Tenkoku.Core.TenkokuModule tenkokuModule;
    7.  
    8.     void Start () {
    9.         // Get Tenkoku Module
    10.         tenkokuModule = (Tenkoku.Core.TenkokuModule) FindObjectOfType(typeof(Tenkoku.Core.TenkokuModule));
    11.     }
    12.  
    13.  
    14.     void Update () {
    15.  
    16.         // Display Moon Phase
    17.         if (tenkokuModule != null){
    18.             Debug.Log( tenkokuModule.moonPhase );
    19.         }
    20.  
    21.     }
    22.  
    23. }
    The result is a 0-1 float value which encodes the following....

    0.0 = new moon
    0.25 = waning quarter (third quarter)
    0.5 = full moon
    0.75 = waxing quarter (first quarter)
    1.0 = new moon
     
    Duende likes this.
  10. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    The asset is quite complete. :) Thank you very much, I will see if more questions arise.
     
  11. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    Hello, amazing asset but i cant show the aurora, i have it enabled
     
  12. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Aurora is enabled based on your latitude. You can reduce the aurora latitude threshold down to 0 and it should then be visible regardless of your latitude position setting.
     
    Liminal-Ridges likes this.
  13. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Hi,
    Did you have a chance to look into the code to make the fog work with LuxWater?
    Thank you.
     
  14. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @rostik1975 Hey sorry for the delay! I had started looking into this a while back but ran into a few snags. I'll re-prioritize this and try to finalize LuxWater fog rendering early next week.
     
  15. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, have been a while since last time I watched the forum, is there any news about Tenkoku 2?
     
  16. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @rostik1975 I sent you a PM regarding LuxWater fog support.

    @Harekelas Yes it has been a while since I last posted Tenkoku 2 news. I don't have any pictures to show but most of the systems are coming along well. I've been putting the finishing touches on precipitation effects over the past couple weeks, which are a big improvement over the current version. Cloud rendering and weather progression are still in flux, but once they are nailed down I'll be posting some more screenshots (or video?). Hopefully before the end of December I can have a beta version of some kind out for testing while I work on tying together the UI.
     
    rrahim and Harekelas like this.
  17. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great to hear, may I get a beta package to test when it's ready?
     
  18. Chaiou

    Chaiou

    Joined:
    Mar 15, 2018
    Posts:
    1
    Hello, im about to use this, however have a question beforehand :
    Working on a VR project on unity 2019.2f61 (with post process package, not using HDRP for now).
    Is this lib also compatible with Vegetation Studio Pro ? Or at least does it no enter in conflit with is ?
    Can i use it for render in VR ?
    Thanks
     
  19. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Harekelas I'm undecided whether it will be an open beta or a closed beta. If I do a closed beta then I expect those included will be picked on their willingness to give direct feedback so I can finalize the new system. I'll put you on that short list in that case.

    @Chalou Tenkoku should work for VR in many cases, yes, though I have not done direct testing myself, so take that as a mild caution. I have other customers that report VR success. I don't think there would be any compatibility problems with Vegetation Studio.
     
  20. Untitl3d

    Untitl3d

    Joined:
    Jun 20, 2019
    Posts:
    7
    @chingwa I have a suggestion which could drastically increase performance!
    just like the default procedural skybox shader of Unity use shader properties instead of 3D models of sun and moon for the next version of tenkoku.
     
  21. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Untitl3d The next major version of Tenkoku no longer uses 3d models for sun and moon, and no longer uses particles for stars and planets (uses textures directly in the sky shader for all these effects). I believe this does contribute to a faster performing system.
     
    Untitl3d likes this.
  22. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hey, @chingwa I just bought the asset. :)

    I have tried the demo scene and the clouds have a strange granulate, even when they are still and there is no wind. I mean, that granulate has movement and is constantly changing:
    upload_2019-11-25_23-32-11.png

    Why is this? How do I remove that granulate?
     
  23. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hi @Duende Thank you for your purchase! The noise pattern is usually covered up by the Temporal Reprojection effect that is added to your scene camera. This should be added automatically once you run your scene, but you can add it manually if you like by going to the top menu under component/imageeffects/tenkoku/tenkokuTemporalAliasing.

    If you have this on your camera already and it is still pixelated you can try increasing the 'cloud quality' setting under the tenkoku configurations tab. This will increase the number of samples that clouds render, so be careful how much you increase or it will adversely affect performance. I'd increase this setting just until the noise pattern becomes unobtrusive.
     
  24. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Thank you very much, this works, but I had to set the Feedback Min and Max to 1 and also the Cloud Quality to 1. Is this normal?

    I have another question: everything has a very bluish tone when I use the skybox (with gradient doesn't happen, but skybox adds better lighting in dawn and dusk), I have managed to mitigate it more or less using the Unity Post Process Tonemapping, but it isn't a very good solution. Is there any way to remove the blue tone by modifying Tenkoku? That color makes realism is lost.
     
  25. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    When feedback min/max are both at 1 you might see some smearing artifacts in the clouds. At least, I have seen this in the past, but it may be intermittent. I would just take a good look and make sure you don't see any rendering trouble, otherwise I don't see a reason not to set both to 1 if all looks good. Putting the cloud quality to 1 is fine, as long as it doesn't affect your scene performance too much. Graphics cards are more powerful these days so this might not be as much of an issue going forward ( the default settings were set around 2015, just for some perspective).

    The bluish ambient tone is coming from the sky itself, and is being applied to objects through the included reflection probe. I recommend keeping the ambient mode on skybox since it does give a more cohesive ambient rendering to the scene, as you noted. To reduce the bluish cast I recommend lowering the 'day ambient amount' setting from 1 to maybe 0.5 (in the color settings section). If this still isn't enough then I would also recommend to go to the reflection probe object and reducing the runtime 'intensity' setting, which should make the blue cast from the sky less noticeable.
     
  26. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    If I reduce the 'Day Ambient Light' the light gets quite dark. I have been able to fix it more or less by modifying the 'Light Amount' and 'Sky Amount' in 'Sun Rendering'. Is it possible to reduce the 'Day Ambient Light' without getting dark? I also reduced the 'Intensity' of the 'Reflection Probe/Runtime Settings' to 0.5. By doing all this I reduced the bluish tone somewhat but it remains, is there any other way to reduce or eliminate it?

    By the way, is there an approximate release date of Tenkoku 2.0? The lighting of the images you shared a year ago are impressive. :)
     
  27. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    I don't think there's currently any other way to reduce the blue... since it's coming direct from the sky through the probe. The only solution I can think of is to do some kind of custom reflection probe, or edit the texture that comes off the probe to reduce it's color saturation, but there is no easy built-in way to do this. Hmmm.

    I think your best bet then is to switch the ambient mode to flat color and use an edited color ramp texture where the ambient section has been desaturated. You can download a unitypackage that adds a desaturated texture to your project below. It will add 'tex_masterramp_desaturate' to your Tenkoku textures folder, then just drag it onto the color gradient/color texture slot in the tenkoku color settings, then play your scene. Note that any edits made to this texture only take effect when the scene first loads.

    download:
    http://www.tanukidigital.com/tenkoku/misc_files/tenkoku_desaturate.zip
     
  28. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    The blue color disappeared but it seems that ambient light is lost. It would be best if the bluish color was white or transparent. Maybe changing the blue color in the texture you gave me? I don't know.

    Sorry to insist, but do you have an approximate date for Tenkoku 2.0?

    Again, thank you very much for the help. :)
     
  29. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Duende I expect to have a beta release in some form by the end of December. I don't know yet whether this will be a small private beta or something open to all current customers. I guess it depends on how much stability / polish it has at that point. Hopefully I should have more news next month.

    Edit: As far as a full release date goes, that will depend highly on what comes out of the beta, so that is still undecided at the moment.
     
    Last edited: Nov 29, 2019
    Duende likes this.
  30. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Well, news of Tenkoku 2.0 and a beta (open or closed) for end of December or first of January is very good news. That means that more soon than late we can enjoy it. :)
     
  31. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hi, another question. At the end Tenkoku 2.0 will be compatible with HDRP? In the last update you said you had to do some tests. :)
     
  32. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    HDRP Is a separate issue. I am not currently focusing on HDRP, especially not until they create a stable pathway for custom post-processing, as Tenkoku2 will rely on that heavily. So the current answer is no for HDRP, but hopefully things will change in the future.
     
    Duende likes this.
  33. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Well, I'm not using HDRP technology yet, but surely I have to update my project to those shaders. Hopefully, Unity will soon stabilize these custom HDRP shaders so you can add support. :)
     
  34. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Any new about Tenkoku 2.0? :D
     
  35. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Just a note to let everyone know that I tested Tenkoku with today's public release of Unity 2019.3 and all seems to be working as expected.

    @Duende Sorry, no news available yet :(
     
    Duende likes this.
  36. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    31
    Hello everyone, i have a question about tenkoku, i'm a long time user of it and i don't want to remove it from my project, anyway, i've noticed baking lightmap, especially when unity have to bake ambient probes, it takes too much time to finish the light map, even if its set up to minimum parameters. Whan can it be? any advice to speed up lightmap process using Tenkoku? Many thanks :D
     
  37. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    Hello @chingwa . Is it possible to move Tenkoku DynamicSky object and all its children into a separate layer? I created a new 'Sky' layer for it but Tenkoku sky stops rendering into my camera after that. Funny thing that Tenkoku sky is still reflected on the ocean surface but not in my camera.
    Thanks in advance.
     
  38. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Efril Yes this should be possible, Tenkoku doesn't rely on any specific layers to function. Are you 100% sure your camera render queue is set to render the corresponding layer?

    @Bukyja Tenkoku is meant to be used mainly for dynamically lit scenes. I don't have any experience using it for baked lighting, so can't give you much direct advice unfortunately. Perhaps reducing the camera distance (and thus Tenkoku's light render scale) would help.
     
  39. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    @chingwa you are right. Updating culling mask of the camera fixed the problem. I should have checked it first. Thank you.
     
    chingwa likes this.
  40. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    31
  41. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    I am hopeful that we will see version 2.0 soon. :)
     
  42. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    90+ % of the demo is pink. 2019.3.3f1, URP 7.2.0. No, edit, render pipeline .... upgrade, doesn't work.
     
  43. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @nobluff67 Tenkoku is not compatible with URP or HDRP, it requires the standard Unity pipeline. It does work in 2019.x+, but not using these new SRP rendering systems.
     
  44. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Thanks. Is there a easy way around this or is this unworkable if you are using urp?
     
  45. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Currently no, all the shaders would need to be rewritten specifically for URP (and then rewritten again specifically for HDRP), which is currently not really tenable in a complex asset such as Tenkoku. As these new pipelines mature and (hopefully) become easier to develop for and support I would like to add pipeline versions. Only time will tell.
     
  46. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    ok, thanks. "Converting" back to SRP so that I can test this out properly.
     
  47. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    Hello @chingwa. Please, take a look at the screenshot below:

    You can see Tenkoku rain drops are slightly tinted with green color. That coloring desn't plays nicely with the rest of the scene and I don't like it. Obvious way to fix is changing the tint color of 'mat_fx_rain' material but the system immediately switches it back. To fix it I was commented two lines in TenkokuModule.cs:
    Code (CSharp):
    1.  
    2. if (Application.isPlaying){
    3.     //libComponent.renderObjectRain.material.SetColor("_TintColor", rainCol * Mathf.Lerp(0.35f,1.0f,ambientCol.r));
    4.     libComponent.renderObjectRainSplash.material.SetColor("_TintColor", splashCol);  
    5.     libComponent.renderObjectRainFog.material.SetColor("_TintColor", rainfogCol);
    6.     libComponent.renderObjectFog.material.SetColor("_TintColor",fogCol);
    7.     libComponent.renderObjectSnow.material.SetColor("_TintColor",snowCol);
    8. } else {
    9.     //libComponent.renderObjectRain.sharedMaterial.SetColor("_TintColor", rainCol * Mathf.Lerp(0.35f,1.0f,ambientCol.r));
    10.     libComponent.renderObjectRainSplash.sharedMaterial.SetColor("_TintColor", splashCol);  
    11.     libComponent.renderObjectRainFog.sharedMaterial.SetColor("_TintColor", rainfogCol);
    12.     libComponent.renderObjectFog.sharedMaterial.SetColor("_TintColor",fogCol);
    13.     libComponent.renderObjectSnow.sharedMaterial.SetColor("_TintColor",snowCol);
    14. }
    15.  
    For me the issue is fixed but I was just wanted you to know that someone else may also face it in the future and it may be useful to add appropriate color selection to the settings of Tenkoku.


    Another issue I faced is impossibility to change day ambient sound and probably other sounds but I not tested them. I couldn't found what is wrong with your code so it may be Unity issue (my current version is 2019.3.6f1). I fixed it by calling HandleGlobalSound() method during Awake() in TenkokuModule.cs:
    Code (CSharp):
    1. void LoadObjects() {
    2.  
    3.     //GET TENKOKU OBJECTS
    4.     calcComponent = (Tenkoku.Core.TenkokuCalculations) FindObjectOfType(typeof(Tenkoku.Core.TenkokuCalculations));
    5.         libComponent = (Tenkoku.Core.TenkokuLib) FindObjectOfType(typeof(Tenkoku.Core.TenkokuLib));
    6.         //libComponent seems to be loaded with default sound clips and they are also set for dynamically created Audio Sources attached to AMBIENT_SOUNDS object.
    7.         HandleGlobalSound(); //Correct audio clips are set here
    8. .....
     
  48. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hey @Efril You're right that the base color of the rain is delineated in code, but you can also further change the tint by editing the fxRain particle system colors (in the scene, not in the project).

    The base color is set at line 592 in the TenkokuModule.cs file, you can change it here to be pure white (1,1,1,1), and then adjust the colors completely in the particle system instead.
    Code (CSharp):
    1. private Color baseRainCol = new Color(0.65f,0.75f,0.75f,1.0f);
    The above sets the base color of the material (though it also gets adjusted by other scene variable slightly, depending on lighting conditions). This is where you can adjust the particle color range:



    As far as changing the sounds, I've tested this in 2019.3.9, and it works as expected. Perhaps it is an issue with that specific Unity version... you can try to take the Tenkoku prefab in your scene and Unpack it from the prefab in the project and then try changing the ambient sound clip?
     
  49. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    @chingwa I was able to hear custom ambient sound instead default ambient sound after unpacking Tenkoku game object in the scene.
     
  50. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Hi,

    I have a problem with what I think is a clash between procedural worlds gaia/cts and tenkoku sky. I installed gaia pro, then cts, then temkoku. Opening Tenkoku demo crashes unity. I have removed gaia/cts, removed sky, reinstalled sky, now get this error message:

    Assets\TENKOKU - DYNAMIC SKY\SCRIPTS\Tenkoku_CTS_Weather.cs(54,10): error CS0246: The type or namespace name 'CTS' could not be found (are you missing a using directive or an assembly reference?)

    When I import gaia and cts back, demo still crashes. When I add sky prefab, and click on config, I get this...

    sky11.png sky1.png
     
    Last edited: May 6, 2020