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. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Current not, Azure is not targeted to mobile devices, some costumers said in the asset review they are using Azure in mobile devices, but to be honest I doubt they are using it full features, maybe they are using only the sky material, no clouds, no fog, no particles, etc...
    • Current, the fog scattering is a full screen post-processing effect. This means the shader calculations are made by each pixel in full screen every frame, which is not good for mobiles.
    • The sky material is also with the most calculations made in the pixel shader because it runs only as a skybox.
    • I think the rain, storm and snow particles will also impact the performance, actually I think it will kill the performance in mobile devices.
    I'm working on a new version of Azure[Sky], for this new version I'm planning a lot of performance improvements:
    • For the fog scattering, there is no other way than to compute it in the fragment shader, but it can be first rendered to a RenderTexture that we can at last set it to a low resolution and save performance.
    • To the sky material, I want to add the option to render it as a custom skydome mesh in the scene, so most of the calculations in this case can be made in the vertex shader. Current the default Unity skybox mesh is very low poly, so if we place the calculations in the vertex shader, it will cause mesh artifacts.
    • For the particles, current, I don't know any solution than decrease the max amount.
    • There is also the Refresh Mode feature that is another great performance improvement I'm implementing that will allow set a time interval for the entire system to be updated. With this feature the timeline will be running, but the lighting, the celestial bodies(sun and moon), the sky render, the fog scattering render, the reflection probes, the GI, the weather system, etc... Will only be updated in time intervals defined by the user, saving a lot of performance in old hardware. If I'm not wrong, the GTA 3 or GTA SA had a day-night cycle system that worked similarly to this one.
    I don't know if with this performance improvements, the asset will support mobile devices, but after that, I don't know where to save more performance than just turning off some features.
     
    Last edited: Apr 11, 2022
    Lars-Steenhoff likes this.
  2. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    84
    I sometimes can't set the values of the some rulers anymore (they get stuck, can't change them at all). I am using URP, latest 2020 Editor.

    I got the following code:

    Parameter name: index
    System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0)
    UnityEngine.AzureSky.AzureWeatherController.EvaluateCurrentWeatherProfile () (at Assets/Azure[Sky] Dynamic Skybox/Scripts/AzureWeatherController.cs:431)
    UnityEngine.AzureSky.AzureWeatherController.EvaluateWeatherProfiles () (at Assets/Azure[Sky] Dynamic Skybox/Scripts/AzureWeatherController.cs:276)
    UnityEngine.AzureSky.AzureWeatherController.Update () (at Assets/Azure[Sky] Dynamic Skybox/Scripts/AzureWeatherController.cs:99)​

    Could that be a reason?

    I am avoiding the asset currently because of that. Thank you for help in advance.
     
  3. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    When you can't change some parameter directly by the component, it means that these parameters are being overwritten by the "Override System" of weather controller component, so you need to look for that parameter and set it in the profiles. In the profiles are all the custom properties we want to work with the weather system, the weather system will perform the profile blends and weather transitions and send the resulting value to the target properties configured in the "Override Properties" list. If you can't change some parameter of Azure components and directional light, it means that parameter is a target property of the weather system, and always you try to change it, it is instantly overwritten by the weather controller.

    Regarding the console errors, it is from the "EvaluateCurrentWeatherProfile()". I think it is a setup issue, maybe you change some configuration?
    • Check if a default weather profile is set in the weather controller Inspector.
    • You need to set the weather controller component with all the profiles using the same "OverrideObject.asset". If you use a profile with a different "OverrideObject.asset", it will trow the "ThrowArgumentOutOfRangeException" error because the custom properties count in the profiles may not be the same.
    • The weather controller also needs to use the same "OverrideObject.asset" for the same reason.
    • So check if you are not using a profile from a different custom properties' family.
     
    bvonline likes this.
  4. CydonianKnight

    CydonianKnight

    Joined:
    May 19, 2012
    Posts:
    54
    Hello, thanks a lot for creating this cool asset, I'm using it with Unity 2020.3.24 and the URP. In my game I am pausing the time (setting timeScale to 0.0f) but still want to be able to control the sky/day-night-cycle using keyboard input. I have it working so far that, with the game paused, I can change the time of day by using SetTimeline() on the AzureTimeController but visually the changes will only be applied once I resume the game (reset timeScale to 1). I'm guessing there is some way to force an update of the visuals, so could you please tell me which function(s) I would have to call to do that. That'd be great!
     
  5. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Azure should be updated in this order:
    • Firstly, you need to set the timeline by calling "SetTimeline()" on the "AzureTimeController" as you are already doing.

    • Second, you need to update the light transforms and some stuffs that will be used later to evaluate the profiles by the weather controller component. Here we need some code from the Update() and some code from the FixedUpdate() of the time controller component. I think the best option is to create a new public method to run this code, so add this to the "AzureTimeController" script and call it after you set the new timeline:
      Code (CSharp):
      1. public void UpdateTimeStuffs()
      2. {
      3.     EvaluateTimeOfDay();
      4.     ComputeCelestialCoordinates();
      5.     EvaluateSunMoonElevation();
      6.     SetDirectionalLightRotation();
      7. }
      Now we are done with the time stuffs.

    • Now, we need to update the profiles properties according to the new time of day and send the resulting values to the targets properties in the targets components of the override properties list. For this, you just need to call "EvaluateWeatherProfiles()" method on the "AzureWeatherController" component, note that this method is private by default, you need to edit the script and set it to public.

    • All the target components should be now with the new values resulting from the profiles blend, but some parameters still need to be sent to the shaders, so we can see the changes in sky and fog. The best way to proceed is to call the "LateUpdate()" on the "AzureSkyRenderController", note that this method is private by default, you need to edit the script and set it to public.

    • I think it is all you need to update, optionally you can call "UpdateReflectionProbe()" on the "AzureEnvironmentController" to update the reflections.

    Let me know if you need more details.
     
  6. CydonianKnight

    CydonianKnight

    Joined:
    May 19, 2012
    Posts:
    54
    Works like a charm, thanks a lot for your quick reply!
     
  7. CydonianKnight

    CydonianKnight

    Joined:
    May 19, 2012
    Posts:
    54
    Hi there, one more question from my side: Is it somehow possible to combine the sky created by your asset with another HDRI/Skydome to show some sort of landscape on the horizon instead of the flat horizon? For instance, I would like to have some distant mountains in the background but wouldn't really want to put the geometry there. Usually I would just use a skybox material for that but since that slot is already occupied now, I was wondering if there is another way to do that.
     
  8. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Sorry the delay, I've been very sick these days.

    I think a regular skybox or cube map will not work in this situation, even if I find a way to merge a custom skybox with Azure, a lot of issues will occur. The sky is rendered in the background and will always render to the depth buffer the value of 1 (the depth buffer is a texture with a range between 0-1, 0 for the pixels rendering objects near the camera and 1 for the pixels far away), the HDRI and cube map are flat images and don't have any depth information, so it will never work with the fog scattering because it is impossible to calculate the distance.

    I don't know how your game works, but I would use low poly meshes or something similar to an old asset called Horizon[ON], I think it was removed from the Asset Store. Or maybe use images of the landscape in layers, with one layer in front of another, this way each layer can draw to the depth buffer and receive the fog scattering.
     
  9. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    154
    Hey there, hope you feel better man! I was wondering if you had any suggestions for getting some custom water solutions working with the Fog Scattering, there's a water asset called KWS that i recently switched to, and was looking to add Fog combability to the shader. Just wondering if you have a guide for how to integrate with some custom solutions, but if not no worries!
     
  10. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Unfortunately, I don't have this specific water system.

    But, in the first post of this forum, there are few examples/instructions showing how to edit some water assets to support Azure fog.

    In general, what you need to do is call the function "ApplyAzureFog(targetColor, worldPos)" in the water shader to apply the fog color over the water surface color. The function requires the final water color as float4 input and the water world position as float3 input, it will output the water color now with the fog color computed as a float3.

    So you need to find in the water shader where is the last instruction that sets the water surface color and use "ApplyAzureFog" like this:

    myWaterSurface.rgb = ApplyAzureFog(float4(myWaterSurface.rgb, 1.0), input.WorldPos);


    input.WorldPos is the world position coming from the vertex shader, generally it is computed in the vertex shader, but most water shaders already have this by default, sometime using a different name.
     
  11. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    154


    Hey thanks! Lol even better, when i went to start exploring the KWS shaders, apparently Azure is ALREADY integrated! All I had to do was uncomment the #Include for Azure in the "KWS_Water" and "KWS_WaterTesselated" shaders!

    If you wanted to update the currently integrated water assets lol
     

    Attached Files:

    DenisLemos likes this.
  12. idontcareabouthis

    idontcareabouthis

    Joined:
    Jan 27, 2018
    Posts:
    9
    Hi. Fog shows up in the scene view but not game view on Unity 2022.1.3f1 and URP
     
  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    I just tested it using Unity 2022.1.3f1, and it is working without any problem!
    Untitled.png

    If the fog is showing in the Scene view, it means the fog is working ok, and the game camera may be configured wrong or missing some setup. Check if your main camera is using as "Renderer" a renderer.asset with the fog scattering feature attached to it, and also check if the "Depth Texture" of your main camera is "On".

    I hope it helps!
     
  14. TMC_Will

    TMC_Will

    Joined:
    Mar 25, 2020
    Posts:
    1
    Hey, first just wanted to say thanks for making and supporting this great asset of yours.

    I just wanted to clarify, as I think you answered this previously, but I might be drawing the wrong conclusion(s). Is it possible to use this asset solely to create dynamic clouds in a scene that an object can move through? And, if so, do you have any quick tips as to how one would accomplish that?
     
  15. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Thank you for your kind words about the asset.

    Unfortunately, Azure clouds are not volumetric, so objects and the camera can't fly through the clouds. But you have the option to disable the clouds to render only the sky at the background in case you have any third party cloud system that needs a sky and time system.
     
  16. idontcareabouthis

    idontcareabouthis

    Joined:
    Jan 27, 2018
    Posts:
    9
    it was the depth texture.. Thanks!
     
  17. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    Hi,

    i want to change my weather via script, i let the player choose a weather in Start Menu and save with a button in PlayerPrefs:

    Code (CSharp):
    1. public void Clear()
    2.     {
    3.         PlayerPrefs.SetInt("Weather", 0);
    4.     }
    When i load the game the Azure Prefab is in scene.I have the Profiles 0 -7
    my idea was to Get the INT and call the correct weather that the user choosed with:

    Code (CSharp):
    1. SetNewWeatherProfile(int index)
    I tried it direct in the controller:

    Code (CSharp):
    1.  /// <summary>
    2.         /// Starts a global weather transition. Set the index to -1 if you want to back the global weather to the default weather profile.
    3.         /// </summary>
    4.         public void SetNewWeatherProfile(int index)
    5.         {
    6.             switch (index)
    7.             {
    8.                 // Back to the default weather profile currently in use
    9.                 case -1:
    10.                     if (m_defaultWeatherProfile)
    11.                     {
    12.                         m_targetWeatherProfile = m_defaultWeatherProfile;
    13.                         m_weatherTransitionLength = m_defaultWeatherTransitionLength;
    14.                         m_weatherIndex = -1;
    15.                     }
    16.                     break;
    17.  
    18.                 // Changes the global weather to the corresponding profile index on the global weather list
    19.                 default:
    20.                     if (m_globalWeatherProfilesList[index].profile)
    21.                     {
    22.                         m_targetWeatherProfile = m_globalWeatherProfilesList[index].profile;
    23.                         m_weatherTransitionLength = m_globalWeatherProfilesList[index].transitionLength;
    24.                         //m_weatherIndex = index;
    25.                         m_weatherIndex = PlayerPrefs.GetInt("Weather");
    26.                     }
    27.                     break;
    28.             }
    29.  
    30.             // Starts the global weather transition progress
    31.             m_weatherTransitionProgress = 0.0f;
    32.             m_weatherTransitionStart = Time.time;
    33.             m_isWeatherChanging = true;
    34.         }
    My coding skill are a bit weak, can anybody help?
    Because it loads always the default :(
     
  18. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    I would do it this way:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4.  
    5. public class SaveWeatherExample : MonoBehaviour
    6. {
    7.     AzureWeatherController weatherController;
    8.  
    9.  
    10.     public void SaveWeather()
    11.     {
    12.         PlayerPrefs.SetInt("WeatherIndex", weatherController.GetGlobalWeatherIndex());
    13.     }
    14.  
    15.  
    16.     public void LoadWeather()
    17.     {
    18.         weatherController.SetNewWeatherProfile(PlayerPrefs.GetInt("WeatherIndex"));
    19.     }
    20. }
    So, when you want to save the current weather, just call "SaveWeather()".
    And, when you want to load the saved weather back, just call "LoadWeather()".

    SaveWeather: This method just save the index number of the current weather in use.

    LoadWeather: This method load the saved index and use it as parameter of "SetNewWeatherProfile(int index)" to change the weather back to the saved one.

    I hope it helps!
     
    Andreas12345 likes this.
  19. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    It helps great! Thank you!
     
  20. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    Are there any instructions on how to make Azure play nice with GPUInstancer? I am seeing grey/foggy instanced vegetation rendered everywhere - basically ignoring the Z buffer it seems.
     
  21. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Are you talking about the pluging called "GPU Instancer"?

    Unfortunally, I don't have this asset to test and there are no instructions from my side. But if the vegetation are not drawing to the depth buffer, I think there are two alternatives if the issue is with the fog scattering, I'm presuming.
    • Edit the vegetation shader to make it draw to the depth buffer
    • Edit the vegetation shader to make it support the fog scattering locally by calling the Azure function ApplyAzureFog() on the final color outputted by the vegetation shader.
     
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Baldinoboy likes this.
  23. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    DenisLemos likes this.
  24. Wolvman92

    Wolvman92

    Joined:
    Oct 31, 2021
    Posts:
    12
    Hi, just wondering if there is any way to get rid of the pixilated look of the clouds? I see a lot of squares in them and hard edges. Thanks.
     
  25. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    You need to play with the cloud texture import settings by setting it to bilinear in case it is set to point and try a better compression mode!
     
  26. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    Do you have any recommendations or caveats on how to render multiple suns or moons?
    It looks like adding another sun texture is straight forward by adding another SunMatrix property in the Empty/Dynamic/Static shaders. But what about inscattering? Is it possible to iterate over multiple bodies and just add to the inScatter variable?
     
  27. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    To be honest, with this sky system you will not be able to get multiples suns or multiple moons. Most calculations are directionality dependent, so you need to compute it one time for each extra sun and extra moon. The asset also is not designed for this purpose, so I think it would be easier to create your own render from scratch than try to implement it in Azure.

    It is not just iterate over multiples objects, there are a lot of other factors to take into account.
     
  28. DenisLemos

    DenisLemos

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

    Persistent Time: After a long time building my new setup (my old computer stopped working last year), now I'm finally back to my regular work flow and a new version is on the way. This is a simple, but useful feature to keep the time of day persistent between scenes. It is very simple to use, you can set the Start Time Source to be initialized using the local timeline value that you define on the Inspector, or you can set it to be initialized using the global time.

    If the start time source is set to From Local Time, the time of day will be initialized using the default value you leave on the timeline slider, there is nothing especial here. The time controller component, always writes the current time of day to the global time variable, so if you configure the time controller in some scene to use the start time source as From Global Time. That scene will start the time of day using the last value that was written to the global time on the last scene, and this way the time of day will be persistent in the next scene.

    The global time is stored in AzureNotificationCenter.GlobalTimeInfo.timeline, so you have direct access to it from everywhere, and it is very easy to integrate it to your save system.
    PersistentTimeFeature.png

    Important: The new version will not be backward compatible! So pay attention and always save a backup of your project before import a new package to it. Initially, it will be released as a beta sub package, so you test it only if you want, but it is important to already know it will not be backward compatible with the current version cycle.
     
  29. DenisLemos

    DenisLemos

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

    New Prefab Hierarchy: The new version will have a new prefab hierarchy, now instead of attach all the controller components to the parent transform, the entire sky system will be organized according to each sub system. This way, you can just delete from the prefab the system or feature you do not want to use. For example, you can delete all the controllers and keep using only the time controller to control your scene time, without cause any issue.
    SkySystemHierarchy.png

    New Parent Component: The prefab parent will have a new component called AzureSkySystem.cs that implements some useful new features that you may use to better control your scene. This component is also used in the editor for some automations while configuring the other system controllers.

    Azure Sky System: As said above, this new component is responsible for some new features and editor automations. I will list here and in the next posts, all this features. The first one is the Follow Targets, the follow targets is a list where you can set a follower and a target transform, this just update the follower transform position to always be at the target transform position. I use it to make the particles always visible to the main camera as the camera moves around the scene.
    AzureSkySystem.png
    If you change the SoundFXs to work as 3D audio, you can use this feature to make the SoundFX transform follow the main camera, this way the sounds will always be listened by the camera. When entering some cave, you can just change the target to a transform located at the cave entrance to stop the SoundFX follow the camera. This way, as the camera go deep in the cave, the rain sound will fade because of the distance.
     
    Lars-Steenhoff likes this.
  30. DenisLemos

    DenisLemos

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

    Timer System: The timer system is a new feature where you can create a list of timers, set a time count down to it, and when the timer reaches the desired time, it calls the Unity Events associated to it. This new feature is simple, but very useful, I'm using it to update all the sky controllers every 0.1 seconds. This way, instead of update the controllers every frame, we can save a lot of perform by updating it in time intervals. We can increase the Refresh Rate of the sky system update timer to gain more performance and reproduce the old GTA game's behavior that update the day-night cycle and the lighting every 2 maybe 3 seconds.
    TimerSystem.png
    Tip: You can increase or decrease the Refresh Rate according to your game quality settings.

    To feature above actually be effective for the performance, you need to set the UpdateMode on the AzureTimeController, AzureWeatherController and AzureRenderController to be Externally instead of Locally Every Frame.
    UpdateMode.png
    When the update mode of some component is defined to externally, the component will not be updated automatically every frame, and you are responsible to update it manually every time you want. By default, the time controller, the weather controller and the sky render controller are being updated externally by the timer feature of the AzureSkySystem.cs component.

    Tomorrow I will continue to posting news regarding the new features, there are a lot more things to show!
     
  31. DenisLemos

    DenisLemos

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

    New Weather Controller: The weather controller received some changes and improvements. The Weather Profiles will not work as ScriptableObject anymore, instead it will work as regular GameObjects and will be called Weather Presets. Every time you add an item to the Global Weather and Local Weather Zone lists, it will automatically create a child GameObject with the required components ready for use. So, the weather settings are made on these weather presets game objects. Below is a screenshot of the AzureWeatherController, note that it may change until the release date:
    NewWeatherController.png


    New Custom Properties System: Now, the custom properties are very easy to set up and very easy to understand how it works. As you can see in the screenshot above, you can create the custom properties directly on the AzureWeatherController.cs component.
    Below are the types the new custom properties supports:
    • Float;
    • Color;
    • Curve;
    • Gradient;
    • Texture;
    • Vector3;
    After creating a custom property, it will show in the Weather Presets for customization. Below is a screenshot of the custom properties available on each weather preset according to the setup created on the previous screenshot.
    NewWeatherPreset.png

    After customizing the weather presets, the weather controller will perform the weather blends and transitions and store the outputted value of each parameter in its custom property. So you can access these outputs by code and use/send it to any script, variable, shader parameter, third party asset, etc...

    If you don't want to use code, you can enable the Override System of each custom property to setup the targets. This way, the weather controller will automatically override the target variable using the outputted values from its respective custom property.

    As you can see in the screenshot below, the Override Mode of the first custom property from the list was enabled, and configured to override the intensity target property of the Light target component of the Directional Light game object.
    NewOverrideSystem.png
    It means the intensity of the directional light will be automatically controlled by the weather controller according to the values you set on each weather presets for that respective custom property.

    The Override System will support to override the following target types: Note that it needs to match the custom property type (float, color, curve, gradient, texture and vector3).
    • Property;
    • Field;
    • Global Shader Uniform;
    • Material Property;
    • Global Property;
    • Global Field;
    Yes, you will be able to use the override system also to override properties on static class, for example, the RenderSettings. In the screenshot below, you can see the custom property configured to override the Environment Lighting Intensity of the Unity Lighting window, by scripting we do it through the RenderSettings API.
    StaticOverrideProperty.png

    Other features of the custom property system:
    • You will be able to set a min and max value for customization, when it returns a float type.
    • You will be able to add, delete and reorder the custom property list without cause any issue like in the current asset version.
     
    Last edited: Aug 18, 2022
  32. DenisLemos

    DenisLemos

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

    Skybox Fog: This is a feature from the very olds versions of the asset that is back, it is just a regular skybox with a post-processing effect that uses a variant of the skybox texture without the clouds and projects it over the scene. It is a very cheap feature if all you want is just to use a regular static skybox.
    SkyboxFog1.jpg SkyboxFog2.jpg


    How it works? There are two variants of the same panoramic sky texture, one with the clouds to be used by the skybox, and the other without the clouds to be projected on the scene through a post-processing effect.
    SkyboxFogTextures.jpg


    If you have different sky textures, you can create a custom texture property to integrate it with the weather system and blend between different skybox textures. Below, you can see a GIF with the transition from one skybox texture to another using the weather system.
    SkyboxFog.gif
     
    Rukas90 likes this.
  33. DenisLemos

    DenisLemos

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

    AzureSoundFX: The sound effects are now completely independent, the old AzureEffectsController.cs component was removed, and the sound effects are now controlled locally directly on each audio source. With the custom property system, you can just create a new custom property to control the AudioSource volume, but it is not the best option.

    Azure[Sky] offers a new component called AzureSoundFX.cs that you can attach to any audio source you want to be controlled by Azure. Then you can create a new custom property and configure it to control the volume from the AzureSoundFX.cs volume. Below is a screenshot of a custom property configured to control the volume of the component AzureSoundFX attached to an audio source game object.
    AzureSoundFXCustomProperty.jpg
    But, why set the volume through the AzureSoundFX volume than do it by directly accessing the AudioSource volume? Because AzureSoundFX component automatically plays the audio if the volume is higher than 0, and it also automatically stops the audio if the volume is zero.


    AzureParticleFX: The same behavior above, works for the particles, but each particle have attached to it the component called AzureParticleFX.cs, and we control it through the public property called Intensity. So, the component automatically Play() and Stop() the particle emitter according to the value you set to the Intensity property. Below is a screenshot of a custom property configured to control the intensity of the component AzureParticleFX attached to a particle game object.
    AzureParticleFXCustomProperty.jpg
     
  34. DenisLemos

    DenisLemos

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

    Azure Event Controller: The events were removed from the AzureTimeController.cs component and placed in an independent component. This way, you use it only if you want.
    NewEventSystem.jpg

    You can also register to the events by code through the AzureNotificationCenter.cs.
    Code Example:
    Code (CSharp):
    1. private void OnEnable()
    2. {
    3.     AzureNotificationCenter.OnDayChange += OnDayChange;
    4. }
    5.  
    6. private void OnDisable()
    7. {
    8.     AzureNotificationCenter.OnDayChange -= OnDayChange;
    9. }
    10.  
    11. private void OnDayChange(AzureTimeController timeController)
    12. {
    13.     throw new System.NotImplementedException();
    14. }
     
  35. I-Jusa-I

    I-Jusa-I

    Joined:
    Feb 19, 2020
    Posts:
    2
    upload_2022-8-23_21-18-18.png

    Hi, I've been trying to setup azure and ran into some issues as I can't seem to find anything that controls this blue hue in the sky.

    This is a screenshot of the "morning" sky I currently have, and I don't want any blue in the sky at all. Any clues as to where this blue hue is coming from? Is there a gradient for it somewhere?

    Also, a tiny bit of feedback I have so far: It would be useful to have a curve graph for fog intensity during different times of the day / night cycle. This would allow me to create morning / night mist effect without creating a separate wheater profile for them.
     
  36. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Firstly, welcome to the forum, and thank you for using Azure[Sky]!

    Azure[Sky] is physically based on the Earth atmosphere, and this is more or less how the light scattering works here on our planet atmosphere. At the daytime, the sky color goes from a dark blue from the top, to a white color on the horizon. As you can see in the screenshot below.
    DaySky.png

    At night the atmosphere is the same, the only difference is that there is less light scattering. This means the horizon will not be so white because there is not much light concentrated on that position.
    NightSky.png

    That blue hue you are talking about, is the transition from the dark blue at the top of the sky to the white color at the horizon. But at night there is less light and less white color, so the blue hue is more visible. This is generated automatically by the atmosphere equations, there is not much we can do. You can play with wavelength parameters from the “Scattering” tab of the “AzureSkyRenderController” component, but the hue will never disappear because it is a color transition from the top to the horizon. This means that even if you change the sky color and horizon color, the hue will still be there.

    I want to do try some experiments for the next version to make it more customizable, but it is not guaranteed that will work.


    It is already available, this is why the “Custom Properties” feature exists!

    The property that controls the fog on the weather profiles is a custom property, but by default it is set to “Slider Type”, you can just change it to a “Curve Type”.
    So, select the “_OverrideObject.asset” on the “Profiles” folder, find on the Inspector the custom property you want to change and set the “Customization Mode” to “Timeline Based Curve”.
    CustomProperty.png

    Now, when you return to the weather profiles, that custom property will show up for customization as a curve.
    FogCurve.png

    I hope it helps!
     
    I-Jusa-I likes this.
  37. I-Jusa-I

    I-Jusa-I

    Joined:
    Feb 19, 2020
    Posts:
    2
    Thanks for the reply!

    Yeah I assumed it was from some sort of atmosphere equations.

    I am trying to do some very different sky effects and thats why it kind of became and issue. I'm trying to create a nigth sky with light pollution casting in the horizon that transitions into a very greyish winter sky in the day. Its a bit problematic as during the winter there sometimes is almost no blue in the sky at any point.

    I'll try to figure something out.
     
    DenisLemos likes this.
  38. DenisLemos

    DenisLemos

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

    The first beta release of the new version in development is on the way, it will be released as a sub-package on the current version, so you can test it before the final/official release. Below you will find some simple performance tests.


    This is an editor test of the current version (v7.0.7), with the entire system being updated every frame.
    Note the render time, the CPU time and the FPS:
    Test1.jpg


    If you want to get real-time reflections of the sky and scene according to the time of day changes, you need to use a reflection probe. Azure came with a default reflection probe ready to use, and this is how it performs the same test above, but this time with the reflection probe enabled. As you can see, it highly increased the render and cpu time, and the fps dropped a lot. It is not because Azure is slow or Unity is slow, if you want a real-time reflection, this is the costs.
    Test2.jpg


    To get a very nice real-time global illumination, we need to call the Unity method called DynamiGI.UpdateEnvironment() to update the environment cubemap when there is a change on the scene lighting or when there is a change on the skybox color, etc... But, if we call it every time, this is what happens: Just compare it with the first image.
    Test3.jpg
    As you can see, by calling the DynamicGI.UpdateEnvironment(), the performance goes away, so this is not used by the current Azure[Sky] version (v7.0.7). And this is the reason the night GI sometimes is too brighter when the scene starts at daytime, it is because the environment cubemap is updated by Unity only at the scene start when the lighting is brighter. If you start a scene at night, the daytime GI will be a bit dark for the same reason.


    In some posts above, I talked about the new Azure[Sky] feature called “Timer System”, with this feature we can create a timer to call functions or events in time intervals. So instead of updating Azure[Sky] every frame as it is done in the current version, we can now update Azure systems using a timer.
    In the image below, you can see a timer configured to update Azure each 0.1 seconds.
    Test4.jpg
    Pay attention to the execution order:
    • Firstly, we need to update the sun, moon, and directional light directions.
    • In the second event, we need to update the weather system to perform the weather transitions and custom properties operations.
    • After we get the transform directions and the new custom properties values, we need to update the shader uniforms, so the sky, fog and any other system can now be rendered using the new values.
    • Now, we can call the DynamicGI.UpdateEnvironment() to update the environment cubemap to apply the lighting changes to the global illumination.
    • And finally, we also update the reflection probe to receive the new scene lighting on it.
    By using a timer to perform all this expansive processes, this is the result of the beta version current under development.
    Note: All the tests were performed using exactly this same scene and resolution.
    Test5.jpg
    As you can see, it is better than the first image that was performed using the current version (v7.0.7) with the reflection probe off and without using the expansive DynamicGI.UpdateEnvironment().


    For another beta version, not this beta that is coming. I will try to save more performance by rendering the fog scattering first to a texture before applying it to the final image. This way, we can render the fog with a half or even with a quarter of the screen resolution.

    If you have any tip or suggestion, please feel free to talk about!
     
    Acissathar likes this.
  39. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Baldinoboy likes this.
  40. mitdave95

    mitdave95

    Joined:
    Jun 17, 2016
    Posts:
    3
    Hi, is there a way to apply Sky material on a sphere (like skybox) with inverted normal? I tried changing CULL to Back but it did not work. Need to use it as part of AR portal experience.
     
  41. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Yes, you can do it. Just add the sky material to the material element of the sphere's Mesh Render component.
    SphereSky.jpg

    By default, the shaders are already with the Cull defined to Back, you should set it to Front. But the best option is to import a sphere from Blender with the Normals already inverted. So, there is no need to edit the shaders, and you can use both the sphere and the regular skybox at the same time.

    PS: Also remove the code below from the OnEnable() and LateUpdate() of the script AzureSkyRenderController.cs if you want to detach the Azure sky material from the skybox field of the Lighting window.
    Code (CSharp):
    1. if (m_skyMaterial)
    2.     RenderSettings.skybox = m_skyMaterial;
     
    mitdave95 likes this.
  42. z_yq

    z_yq

    Joined:
    May 3, 2017
    Posts:
    16
    I want to know if URP is supported?Thanks
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Yes, URP is supported!
     
  44. Rukas90

    Rukas90

    Joined:
    Sep 20, 2015
    Posts:
    169
    Looking forward to this feature! Looks great so far. Have a few questions, will it be possible to define transitions? Like how fast one skybox transitions to another?

    Moreover, I would like to be able to perhaps have different sunset skyboxes or day skyboxes, will it be possible to switch skyboxes at runtime? So for example every sunset is different.
    What kind of flexibility will this feature offer overall? Will it be possible to switch at runtime to different weather preset?
    For example, from the sunny sky to rainy clouds?

    Also, will it be possible to maybe animate clouds, similarly to static clouds?

    Thank you
     
  45. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Yes, you can set the transition time!


    Yes, it is supported and controlled by the weather system. You are able to control and change the weather the same way as if it was a regular property. But instead of transiting regular properties to change the weather conditions, you will create a custom property of “Texture” type and configure the override targets to the material property using that texture. This will show a texture field on each weather preset, so you can set a different texture according to the preset. When you change the weather, the weather controller will apply the transition from one texture to another and override the target texture property according to your definitions.

    You are not limited to use this feature to control the regular skybox textures only, it is integrated with the “Custom Property System” and you can use it to transition textures of any custom material. In example, you can change the wall texture according to the weather preset, maybe it is not the best approach, but you can transition the incandescent lava texture to a cold lava texture after some rain preset. Of course, if you abuse the use of custom texture property and use high resolutions, it will impact the performance.


    Current not, the skybox fog feature is completely static because even the cloud scattering is already rendered into the texture. So if it allows rotating the clouds, it will desync with the skylight from the background and also with the fog scattering data that is also pre rendered into a texture.

    But now you can use the custom texture property to change the static cloud texture according to the weather preset.

    These features are already available for testing on the beta version. The beta version is inside the last asset store version as a sub-package. Just save the beta sub-package to the disk and import it as a regular package on a fresh Unity project.
     
    Rukas90 likes this.
  46. robert_val1

    robert_val1

    Joined:
    Mar 27, 2018
    Posts:
    6
    Is there a way to get it working in editor? I do my multiplayer testing in editor because it is a lot more convinient. I rarley make builds.

    In editor when I change the active scene the ambient lighting just goes away and anything in shadow is pitch black.
     
  47. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    154
    Ah, sorry i never ended up finding a good way to make it look how it really is represented, without baking SOME kind of lighting in the scene. I usually just test bake a couple point lights on a plane to get some lighting data in there
     
  48. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    By your description, it seems to be the same issue from this video. Maybe it can help!
     
    robert_val1 likes this.
  49. robert_val1

    robert_val1

    Joined:
    Mar 27, 2018
    Posts:
    6
    That worked!! thanks :D

    Got a new problem now. I have 2 scenes, one has the Azure prefab and the other just uses a point light (dark room). Dark room scene has it's environmental lighting value set to 0. Rroblem is that when I re-enter that dark room scene from the outdoor (azure) scene the environmental lighting value carries over from the outdoor scene :(

    Weird thing is it doesn't matter which of the two scenes i start in. it's always when I enter the dark room scene for the second time that it carries over the environment lighting value.

    Untitled.png
     
  50. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    If Azure is in the main scene, and you load the second scene additively, it will keep the lighting setup from the main scene. But if you are just switching the scenes, the loaded scene should have its original setup, especially if there is no Azure prefab in that scene. Maybe you need to create a different Lighting Settings asset for each scene? I suspect that it is related to some scene configuration, not a thing to do with Azure.
     
    robert_val1 likes this.