Search Unity

TENKOKU - Dynamic Sky

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

  1. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Looks and sounds great, the new cloud system is a game changer for Tenkoku. Looking forward to version 2. ;)
     
  2. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I get it, will try to lengthen the probe update interval to try get higher FPS.
     
  3. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    210
    Hey @chingwa

    There's a big problem with cloud rendering. Take a look at this 6 second clip.

    https://puu.sh/C0J8G/78796cac97.mp4

    As you can see, clouds are okay when the camera isn't moving, but as soon as it does, every object that is drawn on top of a cloud leaves artifacts behind. I found that the only way to fix this is by increasing the cloud quality to 2, which is the max value. That's a pretty bad solution seeing as the FPS drops massively from 100 at a value of 0.7 to around 30 at a value of 2 on a gtx 1070.

    This is sadly a game changer, so what can be done about this?
     
  4. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    I have not seen this problem here so there must be another solution other than cranking the quality into overdrive... is this only a problem with UI? How is that UI being rendered? (Unity UI, or another system?) You can try adjusting the max/min settings on the Tenkoku temporal aliasing component on your scene camera... perhaps another setting combination would help.
     
  5. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    210
    No, those aren't UI objects, rather normal gameobjects that follow the camera. But it happens to trees and literally every other object, including particles. So I played with that component you mentioned. In the demo scene, the values are at a default of 0.88 and 0.9 and this is the result

    https://puu.sh/C3kPu/a01aa621a5.mp4

    Now I lowered those values a bit, at 0.5 and 0.6 and this was the result:

    https://puu.sh/C3kPu/a01aa621a5.mp4

    Problem is gone, but the clouds are even grainier than before. It only occurs with the cirrus and cumulus clouds, overcast and alto are immune to this. Is there any other way, other than the Temporal Reprojection script on the camera and the cloud quality on the tenkoku module, that helps with eradicating the graininess?
     
  6. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I used to have this issue, the solution is to use one camera for the skybox and add these filter components on it, then use another camera for everything else, you should not see this behavior again.
     
  7. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    210
    Could you go into detail a bit? I tried doing that but it didn't work. I put the cloud sphere object on its own layer so that only one camera renders it and my main camera render everything else. The cloud camera has all the tenkoku scripts attached to it and is on Skybox mode, while the main one doesn't have the related tenkoku scripts and is in Depth Only mode (has to, otherwise clouds aren't rendered). The problem is still there though :/
     
    Last edited: Nov 19, 2018
  8. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    i can't tell from the demo:
    are the rain and snow particle effects or image effects, i dont want rain and snow to move relative to the player.

    I presume we can fine tune how much wind affects rain and snow movement.
    is vegetation swaying part of plugin, or is it better to use something like CTS for that type of stuff?

    are god rays going around the edges of clouds tweakable? the demo seems a little weak in that regard.
     
  9. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @luniac Thanks for trying out the demo! The rain and snow are particle effects, and they emit in world-space so individual particles will not move around with the player.

    Wind will affect particles according to the wind strength,there isn't currently a setting to control the sensitivity of particles to wind however. For now you would have to make some small edits to the code if you wanted particles to be more or less sensitive, but I will add a configuration setting for this in the next update.

    There are a few settings to adjust god rays in the Tenkoku UI, and you can also adjust the 'block color' in the image effect. Tweaking these settings may give you better results.
     
    luniac likes this.
  10. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    A Note about Unity 2018.3
    After trying out the official 2018.3 release this morning there seems to be a couple problems when using the Tenkoku prefab, at least in new scenes. One issue is that the Tenkoku configuration tab fails to load, and another seems to be that in some cases the prefab doesn't even load or respond correctly while playing the scene... lighting, time, clouds... nothing appears to update properly if at all.

    It's unclear to me what exactly the issue is, but it is definitely a bug introduced by Unity's new prefab system.

    Fortunately there is a way around this bug, and that is to simply create a new prefab in 2018.3.


    1. Open up the included Tenkoku Demo scene.
    2. Drag the "Tenkoku DynamicSky" scene object from the scene hierarchy into the Tenkoku/PREFABS folder.
    3. IF it asks to create a new variant, choose create new "original"
    4. Name the new prefab "Tenkoku DynamicSky 2018.3" so that you can tell it apart from the original prefab.

    Now in any Unity 2018.3 scene you want to use Tenkoku with, make sure to use the new 2018.3 prefab instead of the original. This should fix both of the above problems.

    Finally, there is another issue where an error message pops-up in the editor regarding prefab disconnection. This is again because of changes in how prefabs work in Unity 2018.3. This error can be ignored as it does not affect gameplay in-editor, and will not affect built projects either. I will release a new update soon that fixes this error for those using Unity 2018.3.
     
    Mark_01, Arkade, rrahim and 1 other person like this.
  11. LeonaWest

    LeonaWest

    Joined:
    Mar 7, 2017
    Posts:
    8
    How can I adjust the color of the black part of the cloud like the part inside the green frame?
    Overall brightness is lowered using "Overall Tint".
     

    Attached Files:

  12. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    There aren't currently any color controls made available for this part of the cloud. To adjust this you would need to edit the tenkoku_cloud_sphere.shader file. Specifically you need to adjust the tcM2' value at line 575.

    Here is the default:
    Code (CSharp):
    1. float tcM2 = lerp(float(0.7),float(0.4),_NoiseBias);
    2.  
    You can adjust the second value lower, which will lighten the depth accumulation at it's darkest point, and raise the first value which will lighten the lighter point. For example a values of 1 and 0.6 might give you something closer to what you want, like so:
    Code (CSharp):
    1. float tcM2 = lerp(float(1.0),float(0.6),_NoiseBias);
    2.  
    This is a good point though, it sounds like a good idea for me to build a setting in the UI for brightness adjustments like this.
     
  13. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Curious to know when Ternkoku will be updated. Presently running into performances issues every 1 second with T. When removed it is all smooth...
     
  14. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @pixelsteam I recommend looking at the Tenkoku-->Tenkoku_ReflectionProbe object and reduce the number of game layers that get rendered by the probe... even going as far as setting the layer rendering to "nothing" (which will just render the sky). Depending on the project this should noticeably reduce such stutters.
     
  15. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    25
    Does This Scene Available on this Asset?
    "Constellations and Names"
    Thanks tenkoku_screens1_star.jpg
     
  16. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @ArthurUS83 No, Tenkoku it does not render constellation lines or names.
     
  17. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    582
    Does it work with LWRP?
     
  18. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @soleron It currently works with Unity's Standard rendering system only.
     
  19. NoctisFatehart

    NoctisFatehart

    Joined:
    Jul 30, 2014
    Posts:
    28
    Hello, just curious as I've been a long time user of the product in general, but will this asset be receiving future updates at all or in any capacity? It's been a while since there have been any so I just want to be sure the asset is still going to be used/updated before I continue to dedicate it's use in my project going forward.

    Thank you for any response!
     
  20. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @mhhj Yes it's true, it's been a while since I've released any major updates to Tenkoku. This isn't because it is no longer being supported though, it's simply because all my Tenkoku dev time is being put into version 2.0. This is pretty much a complete rewrite of Tenkoku, and a lot of what I'm building isn't applicable to the current 1.x version. I expect to have some more info about Version 2 soon, and am anticipating a release sometime this year (sorry to be so vague). The 2.0 release will be a free upgrade to all Tenkoku users.
     
    Efril likes this.
  21. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi @chingwa
    I just found an amazing new cloud asset using post effects for clouds rendering in screen space:
    Massive Clouds

    I've checked its compatibilities with Tenkoku, it works great in many circumstances:
    Dawn
    upload_2019-3-4_0-9-51.png

    Noon
    upload_2019-3-4_0-10-43.png

    But I also found some downsides: the sun rendering cannot be masked behind these clouds:
    upload_2019-3-4_0-13-31.png

    And there is no way to simulate an overcast situation with darkened directional light (the clouds just got invisible when light amount got reduced)

    Is it possible for you to look into this asset and make an integration with Tenkoku? Or draw some inspirations from it and make good looking clouds like it in the Tenkoku 2.0?
     
    chingwa likes this.
  22. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hey @Harekelas thanks for the heads-up. Unfortunately in order to get better visual compatibility where it matters (direct and diffuse light color scattering) these two assets would need to be pretty heavily integrated. I've been working on a similar volumetric solution in Tenkoku for quite a while. Hopefully I can post some progress screenshots soon.
     
    Efril, rrahim and Bartolomeus755 like this.
  23. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Great to hear something similar is under working, really look forward to the screen shots. I believe you've mentioned that the 2.0 may come within this year. I just can't wait to see it!
     
  24. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    Hello @chingwa. I found that Tenkoku limits maximum render distance to about 10000-10500 even when both Unity fog and Tenkoku fog are disabled. 17150 value of camera far clipping plane is also should be enough. Is there any right way to increase this limit? I tried to increase scale of SkySphere object. It does the job but breaks rendering of clouds.
     
  25. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Efril There aren't any specific limitations in Tenkoku when it comes to camera render distance. Can you explain the problem you're running into or post a screenshot?
     
  26. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    82
    @chingwa thank you for response. I tested it more in different scenes and the problem looks very odd to me. It randomly cuts graphics at different cameras (default or my own prefab cameras) and different Tenkoku prefabs (default or my prefab). Maybe it is not Tenkoku problem because my world space UI also disappeared at large disatnce but it seems Tenkoku fog not affects world space UI. Finally I ended up with setting much higher far clipping plane value. Initally was 17000 and now it is 22000. So nevermind.

    I have 2 other questions:
    1. In the screenshot below you can see ship 3d model affected by Tenkoku fog but smoke from ship funnels does not affected by fog. Can it be fixed somehow?
    TroubledWaters_UI_2019-03-20-21-03-48_1024x768.png
    2. Is there any calculations related to Tenkoku fog where we can say is object visible or not?
     
    Last edited: Mar 21, 2019
  27. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    The fog relies on the depth buffer in unity, as it is a post process effect and is not generated on individual shaders. The smoke would need to use a non-transparent shader for it to properly right to the scene depth and thus generate fog. Usually people use transparent-cutout for this, instead of full transparent. This is a pretty common Unity limitation.

    Unfortunately I don't have any built-in functions to determine fog coverage.
     
    Efril likes this.
  28. ScoutMaster

    ScoutMaster

    Joined:
    Jan 18, 2017
    Posts:
    6
    Hey, will the 2.0 version be useable with the hdrp? Thanks!
     
  29. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Currently unknown. HDRP is not one of my priorities until it is considered as an official release from Unity.
     
  30. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    You can solve the semi transparent smoke issue with the partice shader itself. It's a workaround but not a perfect solution.

    The particle shader has the property o.Emission. Set the the emission color of the particle shader to the fog color.

    If you change the fog color by script, based on different situations of your game, you can set the particle smoke color by a c# script. https://docs.unity3d.com/ScriptReference/Material.SetFloat.html

    You can also measure the distance to the object from the camera, and set the intensity (fog color) on the emission value of the particle shader.

    Professional programmers use a small size rendertexture of the sky and fog density and pass them to all transparent shaders.o.emission. So you get rid of the fog and alpha blending issues very easy in nearly all situations.
     
    Efril likes this.
  31. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hello,

    I am getting an error in Unity 2018.3.12f1 related to the "starfield" or star system for some reason. The error looks like this:

    "NullReferenceException: Object reference not set to an instance of an object
    Tenkoku.Core.ParticleStarfieldHandler.StSystemUpdate () (at Assets/TENKOKU - DYNAMIC SKY/SCRIPTS/ParticleStarfieldHandler.cs:126)
    Tenkoku.Core.ParticleStarfieldHandler.LateUpdate () (at Assets/TENKOKU - DYNAMIC SKY/SCRIPTS/ParticleStarfieldHandler.cs:109)"

    Any idea why the starData or starparticles would be null? That's my main question.


    Secondarily, I also have pretty large performance issues with the clouds in Tenkoku Dynamic Sky. I bought the asset a few years ago and I thought by now the cloud performance would be upgraded some.....but I guess not. I have to disable the "Reflection Probe" option in the configuration settings.

    Basically if I use any clouds in the system, I get at least 10 fps framerate drops every so often, and sometimes it even slowly lowers my game fps from 70 fps at the beginning to 30 fps after a couple of minutes.....not sure why. I've tried all sorts of settings, including lowering the cloud quality to almost nothing. Overall the cloud performance seems absolutely terrible to be honest. It's unusable for me in any of my projects. I just can't use any clouds at all. It looks like you're working on a 2.0 version, so I hope the cloud system at least can be usable in the new version.
     
  32. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @Velo222 There was a data format change in the star system component in the most recent version, which is likely where the error is coming from. To fix this you'll need to delete the tenkoku prefab in your scene and drag a new one in from the prefabs folder.

    The other option is to go to the Particle Starfield Handler component (Tenkoku-->SkySphere-->SkySphereStar-->StarRenderSystem object), then drag the "starDataset" file from the Resources folder onto the "Star Data" slot.

    Sorry for the inconvenience with this. The star positions needed to be brought into an internal Unity data format to fix some problems that were occurring in some project builds, and for better end-user compatibility.

    As for cloud performance I'm not sure why you would be getting a progressive performance leak. Version 2 is a complete redo and clouds are using a different rendering algorithm. Performance improvement is one of the reasons for doing a complete redo.
     
    joanpescador likes this.
  33. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437

    Thanks for the reply. I finally got it to work! I had to drag the star data asset onto the star render object like you said. Also, weirdly, the "Tenkoku Module" script is disabled by default when dragging a new one into the scene -- kind of odd. But anyways, I got it to work now thank you.

    I also found out if I disable the "Calculate Light Rays" option in the Atmospherics section, most of my performance issues go away, and I'm at least able to use the clouds to a certain extent, which is great. But the performance of clouds, especially with a fair amount and high quality gets pretty bad pretty quick.

    I think I'll be able to manage though from here, so thank you. :)
     
  34. koalabear39

    koalabear39

    Joined:
    Dec 16, 2017
    Posts:
    9
    i want to get this but i need to know this its important for my project

    can i change the individual colors of the sky? if so how easy would that be? do i have a color slider for the horizon and one for the upper part of the sky? i need to be able to fully control the sky colors for morning, noon, evening and midnight. also is it possible to change the cloud colors? i basically just want to know if its possible to change all the colors of the sky and clouds and if its easy to do or if i need to change things in the script.
     
  35. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @koalabear39 There are some controls over sky tinting. You can tint on a global level, or you can edit color gradients for some aspects of the sky. However you can't control exactly what colors go where (sky/horizon etc). Most of the sky colors are algorithm based to begin with and then you can do some tinting from there. If you need full artistic controls over all aspects of day/night color then this might not be the best package for your needs.
     
  36. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Hello,
    My scene uses dense fog, and there is a significant visual difference that depends on camera direction, on the horizon. This happens only when the fog script is active (start distance = 18m, end distance = 36). The effect is more strong on low sun angles.
    Do you know what could be the reason of these changes in fog colors?
    Thank you.
    Unity 5.6.4. Linear. Deferred. I have to use an older (1.1.3) version of Tenkoku because I altered it a lot to simplify and improve performance (but these colors artifacts were noticed even before I changed the code).

    P.S. I noticed that Tenkoku_SkyFog camera culling mask is set to Nothing. When I set it to Default + Water, this reduces the colors flickering, but it also reduces fps by half.
     

    Attached Files:

  37. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Or maybe it's possible to edit the fog fx shader to somehow reduce horizon influence? Thank you.
     
  38. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @rostik1975 I had to dig out a 1.1.3 project and try and get some perspective on what you're seeing. :D It's hard to tell what is going on without seeing a video in motion, but it may be down to resolution banding in the generated sky fog texture. You can try upping the resolution a little bit (but not too much or you will lose the blended fog effect).

    Go to the Tenkoku/Textures/renderTex_skyFog texture and change the size from 64x64 to 128x128, or perhaps 256x256. Then re-play your scene. You ought to notice less of this color shift if you are seeing what I think you're seeing.

    If you are only using this scene with heavy fog then you could change the Tenkoku_SkyFog object's camera clear flag from "skybox" to "solid color"... you would lose the morenuanced color from the sky but it could look even better for such a heavy fog, and it should remove any banding completely.

    The culling mask should be on "Nothing" for intended rendering and performance (it defaults back to only blurring the skybox in that case).
     
  39. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Thank you very much for the detailed reply.
    Increasing renderTex_skyFog texture size made the fog>sky transition more 'stable', but it didn't resolve the visual bug completely.
    I think the problem was due to specific settings of Atm. Density and Horizon density in my scene, resulting to bright horizon ring on the skybox material. What really helped is increasing iterations from 3 to 5 in Tenkoku Sky Blur component. Also I edited skybox shader and reduced color value for horizon (IN.rayDir.y >= 0.02) condition.
     

    Attached Files:

  40. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44

    Attached Files:

  41. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @rostik1975 That looks absolutely gorgeous, except for the bugged fog of course! I will get on this and develop a solution for Tenkoku --> Lux compatibility.
     
  42. Hexer_

    Hexer_

    Joined:
    Aug 25, 2016
    Posts:
    94
    Hi, how can I add another planetary body to the sky? I need to add something to orbit around and be visible in the sky
     
  43. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Hi @Hexer_ the easiest way to add a large planet in the sky is to copy the moon object and give it a custom rotation and material.

    1. Duplicate the "tenkoku/skyspherer/SkySphereMoon" object and call it "skySpherePlanet".
    2. Delete the "/moon/LIGHT_moon" object.
    3. Rename the "/moon" object to "Planet".
    4. Adjust the "SkySpherePlanet" object rotation so it isn't hidden by the moon.
    5. Make this "SkySpherePlanet" object a child object of SkySphereMoon. (or optionally you can adjust the rotation of this object yourself via code).

    This will give you an additional object visible in the sky. You can then duplicate the TEXTURES/mat_moon material and give it a new planet texture. As long as you use the same shader on this material (the "moonsphere" shader) you should still get the expected lighting and atmospheric compositing.
     
    Hexer_ likes this.
  44. Hexer_

    Hexer_

    Joined:
    Aug 25, 2016
    Posts:
    94
    Thank you so much for the tutorial! :)
     
  45. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    I'm not sure why you would be getting build problems, there isn't anything complex happening with that shader. You can try temporarily switching to the built-in Unity Particles/Multiply shader instead and see if you're then able to export. The 5 materials located in Tenkoku/Effects/Textures folder would need to be switched.
     
  46. Hexer_

    Hexer_

    Joined:
    Aug 25, 2016
    Posts:
    94
    Thank you for replying.. I deleted the post because it seems something else is causing the issue and I didn't want to bother you.
    After I switched off that shader another one was causing the same issue. And then another one etc.
    I'll focus on finishing content for the game and then examine the issues as making a build isn't top priority right now.
    I guess I'll go with the old elimination solution then XD
     
    chingwa likes this.
  47. Hexer_

    Hexer_

    Joined:
    Aug 25, 2016
    Posts:
    94
    @chingwa I need advice about something I noticed.
    I disabled all systems inside Tenkoku, reflection probe, fog and camera effects and still get a 15-20 FPS drops in the scene.
    The only thing that brings back the FPS is when I disable Tenkoku object entirely.
    I did a little bit of research because in one scene I only have an empty sky with sun and noticed the performance drop.
    Can you please give advice what to do to improve performance? Maybe disable some nested objects?
     
  48. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    @Hexer_ I also removed a lot from my scene - stars, aurora, clouds (particles are used instead + custom shadowing), planets, rain, snow, etc, just left sun and moon. Also changed TenkokuModule to call some functions only few times per second depending on Tenkoku time multiplier. 'Baked' TenkokuCalculations.cs to remove all complex trigonometry calculations and to make sun and moon movement constant for each day - the script has just 62 rows now. All that (plus GPU grass) increased fps from 30 to 80 in average. The only problem I still can't resolve is a fog compatibility with LuxWater.
     
    Last edited: Jul 24, 2019
  49. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hello,

    I am strongly considering purchasing this asset, but I have a question.

    Does the asset work, or can it be made to work, with an arbitrary up vector for the player?

    I am working on a space sim where players can land on planets, so the up vector for the scene is not always along the y-axis. All of the other Time of Day solutions that I have looked into don't support this, what about this asset?
     
  50. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    @PhoenixAdvanced No I don't think this will work, unfortunately, as some of the systems in Tenkoku expect that Y = up. Sun, moon star positions might be able to be rotated but clouds and weather effects will not.