Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Graphics Azure[Sky] - Dynamic Skybox

Discussion in 'Tools In Progress' started by DenisLemos, May 1, 2015.

  1. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Thank you for the detailed answer!
    Realism is definitely not one of my concerns, but the ability to customize is.

    Since the stars and night sky are a texture I think that would work really well with what I have planned.

    But could you go into more detail about the clouds?

    Are the clouds in this image: https://forum.unity.com/attachments/screen3-png.186852/
    The same clouds as in this video:

    1:50 - 2:20?

    They look pretty different. If they are the same thing and they have that amount of options that would be great.

    What are the options for the clouds? Contrast, Intensity, Color?
    Can the 2D noise you mentioned be changed at least somewhat easily? Or is it fully procedurally generated in a shader?
    Do you think it would be hard to add some sort of texture to blend out the clouds in certain parts of the sky?

    Also, fortunately I have no need for volumetric clouds at all.
    I also doubt I will need a change based on altitude, so I guess I'll simply go with the model that looks best in my scenes. :)
     
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Only the map of the stars is a texture, the rest of the night sky is generated procedurally using the extinction coefficient resulting from the physical calculations. The color of the night sky changes a little depending on the selected sky model because they use different equations to calculate the extinction and also because the precomputed sky calculates the altitude variation. But in general the night sky of the two models work the same way and share the same customization, stars texture and moon texture.

    But this will be different in the next version, because I think it will be better and more productive to separate the sky models in two different systems, making them independent of each other. Because some properties will affect only one of the sky models and not the other, and this will generate a lot of confusion when customizing the profiles.

    The new standard sky model is almost ready, I just need to finish creating the tab to customize the weather, create the snow particle effect and make the vertex shader version.



    They are not the same clouds. The screenshot clouds are 2D dynamic clouds that you can change the color, coverage, speed and direction. These clouds are closer to the cirrus type. You can not change the shape of this cloud.

    The video clouds between (1:50 - 2:20) are static 2D clouds and you can just change the colors. These clouds are a panoramic texture and have no animation, you can create your own static 2D clouds. Here in this post #499 I explained the process of creating a static 2D cloud texture. The package comes with some different static textures to use.

    You can see the clouds working if you test the demo scene of the standard sky model.
     
    dadude123 likes this.
  3. Ali-Nagori

    Ali-Nagori

    Joined:
    Apr 9, 2010
    Posts:
    151
    thanks for the help. all what i wanted is the workaround and that is fine.
     
  4. basil3

    basil3

    Joined:
    Dec 3, 2015
    Posts:
    29

    Thank you for the detailed response Denis. Changed Latitude to 1 and bingo issue solved. No worries about the long response I know how busy life can get!

    Stephen.
     
  5. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    32
    Any update about this feature?
     
  6. Alec-Chalmers

    Alec-Chalmers

    Joined:
    Jul 8, 2012
    Posts:
    16
    When I adjust the settings for the sky in one scene, it affects the setting in another scene. Is the sky controller linked across scenes somehow? It's almost like I'm working with an instance. I had a great setup in one scene for the morning but now it matches the daytime of the next scene.

    Am I doing something wrong?
     
  7. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Azure should work independently in each scene. But as it is a prefab, maybe for some reason what you are defining in a scene, is replacing the setting of other prefab instances in other scenes, which should only happen if you customize directly in the parent prefab in the project folder.

    You can try to break the instance connection with the prefab by selecting the prefab in each scene and clicking on the menu: GameObject/Break Prefab Instance, this will make the prefab copy turn into a common GameObject of the scene. After you have done this, to make sure, you can delete the prefab of the project folder if it is no longer needed.

    Also, if you have not already done so, make sure that all variations of Azure shaders are included in the build. This will prevent future problems when switching from one scene to another. See more here.
     
  8. Alec-Chalmers

    Alec-Chalmers

    Joined:
    Jul 8, 2012
    Posts:
    16
    Thanks very much for your detailed reply. I doesn't seem to be doing it today, not sure what I did differently, but thanks again!
     
  9. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Please make precomputed sky more customizable. It's the best sky I ever test.
     
  10. Alec-Chalmers

    Alec-Chalmers

    Joined:
    Jul 8, 2012
    Posts:
    16
    I have another question if you don't mind. How would I go about changing the sky colour? Does it have to be done with the skybox?
     
  11. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Working in progress...

    The new standard sky model or new Standard Sky System that is how I'll call it now, is practically complete, only a few final adjustments are needed for the release, such as doing the documentation and fixing some bugs that I found at the last minute. The effects of rain and snow particles are ready, and that's how the Weather customization tab of each profile will look.
    WeatherTab.png
    The first 6 properties will control Azure's built-in effects. Unity particles are not very good for performance, so on the Options tab of the sky controller it will be possible to disable the standard Azure particles if the user want to use other types of effects created by third parties.

    OptionsTab.png
    If the user disable the particle effects, the "Keep Wheater Properties Updated" option will appear in the Inspector. If enabled, this option causes the Weather tab's properties to remain up-to-date even with the particles off. Thus the user can still access each property of the Weather tab to use for controlling their preferred third party asset.

    The other properties of the Weather tab do not control anything in Azure, these properties were created to make the user's life easier. The user can access these properties, take their value and use to control for example the amount of snow and wetness of their preferred terrain shader system. If someone has a suggestion of option or property that will be useful to control third-party assets, do not hesitate to suggest that I will do the possible to add.



    Azure is changing, and in the new format, the package will come with two different sky systems that will work independently and each will have a different purpose. The new Standard Sky System is almost complete and will come with many new features and improvements.

    Anyone who buys Azure[Sky] Dynamic Skybox, will get two sky systems and will pay for only one. In fact, the current version already comes with both sky models, but they work on the same system and are far outdated compared to the new Standard Sky System.

    In the next update, the package will come with the new Standard Sky System, and until the new Precomputed Sky System is made, the package will also contain the current Azure version, so the user will be able to continue using the current precomputed sky model.

    I have planned big improvements to the new Precomputed Sky System, but I will not reveal anything now, only during the development.
     
    ksam2 likes this.
  12. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I would like to ask anyone who has any questions, please inform us which version of Azure you are using, and if you are using Azure[Sky] Dynamic Skybox, also inform the sky model you are using and any information that might be useful. This will make it easier and quicker to get a response.​


    If you are using Azure[Sky] Dynamic Skybox v4.1.2 and:
    • Precomputed Sky Model: In the current version of the precomputed sky model it is not possible to change the color of the sky because the data were precomputed using atmospheric values of a clear day.

    • Standard Sky Model: If in the Scattering tab you are using the wavelength as "Precomputed", you can change the color of the sky by changing the "Rayleigh Color and Mie Color" properties of the Scattering tab. If the wavelength is set to "Real-Time", you can simply change the color of the "Lambda" property that will appear in the Inspector when the wavelength is "Real-Time".
    If you are using Azure[Sky] Lite: The purpose of Azure[Sky] Lite is performance, so the wavelength of this version uses precomputed values and you can only change the sky color by changing the "Rayleigh Color and Mie Color" properties of the Scattering tab. I particularly prefer it that way, even when I use the complete version of Azure, I change the wavelength to the precomputed mode.
     
    Quique-Martinez likes this.
  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Working in progress...

    Sound System:
    In my last post about development, I showed the weather customization tab. I had left two properties in the weather tab to control the sound effects of rain and wind, initially these properties would be to control the sound effects of third party assets.

    But I thought better of it and decided to create a sound effects system built into Azure, and I could not have made a more accurate decision. I've created 3 levels of looping rain sound effects, 3 levels of looping wind sound effects and 5 different thunderstorm sound effects.

    In the Weather tab of each profile, the user will be able to set the volume of the 3 levels of rain and wind sounds, and when the weather changes, as with all profile properties, the volume of the sound effects will change smoothly during transition from one profile to another.
    New Weather Tab.png




    On the Climate tab of Sky Controller, I've added a list where the user will be able to add or remove audio clips used to create thunder sound effects. When the user is testing the scene in the Editor, he will only need to press the "Play" button to play the selected thunder sound. If the user presses the "Play Random Audio Clip" button, a random sound will be played from the list.

    To play the thunder sounds during the game, the user will only need to call the following methods through scripts:
    PlayThunderAudioClip (int element_number_from_the_list);
    PlayThunderAudioClipRandom ();

    New Climate Tab.png




    Ps: The new Standard Sky System is now ready to be released, I just need to do the documentation, sample scenes and demo footage. This will only take a few days to get ready.

    This week I intend to provide one or two videos showing the system of profiles, climate change and sound system.
     
  14. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @DenisLemos

    I think you're doing a great job. I hope to be able to show those demo videos very soon.

    A greeting
     
    DenisLemos likes this.
  15. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Working in progress...

    Video demonstrations:
    I just released two of a series of demo videos of the new version of Azure[Sky] Dynamic Skybox.

    The first video shows the climatic changes in a tropical forest usin the new Standard Sky System. In this video I also used the packages:
    For a better experience, use a headset and watch full-screen video in 1080p



    In the second video I used only the standard scene from the Tropical Forest Pack v1.2 which has a better wind simulation than the v1.0. It is also possible to observe a little of the height fog in operation, which is another new feature in Azure.

    In this video no post-processing effects were used, only the Azure sky and fog scattering effect. I used only the height fog and changed the height in each weather profile.

    For a better experience, use a headset and watch full-screen video in 1080p
     
    Last edited: Feb 13, 2018
    Baldinoboy, ksam2, ftejada and 5 others like this.
  16. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Wondering if you were able to add more cloud textures to be able to use for the 2D static clouds section. Right now theres a good 5 but more are always welcome and would be great. OR if you could show a tutorial of how to make your own as well as there a bit different looking just cant take a skybox and throw it in the system for clouds.
     
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Here, in this post, I explain the process I did to create static cloud textures.
     
  18. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    I'd like to test the new version with the weather system. Is this already on the asset store?

    It seems no.
     
  19. basil3

    basil3

    Joined:
    Dec 3, 2015
    Posts:
    29

    Hi Denis,

    Unfortunately, this issue seems to have risen again :( I have tried changing the Latitude to different values other than the 1 that seemed to work but the stuttering is really evident). I again changed time to 0 and the issue goes away but I will of course need a time for the day cycle :) Regrettably realistic time will mean I will need to re-configure the entire days that I previously had which would take a lot of work. I will of course do this if needs be but just wanted to see if you had any other fixes for this?

    EDIT - Actually I have never even tested realistic mode before now but omg I can't believe how much smoother the movement of my character is? Perhaps this was a small issue all along that I just thought was too small to notice? I honestly can't believe the difference in smoothness! - I think I will devote some time to setting up realistic mode.

    Stephen.
     
  20. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    The version with weather system is not yet available in the Asset Store, but will be available in a few days. I just need to finish doing the demo scenes, sample scenes and the documentation.




    I did some quick tests with the new version and could no longer replicate this problem, even setting the latitude and longitude to zero. It's strange that the new version uses the same old version code to rotate the directional lights, so maybe this may be related with the project settings, I don't know.

    But this is more likely to be related to the directional lights' rotation code in simple time mode, so as I release the new version I'll rewrite the simple time mode scripts.
     
    ftejada and marcatore like this.
  21. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Have you planned to insert a way to stop the rain drops when I'm inside an interior space like an house or when I'm under a bridge?
     
  22. basil3

    basil3

    Joined:
    Dec 3, 2015
    Posts:
    29

    Hi Denis,

    Thanks for the reply. Unfortunately, I am seeing the same issue in realistic time mode now :( I have tested turning the day cycle in mins off and on and it disappears when there is no rotation of the lights. This is happening both day and night.

    I did a little reading and it seems that this is just something that can become noticeable in motions that follow a linear path (i.e. there is always the chance that some small stuttering will be there but in linear motion (like the clouds moving and the shadows) it is more noticeable. There was a great post I've just read on the unity forums regarding Update and Time.deltatime: - https://answers.unity.com/questions/275016/updatefixedupdate-motion-stutter-not-another-novic.html

    "Concerning the stutter when using Update: Time.deltaTime is not perfect. In addition, it will contain the time the previous frame took to render, since the current time is of course unknown. So there might arise discrepancies from that, which unfortunately result in visible stutter (which is of course least visible at very high framerates with VSync off). So for example, you have a very smooth constant framerate with say Time.deltaTime==0.01, 100fps. For some reason (task switching, background process, stupid Windows OS programming), your graphics card has a hiccup, and the current frame is delayed by a few ms. Time.deltaTime for that fram will still be 0.01, but the frame takes longer to display, so your object lags behind. Entering Update() again, Time.deltaTime now contains the larger framtime of the previous frame, so you will create a larger motion. But your actual rendering time may have returned to normal. so your object jumps ahead. I don't think there is really anything you can do against that - not in Unity, and probably not outside Unity, unless you have 100% control of your GPU process management so that you can predict the rendering time of a frame with absolute certainty."

    For now I have disabled V-sync as proposed by that thread and it seems to have alleviate the issue and it is far less noticeable. Any way though it might be useful!

    Stephen.

     
  23. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    How do you hide the sun but still keep its properties active. In vue you can hide the sun but still act like its there lighting up the sky and clouds.
     
  24. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    It is possible that each user will need to make a little adaptation to the effects of rain and snow to suit their games, as each type of game is a different case. But most things will be ready for use.

    For example:
    • For performance reasons, particle collisions will be disabled by default. But you just need to select the particles and activate the collisions that the raindrops will be destroyed when they hit a collider. Rain drops are created 30 meters above the sky controller, and the sky controller will always follow the position of MainCamera if this option is enabled. So if your bridge is less than 30 meters high and has a collider, the player will be able to stay under the bridge without getting wet:). Otherwise you will have to adapt the particles to your needs by changing for example the height of the emitter and the lifetime of the drops.

    • The rain drops are created 30 meters high in an area of 50x50 meters, so if the houses are small, simply add a plane with collider above each house that will prevent rain falling inside the house. But if the houses are too large, the best way is to put a trigger on the house entrances to disable the Azure particles by using the SetParticlesActive(bool value) method of AzureSkyController script. And to simulate the rain outside the house, you can place rain particle effects on each window and door and activate these particles using the same trigger used to deactivate the Azure particles.
    Depending on the type of each game, some of these minor adaptations will be needed because I can not configure the system to work in all possible cases. But I believe that in case some users need to do them, they will not encounter many difficulties.;)




    I do not quite understand, are you talking about the solar disk or the brightness concentrated around the solar disk?

    To remove the brightness around the solar disk simply decrease the value of the "Mie" property in the Scattering tab, so that only the solar disk will be visible. I have not added any controls to remove the solar disk because that does not make any sense in this version without weather system.

    In the next Azure[Sky] Dynamic Skybox update, as the sun's disk will be a texture and no longer done procedurally in the shader, it will have a property to control the visibility of the solar disk. This will be useful for hiding the solar disk in rainy or fogness days.
     
    one_one likes this.
  25. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    The new weather system and sounds are nice. I see one problem though. For thunder sounds you'd only want thunder to occur after a lightning strike so you really need to have a lightning effect to precede thunder sounds. Even if it's just brief lighting changes for the flash of lightning.
     
    ftejada likes this.
  26. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I know, everything is ready to add lightning and I already have in mind how I will do it. The problem is that implementing this feature now will require more time and I do not want to take longer to release the next update. The thunder system shown in the video is temporary, many changes will be made.
     
    ftejada likes this.
  27. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,083
    I recently bought AzureSky and love it! It manages to work with all the weird setups I use that previous sky solutions I've used haven't. That said, I've encountered a weird little problem.



    For some reason, there are these weird vertical lines coming off the sun. Have you ever found something like this, and if so, how do you fix them?
     
  28. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi! first of all thanks for supporting Azure.

    I think these artifacts are not coming from the sun, but from the moon. I think the distance from the camera that renders the texture of the moon is very close to the 3D sphere of the moon.

    This is Azure's default setting for the camera that renders the moon, I think this may not be the right setting for you.
    MoonCamera1.png

    When the camera is too close to the 3D sphere of the moon, the texture is rendered with the lunar disc very close to the edges of the texture and causes the artifacts shown in the image below.
    MoonCamera3.png

    So if the position of the moon in the sky is close to the sun, it seems that the artifacts are coming from the sun.
    MoonCamera2.png

    Try to regulate the distance of the camera from the moon sphere. You can change the position of the camera or the recommended one that is to regulate the projection size of the camera.

    PS: "The new version that will be released soon no longer uses this system, now the moon is procedurally generated in the shader using the raymarching technique and no longer needs to use 3D sphere and RenderTexture, this new system has a performance far superior to the old one and in the bargain avoids such artifacts."
     
  29. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    32
    Any ETA for next Azure[Sky] version featuring Weather manager?
     
  30. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    It's planned for this weekend! I want to take advantage of this weekend's free time to write the documentation and send it to the Asset Store so it will also depend on the time the Asset Store team will take to evaluate and accept the update.

    The update will contain the following features:
    • new Profiles System
    • new Climate Control
    • new Sound effects
    • new Height Fog
    • new Calendar System
    • new Moon System redone from scratch
    • new Standard Sky System redone from scratch
    • new Fog System redone from scratch
    • new Curve System redone from scratch
    • new Output System redone from scratch
     
  31. Fortitude3D

    Fortitude3D

    Joined:
    Sep 7, 2017
    Posts:
    155
    Looks beautiful man
     
    DenisLemos likes this.
  32. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Version 4.2.0 of Azure[Sky] Dynamic Skybox has been submitted and is awaiting evaluation from the Asset Store team. The new version should be available shortly.

    I'll leave below links to two standalone demos of the new Standard Sky System.
    Weather Demo
    Gi Demo
     
    marcatore, Hormic, ftejada and 3 others like this.
  33. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    If anyone has not seen it yet, I've come to tell you that the new version of Azure[Sky] Dynamic Skybox with Weather System is now available on the Asset Store.



    I discovered that in the Unity's Particle Pack has a rain effect that is infinitely better than the rain effect I created to Azure, so this weekend I'm going to replace the current rain effect by the rain effect available on the Unity's Particle Pack.

    I just need to do a few modifications to adapt the new rain effect to the sky controller, so the particles will come pre configured to detect collisions and create impact splashes.
    NewRain.png

    PS: If you liked the new version of Azure[Sky] Dynamic Skybox, please leave a review.
     
    Crossway, ftejada and Bartolomeus755 like this.
  34. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    32
    I'm trying to make the fog independent of the Weather profiles eg:

    1 - Foggy Overcast
    2 - Fogless Ovecast

    I've managed to make it work, copying the logic of SetNewWeatherProfile() method (and all related methods and variables) to my own class and applying the blending only to the following variables:

    • fogScale
    • fogBlend
    • fogDistance
    • heightFogBlend
    • heightFogDensity
    • heightFogDistance
    • heightFogStart
    • heightFogEnd

    However, when the transition ends, the effect is rolled back to default look of the current set profile.
    Were could I change the logic so this effect become permanent?

    Regards
    Thiago
     
  35. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Why do you want to change the fog setting using another class if the sky controller does it for you? You can simply duplicate the profile, just change the fog setting, attach this new profile as a new element in the weather list of sky controller and call the new profile using SetNewWeatherProfile() method.

    But if you still want to do it through your own class, it gets a bit difficult for me to figure out the error because it can be caused by several reasons.
    • You may not have applied logic correctly.
    • You need to override the initial setting by the target setting when the transition ends. The transition is only an effect based on the public float weatherTransitionTime, and when the transition ends, this variable is reset to zero and the blend returns to the initial setting, so you must apply the new setting after the transition ends. The sky controller does just that, when the transition ends the current profile is replaced by the target profile.
    • If you've copied all of the logic correctly, it's more likely that you forgot to clear the fog properties settings command on the Update() of AzureSkyController class. So you need to delete the lines of code that take the fog setting from the current profile and apply to the fog variables. Otherwise, if these lines of code continue to work, they will always override the values you set with your own class. Below the lines of code you need to delete from the sky controller update.
      Code (CSharp):
      1. //Update.
      2. void Update ()
      3. {
      4.     //Update Properties.
      5.     if (!isBlendingWeathers)
      6.     {
      7.         fogScale = currentDayProfile.fogScattering.fogScale;
      8.         fogBlend = GetCurveValue (currentDayProfile.fogScattering.fogBlendCurve, currentDayProfile.fogScattering.fogBlendCurveIndex);
      9.         fogDistance = GetCurveValue (currentDayProfile.fogScattering.fogDistanceCurve, currentDayProfile.fogScattering.fogDistanceCurveIndex);
      10.         heightFogBlend = GetCurveValue (currentDayProfile.fogScattering.heightFogBlendCurve, currentDayProfile.fogScattering.heightFogBlendCurveIndex);
      11.         heightFogDensity = GetCurveValue (currentDayProfile.fogScattering.heightFogDensityCurve, currentDayProfile.fogScattering.heightFogDensityCurveIndex);
      12.         heightFogDistance = GetCurveValue (currentDayProfile.fogScattering.heightFogDistanceCurve, currentDayProfile.fogScattering.heightFogDistanceCurveIndex);
      13.         heightFogStart = GetCurveValue (currentDayProfile.fogScattering.heightFogStartCurve, currentDayProfile.fogScattering.heightFogStartCurveIndex);
      14.         heightFogEnd = GetCurveValue (currentDayProfile.fogScattering.heightFogEndCurve, currentDayProfile.fogScattering.heightFogEndCurveIndex);
      15.     }
      16. }
     
  36. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    32
    Thank you for the detailed response.

    I've tried to do it on a another class in order to avoid changing AzureSkyController code, since it would be overwritten by future updates.

    I've noticed that the transition doesn't change any variable on AzureSkyController. Only after transition ends that those are updated.

    The thing is, I have 2 sliders:

    1 - Rain Control : When this one is changed I call SetNewWeatherProfile() normally, and it work wonders.
    2 - Fog Control: This one should control "fog thickness" on whatever Weather Profile is set at the time.

    As this is not possible at the moment what I'll do is get get each profile and make at least 10 copies of it and gradually increase the fog on each one so I can have full control of any combination of rain and fog thickness levels.
     
  37. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    If you are not able to change the values of the sky controller variables, then the best way to set the fog with your own class is to set your custom values directly to the fog shader properties.

    In the sky controller script has the static class Uniforms with all properties of the shaders indexed, including the properties of the fog scattering shader. You can access this class from anywhere to get the address of the properties in the shaders and set your own custom value. But for this, you will need to make the class public, for some reason I forgot to declare the class as public and I will fix this in the next update.

    This is how the addresses of the fog scattering shader properties are listed in the Uniforms class, the only change you need to do here is to set the class as public.
    Code (CSharp):
    1. public class AzureSkyController : MonoBehaviour
    2. {
    3.     //Shader Uniforms.
    4.     public static class Uniforms//Setted as public.
    5.     {
    6.         internal static readonly int _FogScale = Shader.PropertyToID("_Azure_FogScale");
    7.         internal static readonly int _FogBlend = Shader.PropertyToID("_Azure_FogBlend");
    8.         internal static readonly int _FogDistance = Shader.PropertyToID("_Azure_FogDistance");
    9.         internal static readonly int _HeightFogBlend = Shader.PropertyToID("_Azure_HeightFogBlend");
    10.         internal static readonly int _HeightFogDensity = Shader.PropertyToID("_Azure_HeightFogDensity");
    11.         internal static readonly int _HeightFogDistance = Shader.PropertyToID("_Azure_HeightFogDistance");
    12.         internal static readonly int _HeightFogStart = Shader.PropertyToID("_Azure_HeightFogStart");
    13.         internal static readonly int _HeightFogEnd = Shader.PropertyToID("_Azure_HeightFogEnd");
    14.     }
    15. }
    Now you can access the Uniforms class from anywhere and set values directly to the shaders, without having to use the sky controller variables as an intermediary.

    Here is a simple script showing how to use the Uniforms class to set a custom value directly to the shader using another class.
    Note that:
    • You must use the UnityEngine.AzureSky namespace.
    • To access the Uniforms class, you have to do this directly through the AzureSkyController class, instead of using a reference.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class MyFogController : MonoBehaviour
    5. {
    6.     [Range(0.0f, 1.0f)]
    7.     public float myHeightFogDensity = 0.0f;
    8.    
    9.     // Update is called once per frame
    10.     void Update ()
    11.     {
    12.         Shader.SetGlobalFloat (AzureSkyController.Uniforms._HeightFogDensity, myHeightFogDensity);
    13.     }
    14. }
    If you attach the script to some GameObject in the scene, you will notice that the script looks like it is not causing any effect. This is because the sky controller already does the same thing and is overwriting the custom values and does not give us time to see the changes made by our new script.

    What needs to be done is to just delete the snippet of code that sends the values from the sky controller variables to the fog scattering shader. This code snippet is inside the private void UpdateShaderUniforms () method.

    Below are the lines of code that need to be removed from the UpdateShaderUniforms of AzureSkyController.cs
    Code (CSharp):
    1. public class AzureSkyController : MonoBehaviour
    2. {
    3.     //It needs to be constantly updated.
    4.     private void UpdateShaderUniforms ()
    5.     {
    6.         Shader.SetGlobalFloat (Uniforms._FogScale, fogScale);
    7.         Shader.SetGlobalFloat (Uniforms._FogBlend, fogBlend);
    8.         Shader.SetGlobalFloat (Uniforms._FogDistance, fogDistance);
    9.         Shader.SetGlobalFloat (Uniforms._HeightFogBlend, heightFogBlend);
    10.         Shader.SetGlobalFloat (Uniforms._HeightFogDensity, heightFogDensity);
    11.         Shader.SetGlobalFloat (Uniforms._HeightFogDistance, heightFogDistance);
    12.         Shader.SetGlobalFloat (Uniforms._HeightFogStart, heightFogStart);
    13.         Shader.SetGlobalFloat (Uniforms._HeightFogEnd, heightFogEnd);
    14.     }
    15. }
    Now you are free to set any fog setting directly to the shader, and you can do this from any class.
     
    Ttravi likes this.
  38. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    32
    This logic worked wonders, thank you very much.
     
    DenisLemos likes this.
  39. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781

    4.2.1
    • Added compatibility with rain effect available on Unity's Particle Pack.
    • Added rain water spray.
    • Added rain impact splash.
    WaterSplashes.png
     
    Crossway, Shodan0101, ftejada and 4 others like this.
  40. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @DenisLemos

    Do you plan to include lightning bolts and rainbows?

    Regards!
     
  41. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Another question:

    I am testing the latest Azure version of the asset store "package Standard Sky System"...

    In what part can "Source" of Environment Lighting be changed? I've been looking for it and I can not find it.

    Apart I think this option does not work correctly, because when I leave the option "Gradient" from the inspector the "SkyColor, Equator Color or Ground Color change according to the profiles.


    I await your reply, greetings Denis
     
  42. AurimasBlazulionis

    AurimasBlazulionis

    Joined:
    Aug 13, 2013
    Posts:
    209
    Hey, upon updating the package I was greeted by null reference exceptions regarding Azure_ReflectionProbe. Line 2113 to be exact. I think it would be good to check if the object is not null, since the user is not going to use the reflection probes anyways in that case.
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    For now it is not planned to add rainbows. But I've already planned a system of lightning that will illuminate the scene a few seconds before the thunder sounds.



    You do this the same way you would if you were not using Azure, through the Lighting window which is the default way.

    The option to change the settings of the Lighting window directly by the sky controller Inspector was removed, since this option did not make much sense and confused the beginners. It was also done so that the settings previously made by the user in the Lighting window are not changed when dragging the sky controller prefab to the scene.

    In order for the properties Sky Color, Equator Color, and Ground Color of the profiles to affect the scene, you must set the environment light source in the Lighting window as Gradient.



    Sorry, but I could not find this error, not even the line number you mentioned, none of the scripts seem to have that number of lines.

    Maybe there was an import error or did you try to import the package into a project that was already using an earlier version of the sky system?
    • Try to import the package into an empty project.
    • Always save a backup of your project and delete the previous version of Azure or any asset before importing the new version.
    • Many resources of the new version use the same names from the previous version, such as scripts, classes, and textures. So if you try to import the new version into a project that already has the previous version, the Unity import system will mix everything up and will consequently break the previous and the new version.
    • If you do not want to use the reflection probe, simply turn it off in the Options tab of the sky controller. By default the reflection probe is already deactivated.
     
    Crossway likes this.
  44. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Very happy to hear that!!!!

    Thanks
     
  45. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Hi. Great update. Having a bit of an issue with understanding the horizon line and how to adjust it properly for our scene. We have water that stretches out from an island and as you can see in this shot the horizon does not line up properly. Its a bit to high. How would we go about adjusting this? Thanks.

    crittercove.jpg
     
  46. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Sorry, but I did not see anything wrong with your screenshot. The horizon line is that way and it is very common to look a little darker during the sunset.
    Exemple 1
    Exemple 2
    Exemple 3

    You can try changing the physical conditions of the sky by the Scattering tab in the day profile. All the properties of this tab change the appearance of the sky significantly, so it is difficult to tell you exactly which one to change, you have to try each one of them until you reach the desired result.

    It has no property that controls the horizon line altitude, so a workaround to do this is to change the Shader Mode to Vertex Shader in the Options tab of the sky controller. This will enable the skydome and allow you to change the position and scale of the sky sphere, then simply set in the skydome a scale were the sphere involves the whole scene and finally change the y position of the skydome until the horizon line is as you need. But perhaps this solution can make the fog scattering out of sync with the sky.
     
  47. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Thanks for the information. Never really noticed that about the sunsets before, learn something new every day. Will mess with the scattering tag and see.
     
  48. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    4.2.2
    • Fixed stylized sunset mode of the Standard Sky System.
      StilizedSunset.jpg
    The Standard Sky System allows you to switch between Realistic and Stylized sunset mode. I personally prefer the Realistic mode because the characteristic reddish color of the sunset is generated automatically and you can still set a custom color by changing the wavelength or by changing the Rayleigh and Mie color.
    RealisticSunset.jpg

    The Stylized sunset mode was created because many users prefer the previous sky model because it match nicely with cartoon graphics style. But for some reason the Stylized sunset mode got weird in the new version, especially the horizon that showed a strange dark line.
    StilizedSunsetOld.jpg

    I have re-modeled the stylized sunset mode and now it is very similar to the previous sky model and it works great with new features like height fog.
    StilizedSunset.jpg
     
    Last edited: Mar 31, 2018
  49. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    I can't download Azure 4.2.2 with Unity 2017.3 it just downloaded v4.12, also does this new futures also added to Precomputed Sky too? Cause precomputed sky looks a lot more better.
     
  50. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I downloaded version 4.2.2 from Asset Store and imported it without problems, I'm using Unity 2017.4.0f1.

    These new features added starting from version 4.2.0 are only available in the new version of the Standard Sky System, but you will notice that the new Standard Sky System is much better than the old standard sky model of version 4.1.2.

    As I've mentioned in previous posts, the precomputed sky model is the most realistic sky model today, but because it uses precomputed data, it does not have many options for modifying atmospheric conditions, which makes it nonsense to add some features like profiles and climate changes. To use the precomputed sky model, you need to import the "sub-package" named "v4.1.2" which is also included in the main package.
     
    Last edited: Mar 31, 2018