Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Graphics Azure[Sky] - Dynamic Skybox

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

  1. Frostydrop

    Frostydrop

    Joined:
    Feb 5, 2022
    Posts:
    4
    Hi! First, thank you for the asset, it is really great!
    I have a couple questions:
    1) Is there a way to adjust the clouds color to be darker than the sky color?
    2) How can I adjust horizon color to be like this at daytime?
    upload_2023-5-22_16-21-19.png
     
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    Hi,

    Firstly, thank you for using Azure[Sky]!

    Unfortunately, Azure clouds were developed to mix with the sky color and will not get darker than the sky. So you control only the brighter color, for the darker color the shader uses the scattering color from the sky background.


    You mean the dark blue color of the fog scattering? You can just set the Rayleigh gradient color in each weather profile. In the Default profile, it is configured with a white color at daytime, you can change to a blue color. You can also try to change the “Fog Scattering Scale” parameter from the “Fog Scattering” tab of the “AzureSkyRenderController” component.

    Let me know if you need more details.
     
  3. Frostydrop

    Frostydrop

    Joined:
    Feb 5, 2022
    Posts:
    4
    Thank you for the quick answer!

    Azure clouds are great anyway, just wanted to know if there is a possibility to control cloud darkness)

    I was wondering if I can make different color for the mountains in the back (I use height fog to make them colored) and for the horizon sky?
    upload_2023-5-23_11-49-24.jpeg
    Now I can make all gray or all yellow, that`s the way Azure works, or I`ve missed something else?
     
  4. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    In the real world, the fog gets a blue color in the distance mountains, and it fades to white as long as the mountains are getting far away into the horizon. In other words, the near mountains partially covered by the fog should render with a blue color, and the distance mountains in the horizon should be completely hided by the fog in a white color.

    A real world image: This is the expected result.


    For some reason, the fog in Azure at noon don't apply the blue color to the near mountains as in the image above (probably there is some wrong with the fog scattering calculation that I can't find). So the solution for a while is to use the Unity fog to apply the blue color to the near mountains. And because Azure fog will render on top of it, it will automatically fade to the white color at the horizon.
    See the result I achieved in the screenshot below:
    BlueFog.jpg
    Unity fog uses a fixed color, so when the time of day changes, you will need to update the Unity fog color to match the new sky conditions. You can easily solve it by creating a custom property of the gradient type and customize it in the weather profiles, then send the result value to the Unity fog.

    Let me know if you need help configuring the custom property.
     
  5. Frostydrop

    Frostydrop

    Joined:
    Feb 5, 2022
    Posts:
    4
    It is the exact effect that I want! Looks great, thank you!

    I`ve made this properties in _OverrideObject, how can I send the result values to the Unity fog?
    upload_2023-5-24_11-11-49.png
     
  6. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    You can use a simple script that will access the weather controller component, get the custom properties outputs and send it to Unity's RenderSettings.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4.  
    5. public class UnityFogController : MonoBehaviour
    6. {
    7.     public AzureWeatherController weatherController;
    8.  
    9.     void Start()
    10.     {
    11.         UpdateUnityFog();
    12.     }
    13.  
    14.     void Update()
    15.     {
    16.         UpdateUnityFog();
    17.     }
    18.  
    19.     private void UpdateUnityFog()
    20.     {
    21.         RenderSettings.fogColor = weatherController.GetOverrideColorOutput(44);
    22.         RenderSettings.fogDensity = weatherController.GetOverrideFloatOutput(45);
    23.     }
    24. }
    • Add this script to any game object in the scene.
    • Attach the AzureWeatherController component to the “weatherController” field in the Inspector.
    • Replace the parameter number 44 and 45 of the GetOverrideColorOutput() and GetOverrideFloatOutput() functions according to the custom property index you have created. To know the custom property index, just select any weather profile, next to its name there is also the index number.
    • Remember to active Unity's fog in the Lighting window.
    I hope it can help you!
     
  7. Frostydrop

    Frostydrop

    Joined:
    Feb 5, 2022
    Posts:
    4
    Thank you so much for help, It works great! And thank you for azure sky:)
     
    DenisLemos likes this.
  8. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    268
    hi denis
    the skybox reflection update is so slow for about 3-5ms per tick,
    is there any better way to implement skybox reflection without probe?
     
  9. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    Hi,

    Unfortunately, I don't know another way to have real-time skybox reflections in your scene without using reflection probes. You can increase the “Refresh Interval” of the “AzureEnvironmentController” component or change the “Refresh Mode” to “On Awake” if you do not want the reflections in real-time.

    You may try the beta version that came with the package to take advantage of the “Timer System” feature. See the post number #1580 for more details about it. Also see the post number #1588 for the performance tests.

    I hope it can help you!
     
    Baldinoboy and ununion like this.
  10. Roman-Ilyin

    Roman-Ilyin

    Joined:
    Oct 9, 2013
    Posts:
    28
    Hello.
    Could you please tell me when to expect Unity 2023.1 support?
     
  11. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    Hi,

    Have you experienced any issue? I just test it here with the last Unity 2023.1.8f1 in both Built-in and URP render pipelines and all seems to be working ok.

    Built-in:
    Azure_Sky_Built_In.jpg

    URP:
    Azure_Sky_URP.jpg
     
  12. Roman-Ilyin

    Roman-Ilyin

    Joined:
    Oct 9, 2013
    Posts:
    28
    Hello.
    I have 2 errors while open project with 2023.1.9

    Assets\_ThirdParty\Azure[Sky] Dynamic Skybox\Scripts\AzureFogScatteringFeature.cs(80,13): error CS0619: 'ScriptableRenderPass.Blit(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Material, int)' is obsolete: 'Use RTHandles for source and destination'

    Assets\_ThirdParty\Azure[Sky] Dynamic Skybox\Scripts\AzureFogScatteringFeature.cs(81,13): error CS0619: 'ScriptableRenderPass.Blit(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Material, int)' is obsolete: 'Use RTHandles for source and destination'
     
  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    They are always changing the API of the newer URP versions, so you need to import the Azure[Sky] replacement package according to the URP version you are using. In this case, you should import the replacement package called “URP_14_0_7.unitypackage” located at the “_Replacements” folder.
    URP_Replacement_Package.jpg

    According to the errors you mentioned, you may be using an old replacement package that uses the old API.
     
    Roman-Ilyin likes this.
  14. XRLoft

    XRLoft

    Joined:
    Mar 11, 2019
    Posts:
    1

    Is this approach where fog can only be seen at runtime, and the adjustment effect can be seen directly in the editor like ambient light?
     
  15. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    By default, it will work only at runtime, because what does the trick is inside the Update() call. To see the changes also in the edit mode, you can try to add the “[ExecuteInEditMode]” attribute before your class definition. This will force the Update() to be called in edit mode when there is a change in the editor.

    Example:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. [ExecuteInEditMode]
    5. public class UnityFogController : MonoBehaviour
    6. {
    7.     public AzureWeatherController weatherController;
    8.  
    9.     void Start()
    10.     {
    11.         UpdateUnityFog();
    12.     }
    13.  
    14.     void Update()
    15.     {
    16.         UpdateUnityFog();
    17.     }
    18.  
    19.     private void UpdateUnityFog()
    20.     {
    21.         RenderSettings.fogColor = weatherController.GetOverrideColorOutput(44);
    22.         RenderSettings.fogDensity = weatherController.GetOverrideFloatOutput(45);
    23.     }
    24. }
     
    XRLoft likes this.
  16. Wintermute-

    Wintermute-

    Joined:
    Sep 5, 2017
    Posts:
    53
    Hello,

    I noticed that the fog light is going behind objects like walls, terrain, and mountains meshes.
    Lowering the fog intensity does minimize this, but I do like how it looks with the fog being more intense. Is there a way to keep the fog with higher intensity and have it less visible behind objects, or could this be because I have something setup incorrectly?

    I am using Unity 2022.3.4f1 URP and version 7.1.3 of Azure Sky


    Screenshot 2023-08-26 153504.png Screenshot 2023-08-26 153504.png
     

    Attached Files:

    Last edited: Aug 26, 2023
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    Hi,

    This light is from the Mie bright, in the “Scattering” tab of the “AzureSkyRenderController” component there is a property called “Mie Distance” that handle it. You can try to set it to zero, so the Mie bright should not be visible through the objects near the camera.
     
    Baldinoboy and Wintermute- like this.
  18. Wintermute-

    Wintermute-

    Joined:
    Sep 5, 2017
    Posts:
    53
    Worked, thank you.
     
    DenisLemos likes this.
  19. trueh

    trueh

    Joined:
    Nov 14, 2013
    Posts:
    74
    Hi all.

    Simple question. Does Azure work in URP with deferred rendering?

    Regards.
     
  20. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    Hi,

    Yes, it works! Tested using Unity 2022.3.7 LTS.
    DeferredRendering.jpg
     
    Baldinoboy and trueh like this.
  21. egenstep

    egenstep

    Joined:
    Jul 16, 2020
    Posts:
    2
    In my game a character enters a cave. I need it to be dark inside. Lighting will be provided by light sources inside the cave. While using Azure[Sky] Dynamic Skybox there is no darkness inside the cave. It looks like Im in a shadow. After messing with the editor I figured out that variables in script public class AzureWeatherController can help with this:
    environmentAmbientColor - Multiplier
    environmentEquatorColor - Multiplier
    environmentGroundColor - Multiplier
    How do I change these Multiplier in runtime mode from script? Can you show an example of code?
     
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    769
    Hi,

    Setting the multiplier of a custom property is not the best approach, each custom property in the weather profiles supports a configuration value between (0.0 to 1.0), but if you require a value between (0.0 to 8.0)? In this case, you set the Multiplier property from the weather controller to 8.0f, so the output value will return a value between (0.0 to 8.0).

    In the beta version that come with the package, the multiplier was removed because you can set the min and max values of the custom properties, and the multiplier is not required anymore.

    I think in your case, the best approach would be to use a local weather zone covering the cave area. Then you can attach any weather profile to that particular weather zone and configure the blend transition, so when the weather zone trigger enters the local weather zone area, the weather will change to that weather profile.

    The properties you mentioned are available for customization in each profile, you can just set a different color directly in the profiles instead of setting it by script. Note that these properties only make effect in the scene, if the environment lighting source from the “Lighting” window is set as “Gradient”.

    I think this approach is better because you can ease configure a lot more properties directly in the weather profile than handle it in runtime by scripting. And, when the player gets outside the cave, the weather should automatically back to the global weather.

    See this video tutorial that shows how to configure weather zones:


    I hope it can help you, let me know if you need more details.