Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Azure[Sky] - Dynamic Skybox

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

  1. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Yes it works!
     
    Crossway likes this.
  2. BlueSunsetGames

    BlueSunsetGames

    Joined:
    Nov 19, 2016
    Posts:
    3
    Hi :) Using the asset (both lite and full version) - are there any 'tips' on creating nice summer colors in Lite? I am getting a bit to bright / too yellow xD
     
  3. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    First of all, thanks for using Azure.

    I need a little more information, are you talking about the colors of the sky(skybox) or the lighting of the scene? Or something else?

    For performance reasons the Lite version uses some pre-computed equations and this slightly reduces the parameter options for customization. But you can try play with:
    • The parameters of the Scattering tab to setup the sky color.
    • The parameters of the Lighting tab to setup the directional light and environment lighting.
    Your request is a bit relative because to me the default configuration already seems to be a typical summer day.
    Screenshot1.jpg Screenshot2.jpg

    Another option is to use the Unity post-processing system, you can achieve amazing results with it. If you want to adjust the colors, I think this may be the best option.
     
  4. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    581
    Hi @DenisLemos I leave video with Azure in the Standard pipeline.

    I know you're busy, but I honestly hope you reconsider creating a HDRP version of Azure in the short term. Because my project is migrating to HDRP and I would like to be able to continue using Azure, even if it is paying a little more for the upgrade.

    regards

     
    transat likes this.
  5. pocketpair

    pocketpair

    Joined:
    Jul 7, 2015
    Posts:
    59
    @DenisLemos
    hi, thank you for your great asset. I have a question.

    I'd like to modify cloud shape, and shadow in azure, however I'm not sure how I should modify the tif image.
    Did you create this image by some tool or some techniques?
    upload_2020-3-25_23-28-35.png


    I'd like to create more stylized cloud like this
    upload_2020-3-25_23-29-58.png

    I'd appreciate your advice!
     
  6. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Amazing video.

    Regarding HDRP support, the problem is not adding support for it, the problem is keeping 3 different rendering pipelines updated at same time because with each new Unity update everything can change and make the asset totally broken.



    If you are using the Lite version, see post number #499 where the process of creating the static cloud texture is explained.

    For the full version of Azure the process is the same, but starting from a certain version of the asset that I don't remember anymore, a second layer of static cloud was added, changing a little bit as the final texture is created. In this case, the texture must be created as follows.
    • Red channel: The color luminance(red channel) of the pre-rendered texture of layer1.
    • Green channel: The alpha mask of the pre-rendered texture of layer1.
    • Blue channel: The color luminance(red channel) of the pre-rendered texture of layer2.
    • Alpha channel: The alpha mask of the pre-rendered texture of layer2.
     
    Last edited: Mar 25, 2020
  7. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,818
    @DenisLemos Is there a setting somewhere to prevent Azure Sky from advancing time? In some scenes I don't want the day/night cycle to change at all.

    [EDIT]
    I am trying Day Length set to 0. I think this may work.
     
  8. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi! Yes, this is the correct way.
     
    magique likes this.
  9. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    686
    Any tips for integrating this with Massive Clouds?
     
  10. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Unfortunately not.
    I don't have this asset, but I think if you use the Azure Output System you may be able to control the coverage and colors of the clouds so that it works with the weather system, but it will require a little coding.
     
    transat likes this.
  11. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    686
    Will give it a shot. I’m trying to get a more illustrated / painted look.
     
  12. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    First check with the author if it is possible to disable the sky in the background and use only the clouds. Also check if it is possible to change the parameters and settings by script, if yes, then it should be possible to control it using the Azure Output System.
     
  13. offalfalafels

    offalfalafels

    Joined:
    Mar 10, 2019
    Posts:
    2
    @DenisLemos Hey there! I'm currently working on a project, in which the user needs to be able to split the screen in to multiple views of the same scene. Each needs their own independent time slider. Attached is an image to illustrate our needs. Is this something that can be achieved with your system? If so can you point us in the right direction, please? I'm currently using Unity 2019.3.7f1 using URP. One of the devs implementing this functionality said he couldn't figure out how to achieve this using Azure, and was able to get another sky system to work. The other system looks less than stellar, and I'd very much like to keep the great looks that I can get using your sky system. Thank you in advance!
     

    Attached Files:

  14. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi
    By default Azure will work on multiple views, but you cannot set different time, weather or any settings for each of the views because the asset was not developed for this purpose and also if I am right, Unity does not support this behavior.

    You can actually reproduce this behavior using Azure, but you need to make some adjustments and it will not be fully functional because of Unity's limitations.

    To render Azure on different screens you will need to follow a few steps:
    • Azure uses the "Shader.SetGlobal()" command to update the shader properties at once. This means that even if you use different skybox materials on each camera, the same value will be set for all of them. The solution is to update the properties locally on each material using the command "Material.SetVector()", Material.SetFloat() "etc...
      I can send you the scripts with these necessary changes by private message if you want. In fact, I think it’s better to implement this for the next update as well.

    • The next step is to duplicate the sky material and thus create a different sky material for each subscene. Add the "Skybox" component to each of your cameras and define the corresponding sky materials you have created. This way, each camera will render a different skybox material.

    • Add the sky prefab to the each subscene, and in the "References" tab of the "SkyController" component, set the respective sky material that you created in the previous step. Use the same sky material that you seted in the camera.

    • Create a layer for each subscene and configure the Culling Mask for each camera to render only the objects of that subscene.

    • Select the directional light of each sky prefab and configure the Culling Mask so that the directional light illuminates only the objects of that scene.

    • Remember to set the right layer for each sky prefab as well to prevent the camera in one subscene from rendering the particle effects of another subscene.

    • If you want to use the fog scattering, you will also need to duplicate the fog material and do the same steps as you did with the sky material. It is also necessary to add the fog scattering effect for each camera and define the appropriate material in the script inspector.
    That's the result I got:
    Screenshot1.jpg

    In the image below I changed the weather of the third subscene to "HeavyRain", as you can see the other subscenes were not influenced.
    Screenshot2.jpg

    I can also send the project by private message if you want to take a closer look. Note that I did this using the Standard Render Pipeline, I have not yet tested it using the URP, but I think the only difference is that you will need to create 3 (ForwardRenderer) with a Fog Feature using a different fog material and in the renderer property of each camera you need to set the renderer feature created for that subcene.

    Now let's talk about the problems and why I think this behavior is not possible to achieve using Unity.
    Let me know if I'm wrong, but with Unity it is not possible to set a different ambient color for each subscene. The properties of the "Lighting" window work globally and refer to the values defined in the active scene. It would be wonderful if the Render Settings could be configured locally on each camera, it would take Unity to another level.

    Perhaps a solution for this would be to set the "Environment Lighting Source" to "Color", set the Azure profiles to a gray ambient color and play only with the intensity and color of the directional light.

    [Edited] Apparently if you set in the "Lighting" window the "Environment Lighting Source" to "Skybox" the lighting seems to work very well on each of the screens.

    [Edited2] To the version 6.0.2 I added on the "Options" tab of the "Azure Sky Controller" component the option to update the shaders locally on each material. So, set the "Shader Update Mode" on the "Options" tab of the "Azure Sky Controller" component to "By Material" and follow the instructions above to run different sky settings on different views at same time.
     
    Last edited: Jun 1, 2020 at 8:08 PM
    ftejada likes this.
  15. offalfalafels

    offalfalafels

    Joined:
    Mar 10, 2019
    Posts:
    2
    @DenisLemos Great, thank you very much for the quick and detailed response! We will try this out, and report back our findings. I appreciate you my dude!
     
  16. notprashanth

    notprashanth

    Joined:
    Mar 6, 2015
    Posts:
    1
    We updated to Version 6.0.1 recently. After the update, we noticed a huge drop in our game rating as many were complaining that the game got stuck on the loading screen. After going back and checking all the things we had changed from a previously working version, we have discovered that the issue is being caused by Azure. If we remove Azure, the scene loads properly. Note that this issue is only happening on a select range of Samsung Galaxy devices. Azure 6.0.1 otherwise works properly on majority of devices.

    These are the list of devices on which the problem can be observed. List of devices on which the loading issue appears to be happening.
    1. Galaxy Tab A (2016) (gtaxllte)
    2. LG K8 (mm1v)
    3. Galaxy A5(2016) (a5xelte)
    4. Galaxy Xcover3 (xcover3velte)
    5. Galaxy J3(2017) (j3y17lte)
    6. Galaxy A50 (a50)
    7. NoteTab_Pro (NoteTab_Pro)
    8. Galaxy S6 (zeroflte)
    9. Galaxy S10 (beyond1)
    10. Liquid S1 (a10)
    11. Galaxy Tab S2 (gts210wifi)
    12. Galaxy J7 (j7y17lte)
    13. Galaxy A71 (a71)
    14. Galaxy S10+ (beyond2)
    15. f202_f22_p10
    16. Galaxy J3 Star (j3topltetmo)
    17. Galaxy M10s (m10s)
    Is this a known issue? Can you help us fix it? Right now, we are considering downgrading to Azure 4.3.x which we were using earlier.
     
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    Unfortunately (or fortunately) I am not a mobile developer and Azure never was and still is not targeted to mobile devices, so I do not have much knowledge about the brands and models of mobile devices to assist you in the best way. I'm actually surprised that you're using Azure on mobile devices.

    But if the problem is with the game loading, my only suspicion is the format and resolution of the textures. Try setting a compression and resolution format suitable for your target platform in the textures import settings, so the textures should take up less space in the memory and consequently improve the loading time. As well as deleting from the package all files that you will not use will also improve the loading and build time.
     
  18. PROE_

    PROE_

    Joined:
    Feb 20, 2016
    Posts:
    32
    Hi, just wanted to ask about the performance and rendering times of this asset. I'm making a tycoon game so I'm pretty concerned about the speed but I gotta say it looks gorgeus and I would really love to have that asset in my game!
    Great job :)
     
  19. Realgar

    Realgar

    Joined:
    Sep 30, 2012
    Posts:
    26
    Hi I used the new version of your great asset, and I want to keep a progress bar with weather transitions. I wanted to re-use an old script :
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.AzureSky;
    4.  
    5. public class AzureUIController : MonoBehaviour
    6. {
    7.     public AzureSkyController skyController;
    8.     //public Slider slider;
    9.     public Image transitionBar;
    10.     private Vector3 m_scale;
    11.  
    12.     // Update is called once per frame
    13.     void Update ()
    14.     {
    15.         //skyController.timeOfDay.hour = slider.value;
    16.         if (transitionBar)
    17.         {
    18.             //m_scale = new Vector3 (skyController.weatherTransitionTime, 1.0f, 1.0f);
    19.             //transitionBar.rectTransform.localScale = m_scale;
    20.         }
    21.     }
    22. }
    But timeOfDay.Hour and weatherTransitionTime seems to not exist anymore ? How could I use my bar ?
    Thank's !!!
     
  20. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    This is somewhat relative and depends on many factors:
    • The amount of pixels on the screen rendering the skybox or the fog scattering.
    • Whether the climate particles are active or not.
    • If there is a weather transition going on.
    • Whether local weather is being used.
    • If the reflection probe is being used.
    • etc...
    So it's hard for me to tell you a rendering time and performance because for each feature you want to use it will have a cost in performance. If you want the best features use Azure[Sky] Dynamic Skybox, if you want less features and the best performance use Azure[Sky] Lite.



    Starting from version 6.0.0, Azure uses a different component for each task, this makes things more organized, easier to use and access from other scripts, so to find the variables, you need to access the right component. The time-related variables are in the "AzureTimeController" component and the "weatherTransitionTime" variable of the "AzureSkyController" component has changed the name to "globalWeatherTransitionProgress".

    Try this script:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.AzureSky;
    4.  
    5. public class AzureUIController : MonoBehaviour
    6. {
    7.     public AzureSkyController skyController;
    8.     public AzureTimeController timeController;
    9.     public Image transitionBar;
    10.     public Slider slider;
    11.     private Vector3 m_scale;
    12.  
    13.     // Update is called once per frame
    14.     void Update()
    15.     {
    16.         timeController.timeline = slider.value;
    17.         if (transitionBar)
    18.         {
    19.             m_scale = new Vector3 (skyController.globalWeatherTransitionProgress, 1.0f, 1.0f);
    20.             transitionBar.rectTransform.localScale = m_scale;
    21.         }
    22.     }
    23. }
     
  21. Realgar

    Realgar

    Joined:
    Sep 30, 2012
    Posts:
    26
    I will try, thank's alt for your reactivity !
     
  22. PROE_

    PROE_

    Joined:
    Feb 20, 2016
    Posts:
    32
    Okay, sadly Azure[Sky] Lite, to my knowledge, doesn't have weather system and I'd preffer to buy the full version if its performance would suit my needs.
    Skybox would not be rendered all the time, the camera works like in The Sims. The main focus of the game is office so only in specific cases sky will be seen. But I would like to make a good use of the fog. I want to limit player's view distance with it. I think I don't need climate particles. The weather will be global because player is locked with the camera to single office. Reflection probe will be possible to disable in game settings so this doesn't bother me much.

    Typical view for the game (so probably the only thing player will see here is fog and rain when weather is bad), this is were game should run pretty well:
    upload_2020-4-18_14-28-20.png
    Worst possibly view where I need part of the skybox and fog, here it can drop few frames, that's not much of a big deal:
    upload_2020-4-18_14-41-48.png

    Thanks in advance :)
     
  23. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi, sorry for the delay.
    Check your inbox messages.
     
    PROE_ likes this.
  24. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    333
    Hi,

    I've just integrated Azure with my project, in URP and using Crest. I'm really happy with the result, it looks fantastic and is very well designed. A delight to work with.

    However, I may have misinterpreted the store screenshots slightly. The fog horizon blend works perfectly, as does looking down, but I was hoping that looking up also blended fog to the skybox. I'm working on a flight sim, so have some objects at high altitude that stand out quite strongly when viewed from below.

    Are there settings that would help to fully blend fog to the skybox at all angles, or is this not currently supported?
     
  25. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    First of all, thanks for using Azure and for your kind words.

    I understand what you mean, you want objects at high altitudes to be hidden by the blue sky as if they were fading into space. Unfortunately Azure is not very suitable for flight simulators because it does not support altitude variations and the fog calculation makes the objects whiter when very far from the camera without taking into account the altitude. The clouds are also rendered directly in the skybox, so no matter how higher the object is, it will always be rendered in front of the clouds.

    A simple solution that may work if you are not using the clouds, but only the sky, is to open the "FogScattering" shader and modify the zenith calculation by this:
    Code (CSharp):
    1. float zenith1 = acos(length(viewDir.y));
    2. float zenith2 = acos(saturate(dot(float3(-1.0, 1.0, -1.0), depth)));
    3. float zenith = lerp(zenith2, zenith1, saturate(viewDir.y)) * _Azure_FogScatteringScale;
     
  26. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    333
    Hi Denis,

    That fixed it for my needs, thank you!

    Those other considerations are ok, as I don't require skybox based clouds. The sim is also low-altitude enough not to worry about altitude in Azure.

    Cheers

    EDIT:
    I found this line already commented out in the shader actually worked better for my purposes:

    float zenith = acos(saturate(dot(float3(0.0, 1.0, 0.0), viewDir)));
     
    Last edited: Apr 22, 2020
    DenisLemos likes this.
  27. Realgar

    Realgar

    Joined:
    Sep 30, 2012
    Posts:
    26
    Hello, your asst is great !
    Is it possible to trigger some random lightning effects during gameplay with a particular profile (like heavy rain) ? Or if this is a fonction to randomly call, is it possible call it from th profile ?
     
  28. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    Azure does not come with a system for trigging lightning or changing the weather randomly because this is something that must be done by the user. Imagine how many games of the most varied types are being made using Azure, so it is impossible for me to create a system that works in all use cases.

    If you want to trigger events or do anything related to any current sky setting, the easiest way is to access the public property called "settings" defined in the "AzureSkyController" component.

    Using your case as an example, you can access the "settings" property of the "AzureSkyController" component to check the value of the variable that stores the intensity of the heavy rain. If the value of this variable is within the range specified by you, then call the method from the "AzureEffectsController" component that instantiates the thunder effect.

    You can use a counter to instantiate the thunder effect at random time intervals and as you may already know, the thunder effects are created in the "Thunder" list of the "AzureEffectsController" component, so when you instantiate a thunder effect in the scene, you can also choose a random element from the list.

    I created a very simple script with this mechanic and it works very well. You can extend the script to add more functionality.

    Just add this script to some empty GameObject in your scene and drag the Azure prefab instance to the component fields. Press play and change the global weather to the heavy rain profile.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class ThunderEffectExample : MonoBehaviour
    5. {
    6.     public AzureSkyController skyController;         // Drag the sky prefab here!
    7.     public AzureEffectsController effectsController; // Drag the sky prefab here!
    8.     public float minTimeToPlay = 2.0f;
    9.     public float maxTimeToPlay = 30.0f;
    10.  
    11.     private float m_counter = 0.0f;    // Change it temporary to public to see it working in the Inspector
    12.     private float m_timeToPlay = 0.0f; // Change it temporary to public to see it working in the Inspector
    13.     private int m_thunderID = 0;
    14.  
    15.  
    16.     // Start is called before the first frame update
    17.     void Start()
    18.     {
    19.         m_timeToPlay = Random.Range(minTimeToPlay, maxTimeToPlay);
    20.     }
    21.  
    22.     // Update is called once per frame
    23.     void Update()
    24.     {
    25.         m_counter += Time.deltaTime;
    26.  
    27.         // If reach the time to play the effect
    28.         if (m_counter >= m_timeToPlay)
    29.         {
    30.             // Just access the "AzureSkyController.settings" to get the current value of each sky properties
    31.             // Take a look at the "AzureSkySettings" class to see all the property names
    32.  
    33.             // Check the value of the heavy rain intensity
    34.             if (skyController.settings.HeavyRainIntensity >= 0.9f)
    35.             {
    36.                 // Select a random "Thunder Effect" from the "Thunder" list
    37.                 m_thunderID = Random.Range(0, effectsController.thunderSettingsList.Count);
    38.  
    39.                 // Instantiate the thunder effect
    40.                 effectsController.InstantiateThunderEffect(m_thunderID);
    41.             }
    42.  
    43.             // Reset the counter
    44.             m_counter = 0.0f;
    45.             m_timeToPlay = Random.Range(minTimeToPlay, maxTimeToPlay);
    46.         }
    47.     }
    48. }
     
  29. Realgar

    Realgar

    Joined:
    Sep 30, 2012
    Posts:
    26
    It works very fine, thank's a lot for your reactivity and the script !!!
     
  30. will_catkins

    will_catkins

    Joined:
    Oct 11, 2018
    Posts:
    18
    Hello, is there any water plugin or advise that can adapt to your precompute sky, especially the normal display of water when the camera's height is gradually changed from 0 m to 10000 m?
    Thanks very much!
     
  31. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,014
    I'm working on my game optimization and I faced a wired performance issue with "AzureSkyMaterial"! Inside an empty scene with my camera if I place "AzureSkyMaterial" instead of "Defualt Skybox" inside lighting windows it reduce frame rates from 67 to 58! (There is no sky prefab in the scene at all) Only changing Default Skybox with AzureSkyMaterial reduces around 9 fps.
     
  32. DavidCraig

    DavidCraig

    Joined:
    Sep 10, 2019
    Posts:
    3
    Hi, I'm wondering if theres a way to have standard unity particles be rendered under the fog? I'm using the mobile/particles/vertix list blended shader for the particle material, and I can't find a way for the particles to not show right through the fog, is there a way I can hack it to work?
     
  33. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    Unfortunately not, but take a look at Crest that should be the best water system for Unity and probably your best option. If this asset is not useful for you, then the only alternative I see would be to make an ocean system yourself from scratch or pay thousands of dollars for someone else to do it for you.


    Hi!
    I don't even know what to say, you're trying to use Azure on a hardware that can handle an empty scene at 67 frames only. Maybe the best solution in this situation should be to use a regular skybox instead.


    Hi!
    The fog scattering effect is rendered in the scene after opaque objects and before transparent objects (this is the standard way that such effects should work on Unity and probably on other engines out there). So the solution to apply the effect to transparent objects as well is to edit the transparent shaders to calculate the fog directly on each object instead of using the post processing technique.

    Azure comes with some shader files containing all the necessary calculations for this implementation ready for you to use on your transparent shaders, but you need to make some simple edits to the transparent shaders where you want to enable the effect.

    See the .pdf file with instructions for supporting transparent shaders in the documentation folder.

    In the "Shaders" folder you will find some particle shaders already edited to support the fog scattering effect, you can also use these shaders as a reference to learn how to edit your custom transparent shaders.
     
  34. pocketpair

    pocketpair

    Joined:
    Jul 7, 2015
    Posts:
    59
    @DenisLemos
    Hi, I'm currently using Azure with stylized water (https://assetstore.unity.com/packages/vfx/shaders/stylized-water-shader-71207).

    I faced same problem with this topics (atmospheric scattering/fog issue, related with transparent.)
    https://forum.unity.com/threads/azure-sky-dynamic-skybox.322773/page-17#post-3628414
    https://forum.unity.com/threads/azure-sky-dynamic-skybox.322773/page-17#post-3630571
    https://github.com/crest-ocean/crest/issues/62

    I read your documentation (Transparent Support.pdf) but this describes how to modify vertex shader and fragment shader, not surface shader.
    I checked stylized water shader(StylizedWater_Desktop.shader) but it looks used surface shader.
    Can you tell me how to modify it to support transparent/scattering/fog?
     
  35. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    Adding fog support to surface shaders should be even simpler because usually a surface shader already comes with the global vertex position computed and usually it is not necessary to write the vertex shader.

    Try the following:
    • Add this line of code along with the other includes:
      #include "Assets/Azure[Sky] Dynamic Skybox/Shaders/Transparent/AzureFogCore.cginc"

    • Add this line of code to the surface shader after the final c.rgb computation to apply the fog to the output color:
      c.rgb = ApplyAzureFog(float4(c.rgb, 1.0), i.worldPos).rgb;

    • The final lines of the surface shader should look like this:
      c.rgb = staticSwitch857.rgb;
      c.rgb = ApplyAzureFog(float4(c.rgb, 1.0), i.worldPos).rgb;
      c.a = OpacityFinal814;
      return c;
    With these simple edits, the fog must be working now. Please remember to remove the shader attached to your post because it belongs to a paid asset.
     
  36. pocketpair

    pocketpair

    Joined:
    Jul 7, 2015
    Posts:
    59
    @DenisLemos Thank you for your quick advice! Now it works.
    Also I removed referred shader. I didn't know the manners. Thank you for your point.
     
  37. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    140
    Hi !

    How can i change the weather for an different weather profile each X seconds ? I dont understand your documentation with SetNewWeatherProfile().
    Thanks you !
     
  38. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!
    You need to write the method passing as parameter the index number of the corresponding target profile in the "Global Weather Profiles" list located at the "Azure Sky Controller" Inspector.
    Screenshot1.jpg
    If you call the method as follows:
    SetNewWeatherProfile(5);
    The weather will change to the profile number 5 on the list, which in the image above is configured with the "HeavyRain" profile.

    Set the parameter to -1 to change the weather back to the default day profile.
    SetNewWeatherProfile(-1);

    The example script below changes the weather for a random profile from the "Global Weather Profiles" list and also resets the counter for a new random time range.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class Example : MonoBehaviour
    5. {
    6.     public AzureSkyController skyController; // Drag the sky prefab here!
    7.     public float minTimeCounter = 10.0f;
    8.     public float maxTimeCounter = 30.0f;
    9.  
    10.     private float m_currentTime = 0.0f;      // Change it temporary to public to see it working in the Inspector
    11.     private float m_counter = 0.0f;          // Change it temporary to public to see it working in the Inspector
    12.     private int m_profileIndex = 0;
    13.  
    14.     void Start()
    15.     {
    16.         m_counter = Random.Range(minTimeCounter, maxTimeCounter);
    17.     }
    18.  
    19.     void Update()
    20.     {
    21.         m_currentTime += Time.deltaTime;
    22.  
    23.         // If reach the time to change the weather
    24.         if (m_currentTime >= m_counter)
    25.         {
    26.             // Select a random profile from the "Global Weather Profiles" list
    27.             m_profileIndex = Random.Range(-1, skyController.globalWeatherList.Count);
    28.  
    29.             // Performs the profile transition
    30.             skyController.SetNewWeatherProfile(m_profileIndex);
    31.  
    32.             // Reset the counter
    33.             m_currentTime = 0.0f;
    34.             m_counter = Random.Range(minTimeCounter, maxTimeCounter);
    35.         }
    36.     }
    37. }
     
    Black_Raptor likes this.
  39. Natoff

    Natoff

    Joined:
    Feb 24, 2017
    Posts:
    6
    Hi.

    I have a problem when update Azure Sky to lastest version. Direction Light Rotation change from 45,180,0 to 89.98,0,0. Can I change this rotation back to the old one. If I can please tell me how to do.

    Thank you.
     

    Attached Files:

  40. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!

    The directional light is rotated automatically by the "Azure Time Controller" component, so the only way to change the directional light rotation is by changing the time, date and location settings.

    You just need to set the time of day as you used it in the previous version. I just set the "Timeline" property of the "Azure Time Controller" component to a value of "9.0" and the directional light rotation was exactly the way you want it.
    Screenshot1.jpg
     
    Natoff likes this.
  41. Natoff

    Natoff

    Joined:
    Feb 24, 2017
    Posts:
    6
    Thank you. :)
     
  42. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    140
    I got a little problem i'm actually work to make that work on multiplayer :

    I sync the time of day from the server to all client, the server set the weather each X second like in your code, and and apply the skycontroller, after that he sync the skycontroller for all client, and as you can see that work perfectly, but the problem is : the meteo dont change
    i don't really know why because the profil weather is rightly updated did i miss something else ?
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Unfortunately I am completely noob about programming multiplayer games, but if the weather is not changing it could be for the following reasons.
    • The "SetNewWeatherProfile()" method is not being called on all clients or is not even being used / triggered. That is the most likely reason.

    • If you are using the same sample code that I provided in the previous post, it is possible that coincidentally the same profile is being defined by the "Random.Range()" method, but this is very unlikely to happen.
    I noticed in your screenshot that the variable "CurrentTime" has a value much higher than the value of the variable "Counter" and this should not happen if you wrote the code correctly as exemplified. Note that in the example script the code snippet with the "SetNewWeatherProfile()" method is within the following conditional:

    // If reach the time to change the weather
    if (m_currentTime >= m_counter)
    {
    // The code to set the new profile and reset the counter.
    }


    As you can see, this conditional prevents "CurrentTime" from being greater than "Counter", so there is something wrong going on here.
     
  44. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    140
    On my screen those variable wasn't used anymore, it's the rest of something i tried for over thing, what's i mean by "weather doesn't change" it's on client side, on the server the weahter change correctly but not on the client, while the client and server have the exactly same weather profil index, it's look like sync the index profil on SkyController doesn't update the weather, because on Skycontroller the SetNewWeatherProfile() are not updated even if you change the globalWeatherIndex value, i will work on hook for update that on client side based on the server calcultion profile. I'll come back if i get there.
     
  45. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    The weather is changing correctly only on the server because you are using the "SetNewWeatherProfile()" method only there.

    At the same time that you change the weather on the server, you should also send a message or something like that to call the "SetNewWeatherProfile()" on each of the clients.

    Synchronizing the value of the "globalWeatherIndex" between client and server will not have any effect, you should also not modify its value expecting the weather to change automatically because this variable is not used for this purpose and you should use it as a read only.

    Do not change the value of "globalWeatherIndex" because it is used internally by the sky system and this can break the weather system. To change the weather on the client side, as mentioned above, you need to call the "SetNewWeatherProfile()" method locally on each client.
     
  46. Zeevex

    Zeevex

    Joined:
    Jan 15, 2018
    Posts:
    28
    Hey Denis, hope you're doing well! love the asset!

    Just wanted to give you a heads up, i'm not sure if it's replicable for others, but something i've found is using the beta version of Unity 2020 & URP there seems to be a render pass issue when using the fog..

    this is in the BETA, so there is a possibility that it could be a unity issue, and not the asset.. just posting it to you so if it can be fixed on your end it can be fixed before people begin updating their unity version! :)

    here's a gif of the issue and how i replicated it:
    * Using Unity 2020.1.0b10.3837
    * Azure Sky Full Version
    * Following Azure Documentation steps

    the "Render Pass Event" in the renderer feature by default is set to "After Rendering Opaque"
    the other Render pass events show better results (removes the white fx) but also removes fog..

    https://gyazo.com/cd8f9d2a92381e99b...1EmbMxp8jPLVp6fLGBSfuDldRJ82844Nqt9ZIc9-5iccA

    I made multiple scenes in 2020 version and the problem persisted, and then checked 2019.3 version and it works perfectly as intended.

    hopefully this helps!
     
  47. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    550
    Hi!

    I just installed Unity 2020.1.0b10 to test and managed to make the fog run smoothly.
    Screenshot1.jpg
    I just noticed a strange glitch that produced some artifacts on the horizon when rotating the camera and this was fixed by setting the "Render Pass Event" to "Before Rendering Skybox", but this is likely to be a bug caused because it is a Beta version of Unity.

    The "Event Pass Render" of "Azure Fog Scattering Feature" needs to be set between the "After Rendering Opaque" and "Before Rendering Transparents".

    I couldn't reproduce the same issue as you, but thanks for letting me know, I'll keep an eye on the official release of Unity 2020.
     
  48. Zeevex

    Zeevex

    Joined:
    Jan 15, 2018
    Posts:
    28
    not a problem! I just checked 2020 version again and actually found the issue, it seemed to have been a combination of that horizon & fog glitch and my HDR being turned off my mistake!

    not a major deal for me yet the only reason i was looking into 2020 version was for shadow cascades , there's an issue with them in the 2019.3 version (unity is addressed it in new releases)
    thank you for the quick response & checking in on it!
     
    DenisLemos likes this.
  49. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    140
    Yes exactly i finaly send the globalindex calculated by the server on each client and update the setnewweather on each client directly on theskycontroller update, that's work perfectly
     
unityunity