Search Unity

TENKOKU - Dynamic Sky

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

  1. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @chingwa I can understand that, however clouds are not the only thing not being networked. It can be a bright sunny day on one client, and on another filled with clouds, raining and thundering. Is the raining and thundering tied to the clouds in a way that if the clouds is not networking correctly it affects that?
     
  2. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    If you are doing 'quick and dirty' you can use the encode/decode built into Tenkoku, but if you want it to be a much more efficient system that only sends what has changed then you will need to write your own set of RPC calls so that there isn't as much data passing as the properties change.
     
  3. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @CaptainMurphy I am using the encode and decode methods, the problem is the only thing being synced correctly is time and date. Weather and clouds are different on each client.
     
  4. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    That is interesting. I don't use the encode/decode since it is just a bit too heavy for us and we are changing the weather about every 2 seconds so we just have each piece send an RPC. Last time we used it, it was working though. I will have to look into it to see if this might be something in the latest version.
     
  5. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @CaptainMurphy Are you just syncing the values of each cloud type, etc? I've thought about trying that out, but it seems to be what the encode/decode is doing that isn't working.
     
  6. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Yes, we are syncing each component separately as they each change. We run a primary weather manager script that as it changes the weather in certain sections (like wind speed, direction, humidity, etc) it will then reflect those changes in the clouds, water, etc and then fire the RPC's needed to get everyone to match.
     
  7. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @CaptainMurphy I don't know if this makes any difference compared to what we are doing differently, but at the moment we are also using the automatic random weather of Tenkoku.
     
  8. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @emrys90 Is the automatic random weather enabled on the clients' side? If might be overriding what the server is sending.
     
  9. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    Yes, it is. The encode/decode method sets the clients weather setting to match the servers setting, so I believe that's intended.
     
  10. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @emrys90 If I am not mistaken you only want the server to have the random weather enabled, then when that changes you would send that info to the clients as it changes. I think if the client it set to random as well it will simply override the encode that was sent to it.
     
  11. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    Okay, I can try commenting out what happens in the encode/decode to not send the weather setting and see how it goes. My understanding though was that he is syncing the random seed variable so that the randomness is the same between the server and clients, so that lightning will hit at the same time, and you don't have to sync as often.
     
  12. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Deckard_89 I've been wanting to do cloud shadows for a while. Once some of this other stuff gets squared away (cloud shader, syncing bug, new weather system) I'll look into doing the shadows :)
     
  13. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    The sync issue is likely related directly to the auto/random weather setting. In the last update I did a random state sync to try and fix this but there is still a bug somewhere... but as @CaptainMurphy said, the best use-case is to run the weather only on the server and then have the client sync to the server, rather than trying to get them both to sync up running separate weather systems.

    One issue you might run into is the auto weather setting being sent with all the other weather variables. I recommend opening up TenkokuModule.cs and searching for the following around line 2833...
    Code (CSharp):
    1. if (func=="weathertypeindex") weatherTypeIndex = int.Parse(dat);
    To sync the weather state from the server you should probably comment out the above line. I'm going to do this on my end for subsequent updates as well.
     
  14. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @chingwa Alright I'll try that out this evening and see how it goes. Would lightning strike at the same time though with this change, or do you think that would have to be handled differently?
     
  15. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    The above change shouldn't affect lightning strikes at all. If the lightning strikes still don't work for you then that would be a separate bug :/
     
  16. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @chingwa It seems to be working a little better now. Although clouds no longer move on the clients, guessing I'm probably going to have to manually sync the weather values and probably lerp to the new ones on the clients?

    Another issue I am having though is stars appear on one client but not on another. Is that something that's networked too?
     
  17. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    The stars aren't networked... they are just rendered as a function of time. So as long as the time is synced from server-->client the stars should show up on client side. If they aren't showing up on the client side there must be an explanation outside of server syncing.

    I assume the client side "star rendering" mode is set to realistic, and the "brightness" is greater than 0? Can you double check that the star object and particle system are both enabled? The star object is located at Tenkoku-->SkySphere-->SkySphereStar-->StarRenderSystem. And if all the above is true, are there any console errors showing on the client side?
     
  18. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    @chingwa No errors, and everything is as you say, enabled and settings are turned on. Stars show up for some clients, sometimes. It's not a pc setting either since on my computer there's been times I fire up two clients and one has stars and the other does not. The time was the same on both clients.
     
  19. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    Hello.This is the best asset for the weather because it has all the effects you want BUT I couldn't get the SSR effect work with it. What should I do? (SSR = the Screen Space Reflection that comes with the Unity's cinematic image effects asset). I've turned off "Reflection probe" in the configuration but still SSR doesn't work.

    And another problem is that, if you change the camera height position so fast, the clouds positioning get a bit weird for a second.

    I recommend anyone to buy this as my last choice was very bad and literally I spent my money for nothing for the last weather asset I bought, But Tenkoku is the best.

    And a suggestion, it would be superb if you add a support for real world weather update.
    And my last suggestion is to use a shader with refraction or glossiness for the rain, like GTA V.
     
    Last edited: Jul 20, 2016
  20. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @D4N005H Thanks for your suggestions :) I'll look into the SSR issue and get back to you here. Are you using Unity 5.4? For the camera issue, are you just manually changing the camera position or are you using some kind of camera controller...?
     
  21. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    I tested out the latest cinematic effects (with SSR0 in both Unity 5.3.5 and Unity 5.4beta22. I didn't notice any obvious issues... other than the skybox not updating properly in reflections. I don't know if this is just a limitation with the current version of Unity's SSR though? I tested non-Tenkoku scenes with default skyboxes and they performed the same way, so I assume this is just an SSR issue.

    Can you describe what problems you're seeing with SSR?
     
  22. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    I use latest Unity 5.3 version. I've manually changed the position of the camera.

    Sure, here is a image with description of the possible bug.

    (The terrain is from RTP Relief pack)
     
  23. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    138
    Would there be any way to have Tenkoku display the sky at two separate times of day within the same screen?

    I'm toying with some visual design ideas for a portal-like game and thought it would be fantastic to see Tenkoku sky out the windows of the room the player is in, but also see the sky at a different time through the windows in the room accessed via the portal.

    I suspect this is just simply not possible, but I thought I'd ask.

    Perhaps there is a way to maybe take a snapshot of the sky at a different time and render that to a simple skybox in the room through the portal - then switch to the dynamic Tenkoku sky when the player steps through the portal?

    Thanks for your thoughts!
     
  24. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @amasinton They way it is set up now.... no I don't think this is possible, unfortunately. Tenkoku renders parts of the sky sky directly to the background skybox and I don't think that is easily overcome. It also searches for a number of relevant internal objects, and having more than one Tenkoku object in your scene will almost certainly cause dependency issues. Of course nothing is impossible, but I think it would require a bunch of custom work to do what you're asking.
     
    amasinton likes this.
  25. Michael316

    Michael316

    Joined:
    Aug 2, 2012
    Posts:
    21
    Hi, I'm getting massive cloud jitter when using a vehicle, it's worse at higher speeds. My scene is pretty bare, no cam effects or anything, no Unity fog. I've got the latest version of Tenkoku. Any thoughts? Thanks!
     
  26. amasinton

    amasinton

    Joined:
    Aug 12, 2006
    Posts:
    138
    That's what I thought. It's not a big deal. I might get pretty far simply exporting a series of Tenkoku skyboxes as six static images and then loading those into a placeholder that switches over to dynamic skyboxes once the player goes through the portal. I think I can find a way. Thanks for your response! Keep up the good work!
     
  27. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Still waiting for cloud shadows.
     
  28. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Michael316 This might be an issue with the controller you're using to control the vehicle. In some cases, controllers that use FixedUpdate() for their main thread can cause sync issues with Tenkoku. I recommend to try changing FixedUdate() to either LateUpdate(), or Update() instead, and see if that helps?

    @amasinton Yeah, rendering out textures for specific times might work nicely. :) Good luck!

    @ksam2 Shadows are still on the list. Can't yet say when they will be available though.
     
    ksam2 likes this.
  29. Michael316

    Michael316

    Joined:
    Aug 2, 2012
    Posts:
    21
    @chingwa No luck - I changed any fixedupdates I could find and still the jitter. Any chance I can email you an export of a simplified scene that shows what's going on?
     
  30. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Michael316 Yeah sure, I'll take a look and see if I can figure out the issue. I can't accept large files at my email, but if you post it to a file server you can send a download link to me at konnichiwa[at]tanukidigital.com
     
  31. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    If you are moving REALLY fast across the scene I have had good luck putting the sky system as a child of the moving object before and just offsetting the origin of it to the 0 of the level but keeping the x/z of the parent.
     
  32. Kuattro

    Kuattro

    Joined:
    Aug 7, 2013
    Posts:
    14
    @chingwa Hi, thank you for the great support and product. We are using working on a PS4 title and notice errors when there's an update on Tenkoku. Do you have plan on updating the shader slightly so that they support the PS4 in the future? Thanks.
     
  33. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hi Kuattro,can you give more detail about the errors you're receiving?
     
  34. Kuattro

    Kuattro

    Joined:
    Aug 7, 2013
    Posts:
    14
    Hi @chingwa we have compiled the list of errors we are receiving on the PS4 every time there's an update on Tenkoku. We have compiled the list below and hopefully it'll help Tenkoku to be PS4 ready every time you update.

    If you have existing Unity projects that you wish to try on PS4, then you should take note of a change to how shaders must be written. Failure to make these changes will most likely result in objects being rendered in pink/purple.

    The details of what to change are below, shaders updated in this way should continue to work on all platform

    - v2f structures (output from vertex shader used as input to fragment shader) must be changed from POSITION to SV_POSITION. Note that a2v (application to vertex) structures should continue to use POSITION.
    - Fragment shader output that writes colour must be changed from COLOR to SV_Target.
    - Fragment shader output that writes depth must be changed from DEPTH to SV_Depth.
    - Do not use "sample" as a variable name in shaders. This is a reserved word that will cause shaders to fail to compile.

    - Tenkoku_cloud_plane.shader
    line 78
    col.rgb = saturate(saturate(max(max(_Tenkoku_Daylight.r,_Tenkoku_Daylight.g),_Tenkoku_Daylight.b) * dot(Tenkoku_Vec_SunFwd,half3(0,1,0))) + skyColor.rgb);
    needs to change to
    half3 Tenkoku_SunFwd_half = half3(Tenkoku_Vec_SunFwd.x, Tenkoku_Vec_SunFwd.y, Tenkoku_Vec_SunFwd.z);
    col.rgb = saturate(saturate(max(max(_Tenkoku_Daylight.r,_Tenkoku_Daylight.g),_Tenkoku_Daylight.b) * dot(Tenkoku_SunFwd_half,half3(0,1,0))) + skyColor.rgb);
    because it can’t find a compatible overload function.

    - Tenkoku_Vec_SunFwd should be used in next few lines after that as well
    same error at line 160
    same error at line 236
    same error at line 428
    same error at line 524
    same error at line 618
    same error at line 713
    same error at line 809
    same error at line 905
    same error at line 1084
    same error at line 1178
    same error at line 1271

    - line 1404 needs added .rgb to clarify ambiguity
    col.rgb += saturate((saturate(dot(-viewDir,Tenkoku_Vec_LightningFwd)-0.2)) * Tenkoku_LightningLightIntensity * 0.7 * s.Albedo.r);
    col.rgb += saturate((saturate(dot(-viewDir,Tenkoku_Vec_LightningFwd.rgb)-0.2)) * Tenkoku_LightningLightIntensity * 0.7 * s.Albedo.r);

    - line 1407, 1408, 1411, 1412, 1520, 1521 need .rgb as well

    tenkoku_fx_particle.shader

    line 34 float4 vertex : POSITION
    needs to change to
    float4 vertex : SV_POSITION


    - Tenkoku_fx_particle_lit.shader
    line 109
    col.rgb = max(col.rgb,origColor*_NightFac) + Tenkoku_LightningLightIntensity * 2 * _LightningFac;
    needs .rgb
    col.rgb = max(col.rgb,(origColor*_NightFac).rgb) + Tenkoku_LightningLightIntensity * 2 * _LightningFac;

    -Tenkoku_galaxy.shader
    line 61
    float4 vertex : POSITION;
    to
    float4 vertex : SV_POSITION;

    -Tenkoku_moonsphere.shader
    line 66
    half alph = saturate(max(0.0,dot(s.Normal,Tenkoku_Vec_SunFwd)) * 2);
    needs to add .xyz
    half alph = saturate(max(0.0,dot(s.Normal,Tenkoku_Vec_SunFwd.xyz)) * 2);

    -Tenkkoku_planet.shader
    line 69
    float4 vertex : POSITION;
    needs sv added
    float4 vertex : SV_POSITION;

    -Tenkoku_skybox.shader
    line 461
    col.rgb += lerp(0.0,(_NightColor.rgb * 4.0) * saturate(atmosFac * saturate(lerp(0.0,4.0,_Tenkoku_NightBright))) * (1.0-_Tenkoku_Ambient) * nBright,1.0-_Tenkoku_Ambient);
    change because of ambiguous call
    half3 temp = (_NightColor.rgb * 4.0) * saturate(atmosFac * saturate(lerp(0.0, 4.0, _Tenkoku_NightBright))) * (1.0 - _Tenkoku_Ambient) * nBright;
    col.rgb += half3(lerp(0.0, temp.r, 1.0 - _Tenkoku_Ambient), lerp(0.0, temp.g, 1.0 - _Tenkoku_Ambient), lerp(0.0, temp.b, 1.0 - _Tenkoku_Ambient));

    -Tenkoku_star.shader
    line 53
    float 4 vertex : POSITION;
    needs sv
    float4 vertex : SV_POSITION;

    -Tenkoku_suneclipse.shader

    line 60
    float4 vertex : POSITION;
    needs sv
    float4 vertex : SV_POSITION;

    Thank you again for looking at the issue. We really appreciate it.
     
  35. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Kuattro thanks for the detailed list! I'll look into these ASAP.
     
  36. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @chingwa Do you know if Hx Volumetric Lighting would work well with Tenkoku? Hx looks awesome (it also performs well), and combining that with Tenkoku's environment and weather would be something special. It would also remedy the sunbeams problem, where you have to be looking at the light source for them to appear (the same with Unity's own sunshafts actually).

    I don't currently own Hx and I was holding off until someone had experience combining with Tenkoku.
     
  37. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    The following applies to most sky and fog systems, in my experience.....

    Not hard at all to get them to work without modification, but there are unwanted visual consequences that require deeper integration.

    By this I mean that its not at all hard to tell the fog system to use the directional light that the sky system uses for sun (& sometimes moon). So you then get the volumetric light rays off the directional light.

    The problem is that when the camera is within the fog, the colour of the sky is profoundly affected by the fog in a manner that doesnt look good.
     
  38. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @elbows I see, that's a shame, I wouldn't know hot to fix the camera in fog issue in my 3rd person game. For the sun-beams alone, I guess I could just fake it the old-fashioned way, with a mesh and animated texture. Nowhere near as good as "the real thing" though.
    Thanks for the advice.
     
  39. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I have Tenkoku working with the open source volumetric light system. You really need to play with some occlusion zones to make it look good as that lighting is not a 'one size fits all' and is really only effective as an addition to existing sun beams. Turning it off when needed is also pretty necessary as it rather expensive.

     
    chingwa likes this.
  40. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    The only time I've seen similar assets that work 100% together is when they are developed by the same asset publisher. For the most part when you start mixing assets together, you have to do at least some customization to get them to work the way you want. I even find that with single assets. Everyone's vision of how they want something to work stands a good chance of being different. I've noticed this with day/night systems as I've transitioned my path to Tenkoku. Not saying that any way is right or wrong, but Justin does it different from the Time of Day guy who also does it different than the Environment Gator guy. So I imagine it is hard for guys like the one doing the asset you are talking about to make sure it works without any issues with all the day/night systems.

    Justin is super active and helpful with support though. If you run into issues trying to get them to work together, he may be able to point you in the right direction of how to get them working.
     
    chingwa likes this.
  41. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    316
    @CaptainMurphy Open Source as in... Free?! Wow that's generous, to say the least.

    @Shawn67 Yeah, I hear you. It's just that out of all the dynamic sky day/night / weather assets, I find Tenkoku the easiest to use, and looks great even at default settings, which is why it surprises me that more asset developers don't advertise specific Tenkoku integrations with their systems. I think Tenkoku is a more recent addition than a lot of the others though, such as Time of Day or Unistorm. They've been around a long time and are popular, like the "ufps" of sky systems if you get my meaning.
     
    chingwa likes this.
  42. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I don't know that I would call any of others the ufps of sky systems. Out of all mentioned, I've found Tenkoku to be my preference and the support here is better than what I've seen with the others. I think the point I was trying to make is with all of the sky systems doing things different it makes it hard for other similar developers to integrate sky system specific without turning their backs on the other systems since they all seem to have different approaches.
     
    chingwa likes this.
  43. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    I haven't tried that one specifically. But as @CaptainMurphy has suggested, the open-source volumetric lights can be made to work pretty well without too much issue. When it was first released I looked into incorporating it into Tenkoku on a deeper level, getting it to react with Tenkoku color transitions etc. I had concerns about the performance though, and didn't pursue it. I'd like to try it again at some point... now that it's had a few updates it might be working better.

    It's hard for developers to market their assets with other 3rd party assets. As @Shawn67 said, you would be limiting your asset success by doing so since there is no clear upfront sky system leader at this point. Also you never know how support or requirements will change in the future and that can cost you a bunch of effort if you then have to keep updating your own asset. Considering all the current sky systems, there are a few good options to choose from depending on your project needs, each having their own strengths (Tenkoku being 'Da Best of course :D )
     
    Deckard_89 likes this.
  44. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Out of all that I've tried and own, I totally agree. Tenkoku goes into all of my projects/scenes. :)
     
    TheSeawolf and chingwa like this.
  45. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    267
    @chingwa , I finally relented and bought Tenkoku. ;)

    My initial thoughts straight out of the box, using the GX functionality to install Tenkoku is it is a very nice looking and smooth running product. I had been using another weather product which wasn't working for me with simple aspects like that.

    What I really like is just how easy it is to get a dark night. Anyway these are just initial impressions and I will no doubt be back soon with questions.
     
    Last edited: Aug 10, 2016
    BackwoodsGaming, chingwa and Bagnol like this.
  46. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @TheSeawolf Thanks a lot, great to hear your initial impressions! :)
     
    TheSeawolf likes this.
  47. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Welcome to the Tenkoku club!!
     
    TheSeawolf likes this.
  48. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    267
    Thanks Shawn67, I'm going to join the Suimono club next month too.

    I need some help everyone, back on page 6 of this forum, @Bagnol displayed some screenshots of a tenkoku runtime overlay to make in game adjustments. I've been through the docs again and for the life of me can't see how to make use of this function.....doh!

    Can anyone offer any suggestions?
     
  49. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I think if you load the demo, @chingwa has a scripted GUI in the demo that allows you to adjust on screen. The script should show you how to change it within your own script if you want to build your own GUI. At least I think I remember there being a gui there... heheh
     
    Bagnol likes this.
  50. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @TheSeawolf
    @Shawn67 is correct, the screenshots I posted that had the Tenkoku GUI were done in the demo scene included with the package. I found that a character controller system I'd imported into my project had overwritten a few of the inputs required, but in a clean project I was able to load up the Tenkoku demo scene and create prefabs of the gameobjects inside and was able to just drag and drop them into a fresh scene and it all worked well. You might be able to do the same, or dig around and use the information to make your own/customise the setup there.
     
    BackwoodsGaming likes this.