Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TENKOKU - Dynamic Sky

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

  1. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
  2. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    And that's that. Tenkoku is back to it's normal price where it will stay. Thank you everyone for the successful sale! To all the newcomers I hope you enjoy using Tenkoku. Keep your eyes peeled for the 1.0.9c update which should be available on the Asset Store soon.
     
  3. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Might I suggest that instead of adding more complicated weather automation into JavaScript that the next focus be on C# conversion? Most of us like to control the weather ourselves and any weather automation systems just get in the way of our needs, but a C# conversion would be fantastic and likely increase adoption and sales of the asset.
     
    John-G and chingwa like this.
  4. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    I can see why Chingwa got into coding. Being a chef would be very difficult because he can't see sharp things. :cool:
     
    chingwa and CaptainMurphy like this.
  5. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    @Bagnol Yeah, I would be too busy writing my coffee-focused screenplays.

    @CaptainMurphy Thanks! Yes I might consider doing this. Or perhaps doing both at the same time since there are a lot of customers who ask me about better automation.
     
    John-G and Bagnol like this.
  6. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    If you need some help, let me know. I am swapping from UniStorm to Tenkoku in our project and was about to build a networking manager for it and having a C# version would be VERY helpful.
     
    Bagnol and chingwa like this.
  7. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Thanks Captain! I can do a direct .JS->C# conversion without much trouble I think, however I'm sure I will have issues with the "things I don't know about C#" aspect that would actually make the codebase better/more efficient. Once I have the basics down I'll send you an interim update for you to comment on. This is not going to happen this week, but soon.
     
    Bagnol likes this.
  8. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    I'd love to get some more positive feedback on Tenkoku on the Unity Asset Store. The current rating is being artificially lowered by an unfair review, unfortunately. For those who've purchased recently, and enjoy using Tenkoku, please consider adding a review and rating here:

    https://www.assetstore.unity3d.com/en/#!/content/34435

    Thanks!
     
    Bagnol likes this.
  9. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    Ouch. That review is a bit rough. I mean, the fact that it's in Javascript is right there in the Package Contents box on the store page. One star because they didn't look into the product they were purchasing? That's not even taking into consideration the fact that you were talking about a C# conversion just a few pages back on this very thread.
     
  10. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    For those that don't know the '1 simple trick to make working with JavaScript easier', just drag the scripts folder from the asset (or whole asset folder) into the plugins folder. Bam, you now have reflection working in C#. You can access all variables/method/etc like they were in a C# class.

    I will do up a review later today. I was able to import Tenkoku, set it up in the scene, connect it to existing sliders for environment control, then add it's Encode/Decode to a string to an RPC for networking all in less than 2 hours. People that don't know how to handle the JS code are just new devs that blame their knowledge shortcomings on the code.

    Results from 2 hours of setup and networking Tenkoku. Our code base is 100% C# except for this asset. So just for all the disbelievers out there, it can be done.
     
  11. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    770
    I've been drooling over some of the pictures posted on the Gaia thread, and now here as well, but was wondering about a few things. It seems Tenkoku provides a very realistic environment - if your game takes place on Earth. What about sci-fi environments, with different colored atmospheres, or different celestial objects? Think Avatar for instance, where the "planet" is actually a moon orbiting a gas giant. Or a system with several moons, or a totally different starscape? One that I'm particularly interested in trying would be a Ringworld, as featured in the book. In such an environment the ring would be visible as an arch stretching up above and behind the visible sky, to disappear behind a sun that would be fixed directly overhead. Day and night cycles would be provided by shadow squares orbiting between the ring and the sun. Would there be a way to achieve any of these scenarios using Tenkoku, or would I be stuck with the more conventional skies provided?

    I'm not asking you to actually provide any of these environments, just whether there's a mechanism to add them to Tenkoko if needed.
     
  12. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @FargleBargle
    It's super easy to change the colour of the atmospherics. I was screwing around a couple of weeks back when the heat distortion was first introduced and I had a blue sky, a red sky, an orange sky, a purple sky and a green sky. Was kinda silly looking -but I did it. It was just a matter of adjusting the "Overall Tint" colour, and editing the gradients in the master Colour Texture.

    This first shot is a pretty unprofessional one - I duplicated the moon and placed it really close to the terrain (you can see the actual moon to the left of it). The big moon became detached and just sits there - didn't take part in any orbiting anymore, but it still looks pretty cool. Plus a little changing of the Overall Tint and some post processing courtesy of PRISM. TenkokuMoon.png
    This one is much the same, just a little colour manipulation and without the giant moon.
    TenkokuGreen.png
    The next two are just meant to show what happens when you replace the Milky Way texture with a custom cubemap. Credit for both skyboxes goes to the respective creators at http://skybox.xaelan.com/ and were just used for demonstration purposes.
    TenkokuEarth.png

    TenkokuGalaxy.png

    Beyond these though I'm pretty sure TENKOKU is quite strictly earth-like if you utilize its built in celestial settings. Though only Chingwa would be able to say for certain. As for the Ringworld idea, I'm assuming it's the type of structure that Bungie based Halo on? Unfortunately that's a little beyond my knowledge but with a bit of work I suppose it's *possible*. Once again though Chingwa would have to field that.
     
  13. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    770
    @Bagnol

    Thanks for your response. It's cleared up some of the mystery at least. My question was actually based on this quote from the Tenkoku product description on page 1: "There are no sky boxes or static elements, everything from the clouds to each individual star is it's own individual element with appropriate movement and behavior." I was wondering if that was all hard coded, or if users had the ability to add and change elements and behaviors, because... that would be pretty cool. :)
     
  14. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    I...actually haven't really thought about that. Unfortunately this is one @chingwa will have to answer. It never really occurred to me to see if the planet position calculations and stuff could be changed.
     
  15. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    @Bagnol Thank you for the rating review! It's much appreciated :)

    @CaptainMurphy Oh Man that is beautiful. Glad to hear everything is working well and setup without issue! And thanks for offering your experience with .JS/C# cohabitation. It really isn't the problem some people make it out to be.

    @FargleBargle I will say that Tenkoku is primarily an earth-based system, so the movement of the sun stars moon etc are all specifically tuned to earth rotations. As Bagnol has pointed out, there is a lot of customization that can be done in the overall color/gradient influences in the sky, or changing the night-sky background, in order to get alien worlds.

    While there aren't any 'slots' where you can plugin new moon objects, Hacking the system to include these is relatively easy (simply duplicating the moon and giving it an offset as Bagnol shows, is the most straightforward way).

    Adding a new sun object would be a little more involved, and would involve hacking the code a bit in order to get the expected atmospheric effects/light from the new sun. Again, this is definitely possible, but the system doesn't just give you the option, you would need to add some new code for this.

    All of the movements are hardcoded based on relative latitude/longitude positioning. You can go into the calculation code and change movement settings for the sun/moon but it's all equation based, and I don't really recommend editing this... it is a bit esoteric if you're not an astronomer/mathematician. Since you're curious, below are the coded elements that define the moon positioning...

    Code (CSharp):
    1.     //Orbital elements of the Moon:
    2.         lN = 125.1228 - 0.0529538083 * day;
    3.         li = 5.1454;
    4.         lw = 318.0634 + 0.1643573223 * day;
    5.         la = 60.2666;  //(Earth radii)
    6.         le = 0.054900;
    7.         lM = 115.3654 + 13.0649929509 * day;
    That's probably not the answer you're looking for :D, but since Tenkoku is mainly targeted for earth-realism the movements are actually quite complex. That being said I don't think it would be necessary to change this code... you're much better off using the elements as-is, and providing your own offsets (or offset objects) if needed.
     
  16. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    @Bagnol By the way, you can get your second moon moving simply by keeping it as a child object of either the 'Moon' object or the 'SkySphereMoon' object. It will then rotate across the sky along with the normal moon. (those screens are awesome! :D )
     
  17. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    770
    @Bagnol, @chingwa

    Thanks for the replies. How about simply turning off the planets and sun movement, and replacing the sky background, while retaining the clouds, fog, and other weather elements? I can make a custom Ringworld skybox for instance, and set up my own shadow squares to block the sun periodically, as long as I'm not locked into a system that requires the sun to move. I'd hate to tinker too much with your existing orbital elements, as the math is really beyond me, but I'm OK with a simple on/off switch if that's possible. ;)

    To provide a bit of context, I'm trying to set up a system of portals or stargates connecting different worlds. While most will be fine with Tenkoku's "normal" settings, I'd like to make a few truly alien destinations, like the Ringworld for example. I was wondering if Tenkoku could still contribute some of its wonderful visual effects to those scenes, or if I'd need to find a completely different solution.
     
  18. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Yes, all the elements can be set to either 'Realistic', 'custom'(with a custom offset), or 'off'. So you can turn off elements you don't need, or set them to a specific position sun and moon sizes can also be adjusted if need be. The rest of the visuals can be customized separately... fog, weather, atmospherics etc.
     
  19. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    770
    Thanks. If that's the case, I'll probably be purchasing Tenkoku as soon as the budget allows. Should have got on this sooner I guess, since the sale's over now. Doh! :rolleyes:
     
  20. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
  21. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    Hello. I bought Tenkoku over the sale and just downloaded the new version 1.0.9c to test it out. Importing it in, my horizon seems to be really high. I checked settings the Horizon Height with the demo...both are .34. At my horizon, it's mostly white and the sunrise effects seem to be higher up than expected.

    Also, the moon seems to be following to the right of the sun, but way too close. At night it comes out just a little bit before the sunrise occurs.

    Any ideas?

    Thanks!
     
  22. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Hi @Dramamine0001 The moon/sun relation is based on real-world positions... if you need to adjust the moon position for your scene then try changing the day, or the month until you get the position you are happy with. This of course also affects the phase of the moon as well. If you want a full moon then it should be positioned directly opposite the sun. For example, try setting the date to be March 5, 2015.

    As for the horizon, if you post a screenshot I may be better able to tell you what's happening, but I suspect it might be due to the color mode in Unity. If you're using gamma mode especially, the brightness tends to blow out. In general it's recommended to use linear, with hdr and tonemapping on your camera. But this shouldn't be a requirement. post a screen and I'll see if I can figure out whats going on.
     
  23. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    @chingwa

    Thanks for the reply. So, a lot of this might be me being new to graphical programming (10 yrs. + of C# though), but my horizon looks huge. Also, the back side of everything (facing away from sun) is really dark...almost black, while my sand is simmering bright orange.

    For now, I'm using the Unity third person controller which I noticed the camera has HDR disabled and greyed out. I'm switching to a different controller soon.

    Thanks!
     

    Attached Files:

  24. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    @Dramamine0001 Yes I think this is just do to using gamma/non-hdr rendering modes in Unity, as the sky is blowing out while looking toward the sun. Try the following...

    1) go to edit-->project settings-->player and set the 'color space' mode to 'linear'.
    2) on your scene camera, click the 'hdr' option.
    3) add tonemapping to your scene camera (go to components-->image effect-->color adjustments-->tonemapping).

    This should give you a smoother tonal range in the sky and this type of blown-out highlight should be reduced. That being said, if this really bugs you then send me an email at konnichiwa[at]tanukidigital.com and I can walk you through editing the shader to get something you might like better.

    As for the shadows, this is due to Unity's ambient color settings. You can adjust this with Tenkoku under the configuration tab with 'ambient tint'. Try either brightening the color, or lowering the alpha slider down to 0.
     
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I'm very tempted to buy this, but lack of mobile options is a big drawback. There is no chance of some mobile fallbacks, is there?

    Also, can you post a few more screenshots of the night sky? I really want accurate and gorgeous night skies and I see a hint of Milky Way in one screenshot, which would be fantastic. Can I see more? How is that effect created?
     
  26. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Hi @gecko No, unfortunately I don't have plans to ensure mobile fallbacks, nor to do a mobile version of Tenkoku. If anything I would want to be moving in the opposite direction, i.e. adding more advanced effects and features, instead of trying to conform to mobile tech limits. I certainly understand the demand for mobile-compatibility, but don't find the technical limitations worth the trade-off. Sorry!

    There is a milky way skybox texture that renders behind everything, the strength/visibility of which can be adjusted to suit your tastes. There are other various aspects of the nightsky that can be adjusted and it can be set anywhere from a realistic dark night, to a more game-friendly lit night environment.

    The below screenshot shows the same scene, first with much darker overall lighting, and a sightly brightnesed milky way, as well as a brighter overall scene with the milky way almost turned off completely. The stars and the milky way background can be adjusted separately.

     
    ksam2 and TheSeawolf like this.
  27. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,779
    If you happen to be using Gaia, this is all done for you with the new Gaia GX. @chingwa has also done a nice Tenkoku integration :)
     
    TheSeawolf, Bagnol and chingwa like this.
  28. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Sold!
     
  29. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    And OMG, with the the Star and Galaxy rendering options, this is the best thing I've ever seen. Thank you for taking such care with this stuff.

     
    chingwa likes this.
  30. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Okay, one nitpick: The moon really shouldn't be visible in the new moon phase like here. Looks cool, but inaccurate. (And in fact, even in crescent phase, the dark part of the moon shouldn't really be visible, but that's less egregious than seeing the new moon.) Is it possible to fine-tune that?

    EDIT: I guess this is a broader issue with the moon often visible in the daytime. Maybe there should be a way to make the moon invisible when the sky brightness is above a certain threshold?
     

    Attached Files:

    Last edited: Feb 8, 2016
  31. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Thanks @gecko ! The moon is designed to be visible in the daytime, but the shadowed section of the moon should not be visible... can you confirm that you have the TenkokuFog effect on your camera? This is supposed to help obscure this artifact.
     
  32. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Yeah, it is, and this is in your demo scene.
     

    Attached Files:

  33. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Ah, so it is! The 'Fog Dispersion' attribute under the atmospherics tab influences this to some degree, but I'll see if I can get this artifact completely eliminated in the next update.
     
  34. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    @chingwa
    tenkoku2.jpg

    I already had the color space set to linear. After adjusting the ambient color settings the lighting looks a lot better. Using the Standard Assets third person controller, it's camera has the HDR off and disabled (greyed out) so I can't turn it on or use tonemapping. I assume this is something to do with that controller. I'm learning UMA and then integrating it with a different third person controller. I'll test the HDR setting as soon as I get this far to see if it fixes the horizon.

    Thanks again for the help.
     
  35. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    @AdamGoodrich

    Thanks for the reply. I own Gaia and in fact bought Tenkoku over another asset based on you using it so much and seeing integration on the way. Waiting on 1.5 to really get going with it. Thanks again!
     
    AdamGoodrich likes this.
  36. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    This is now fixed. I had to reformulate a few things in order to address this but the moon is now working exactly as would be expected. I'll send you an email with a small update patch. Let me know how it works on your end.

    @Dramamine0001 I'm not sure why a controller would be disabling the hdr button, but let me know if you continue to run into this issue.
     
  37. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    @chingwa

    So when dropping other cameras in my project and even creating new scenes the HDR on all my cameras is off and the checkbox is greyed out. When creating a new project, I'm able to turn on HDR just fine on the main camera. I'll setup a similar scene to see how Tenkoku looks, but it's looking like something to do with my project. Thanks!
     
  38. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    @chingwa

    I noticed Unity constantly processing something...showing Reflection Probe loading bar in the bottom right. When I disable Tenkoku it stops and comes back as soon as I re-enable it. Have you seen this?
     
  39. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    @Dramamine0001 Yes this is a bug. I have a new patch mentioned above that should fix this, and also some moon/atmospheric rendering issues. If you'd like to try it then send me an email to konnichiwa[at]tanukidigital.com and I'll send it to you.
     
  40. Dramamine0001

    Dramamine0001

    Joined:
    Mar 23, 2014
    Posts:
    84
    This stopped the constant processing and also seemed to bump up performance a good bit. Thanks!
     
    chingwa likes this.
  41. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    FYI, Chingwa's fix totally solved this issue. The moon looks fantastic now at all times of day and night.
     
    chingwa likes this.
  42. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    :) Coming soon...

     
  43. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Awesome! Can we get some heavy fog looking versions too? Something with a heavy rain and rain mist.
     
  44. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    Sure, here's an additional capture with more rain/fog and a bit of a lighter overcast scene, so you can see more detail. I don't yet have a "rain mist" system in place (as in cascading sheets of rain?), but will look into adding one soon. Once this is finalized I'll put out a video so you can hear the omni-directional thunder effects as well.

     
  45. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    108
    hey,

    I'm not sure if this is a bug or something in my scene that's messing up but there is a white tint on meshes. The image below is Tenkoku on and off. I have the fog effect on my camera, using linear, HDR on, Tenkoku fog is off and the rest is default.

    Any ideas?
     

    Attached Files:

  46. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    You can try turning off the built-in reflection probe in Tenkoku, under the 'Configuration' tab? Also make sure that when Tenkoku is on you disable other directional scene lights as they might be over-brightening objects in your scene?
     
  47. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    108
    It was the reflection probe. thanks
     
  48. awrightmgt

    awrightmgt

    Joined:
    Oct 13, 2014
    Posts:
    3
    Noticing a couple issues causing some frame rate drop.

    In the TenkokuSkyFog.OnRenderImage method you have a call to :

    Code (CSharp):
    1. fogRender = GameObject.Find("Tenkoku_SkyFog").GetComponent<Camera>().targetTexture;
    This should really be moved to the Start(), doing a Find every frame can be very expensive.

    Also, in TenkokuCalculations.js the GetElementData method does a bunch of string comparisons, Unity profiler is showing this doing almost 1200 string comparisons a frame. It would be nice if this was change to an enumeration or numeric constant.

    Just a couple things I have noticed doing an optimization pass for our game.
     
  49. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,789
    @awrightmgt Thanks for the input! The camera find function needs to be able to update during play in some cases (for example, camera switching between multiple sources), but I agree there is room here for some optimizations. I'll look into these suggestions for the next update. :)
     
  50. DarkXess

    DarkXess

    Joined:
    Sep 30, 2014
    Posts:
    136
    I have been playing around with this and trying to fix it for a while now though just gave up lol... I have got everything working fine, using Gaia too, but I am getting this cloudy white around my night scenes as you can see, I have gone through everything and disabled it one by one to see which it is that is causing it, how can I just have a dark night without any cloudy white shadowing as such:

    http://i.imgur.com/vXHalOV.jpg?1

    Thanks :)