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

    jarmohh

    Joined:
    Dec 30, 2017
    Posts:
    12
    I use latest version and urp. I live in Finland and midsummer sunset is very late. In Lapland we can see sun 24 hours. Used this great component some days.

    Settings
    Date 24 june.
    TimeSystem: Realistic
    Latitude: 61.8
    Longitude: 28.4
    Timeline 7pm light.jpg
    Utc:3

    Sun is quite high at 7pm. (Real world outside look as normal daytime). Azure sky is dark, and Terrain looks like night. Ground is dark. Is there possibility change that? So that there is more light?
     
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    It is because the curves and gradients are configured by default as “Timeline Based Curve” and “Timeline Based Gradient” respectively. So the value you set to any sky property (for example, at 20h in the curve's setup) will be applied to the sky always when the time of day reach that time.

    The problem is when you set the time mode to Realistic, in this situation, depending on the location and date, some days at 20h it will be nighttime and in other days it will still be daytime. Now, the configurations from the curves and gradients based on the timeline will get “out of sync” according to the positions of the sun and moon in the sky.

    The solution is to select the “_OverrideObject.asset” located at the “Profiles” folder and change all the “Customization Mode” of the custom properties that are configured as “Timeline Based Curve” and “Timeline Based Gradient” to “Sun Elevation Based Curve” and “Sun Elevation Based Gradient” respectively.

    By default, the curves and gradients were configured based on the timeline using the Simple time mode as reference, With this setup the daytime always starts after 6am and ends at 6pm. In your case, at 7pm, the sky system “thinks” it is already nighttime.

    PS: I don't know if it is a bug, but when you change the “Customization Mode” of the custom properties on the “_OverrideObject.asset” the curves and gradients in the profiles will get reset, I'm sure that I have already configured it. I will fix it this week.

    For the next version cycle, I want to change this behavior and make it automatic, no need to customize another curve or gradient, just convert the timeline to sun elevation. I think it can be done to this current version cycle, I will do some experiments this week. I hope you can use the simple time mode for a while.

    Thank you!
     
  3. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    New version released!
    https://assetstore.unity.com/packages/tools/particles-effects/azure-sky-dynamic-skybox-36050

    v7.1.0 (Requires Unity 2019.4 LTS or higher)
    • Removed the option to customize curves and gradients based on sun/moon elevation because it is no longer needed. When using time mode as realistic, the sky system will automatically get the timeline value and convert it to elevation mode. This is a new feature for the next version cycle (v8.x.x) that is still under development, but it could be implemented in the current version cycle (v7.x.x).
    Now, when using the realistic time mode, there will be no issue as related in the previous post above. In the realistic time mode, the sky system still needs to be based on the sun elevation. But instead of customizing another curve or gradient for that, it takes advantage of the default curves and gradients.

    The images below show how you should customize the default curves and gradients when using realistic time mode. In realistic time mode, the customization needs to be done based on the sun's elevation in the sky. Converting it from the default curve means the day cycle will be 12h instead of 24h. This is because the sun goes back down after reaching the maximum elevation in the sky, usually around noon.
    CurveElevation.png GradientElevation.png
    In other words, only the first half of the curves and gradients will be used while in the realistic time mode.
     
  4. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    New version released!
    https://assetstore.unity.com/packages/tools/particles-effects/azure-sky-dynamic-skybox-36050

    v7.1.1 (Requires Unity 2019.4 LTS or higher)
    • Added a new beta package v8.0.0b3 for testing the next version cycle current in development. The beta package requires Unity 2020.3 LTS or higher.
    • Added the realistic time system mode to the beta version, which was still missing.
    • It already supports by default the customization of curves and gradients based only on the timeline, as discussed in the post above. No more need to customize another curve based on the sun elevation when using the time system mode as realistic.
    The new version cycle (v8.x.x) is almost done, but there is no ETA because I want to try to implement another features before the release, and I also want to create a complete and detailed documentation for this next version cycle.
     
  5. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Hi, I apologize for the dummy question, but I manage date and time inside game through a custom C# script (unrelated to Azure Skybox, as I do not use a skybox in all the scenes), as there is much game logic depending on it, and I have the possibility to fast forward time.

    So I would like to be able to set the date and time inside Azure Skybox using a script calling my custom C# script in a most efficient way. Today, I am calling each frame:
    - AzureTimeController.SetTimeLine
    - AzureTimeController.SetDate

    is that the good way to do it? I have doubts as:
    - there is a very high garbage collection rate
    - It seems the OnNextDay event to change the weather does not work -that may be because I misconfigured it though).

    Maybe how to change datetime through script should be part of the basic documentation (I did not find it, maybe it is my fault).
     
    Last edited: Dec 4, 2022
  6. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Sorry, another maybe super dummy question, for which I could not find an answer so far: the Azure skybox works well when the scene with the Skybox is the first launched. However, when launching the scene from another scene (not using the Skybox, say an indoor scene), the ambient shadow light is missing / way too dark. From what I saw, most of the color settings are gone.

    Does someone know if there is some special init to call at the start of the scene from a loadScene ? Below is the example of a correct display (when launching the scene at first), and of an incorrect display (when starting the game on another Scene)
    azureskyboxwithoutissue.jpg azureskyboxissue.jpg
     
  7. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    There is no problem to use “SetTimeline()” every frame, but the “SetDate()” method also calls inside it, another method called “UpdateCalender()” used to sync the calendar display with the new external date values. So, try to avoid changing the date every frame, instead implement in your logic a verification to update the Azure date only when there is a change in your external date.

    Note that you can use in your scenes where you do not need the skybox, only the “AzureTimeController” component to handle the time. You can also give a try in the beta version, that have a better and more organized code. It is also more modular, so you can just delete from the prefab the Game Objects with the features you do not want to use for that scene.



    I think it is not related with Azure, but maybe a missing Unity setup. Take a look in this video.
     
  8. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Thanks a lot. Your advice was totally spot-on, and I apologize for disturbing you with this issue not-directly related to Azure Skybox. Now, it is fixed.
     
    DenisLemos likes this.
  9. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    I have another set of questions:
    • is there a way to change the direction of the North of the skybox ? That would be more simple for me than rotating my whole scene / terrain to get to the lighting I would like
    • Is the Mars weather pattern supposed to be used as-is or does it require some configuration (probably changing the Raleigh color...) Also, I was surprised that there are no stars in the Mars weather pattern, whereas I would expect that, most of the time, stars are visible from Mars considering the very thin atmosphere. Or does the Mars weather pattern represent a dust storm condition on Mars or something equivalent ?
     
  10. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    You can just rotate the sky prefab. There is no need to rotate the whole scene, in my opinion, it is a good practice to always use the Z+(forward direction) as the North.

    Sorry, I'm not a Mars expert. I just tried to mimic the colors from what I saw in the NASA pictures. Generally in the pictures it is always orange with a blue sunset, I think there are no clouds on Mars either, but...;)

    The Mars weather profile is using a “OverrideObject.asset” configured only with the custom properties required to get that result, it is just an example on how to customize it, you can add more custom properties to the profiles to extend its functionality if you want. But, you are able to use in the weather controller component only the weather profiles that shares the same “OverrideObject.asset”, so if you want a Mars profile, just duplicate the _Default weather profile and start from there. And just use the Mars profile from the demo scene as reference.

    Actually, the Mars weather profile should have stars, it also has a custom property in the profile to control it by default.
    Mars1.jpg

    You can also attach the secondary starfield cubemap in the References tab of AzureSkyRenderController component in case you want a Milky Way more dense.
    Mars2.jpg
     
    Last edited: Dec 7, 2022
  11. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Thanks for the hint.

    Just to check that I get it right, the OverrideObject.Asset specifies the settings to change, and you set the settings in the specific weather profile.

    I am still struggling with my Mars scene, and I wonder if I have some settings that interfere with Azure Sky. I noticed the following strange behaviour:
    • When I put the "clear" Weather profile, I see the stars even during the day time (seems there is a problem with the sun
    • When I put the "Mars" Weather profile, the sky color is incorrect (which is I think because the “OverrideObject.asset" does not include Mie and Rayleigh color), but the stars do not appear at all.
    Any idea what existing setting of the scene could interfere with Skybox ? I am using the default render pipeline.

    Also, another question, what is the clean way to remove the Moon ?
     
  12. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Hi,

    I could solve my Mars problem. Actually, everything worked fine when I copied the Mars Scene into my Scene, then cut and paste the Azure Skybox where I needed it to be.

    somehow, just starting with the Skybox Prefab and gettting the Mars Weather Profile did not work for me. my understanding is that the Mars weather profile does not contain all the settings you need to have a sky from Mars, but the one in the Scene does.

    Thanks a lot for your great work DenisLemos.
     
  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Exactly! You create the custom properties in the OverrideObject.asset and specify if it will be a float, color, curve or gradient property.

    When you attach this OverrideObject.asset to a Weather Profile, the custom properties you created in the OverrideObject.asset will be available to customize in the Weather Profile.

    Then, when you attach this same OverrideObject.asset to the “Override Object” field located at the header of the “Override Properties” list of the AzureWeatherController component, it will show a list to configure the targets that each custom property should control/override.
    OverrideObject.jpg

    And finally, the weather controller will perform all the weather transitions according to the setup of each weather profile, and send the resulting value to its targets.

    See here in the video tutorial starting from 2:50s a complete configuration of a custom property created to control the shadow of the directional light according to different weather conditions.



    I'm glad you managed how to make it to work!

    I think the reason of the problem is that you are trying to use in the weather controller, some weather profiles with different OverrideObject.asset attached to it. All the weather profiles used in the weather controller component must share the same OverrideObject.asset, and also this same OverrideObject.asset must be attached in the weather controller component. You can't use different OverrideObject.asset in the weather profiles and weather controller because each one will have a different preset of custom properties and consequently the property types will not match when performing the weather transitions, causing several errors.

    If you look at the Mars scene, you will notice that the Mars's weather profile and the weather controller component are using a custom OverrideObject.asset, but both are sharing this same OverrideObject.asset.

    For the next version cycle (v8.x.x) currently in beta, there will be no need to configure a OverrideObject.asset. You can create the custom property and configure its targets directly in the weather controller component, it is more simple to use and easy to understand. In case someone wants to test, the beta comes with the package, you can find it in the “_Beta” folder.
     
    Last edited: Dec 13, 2022
  14. jh092

    jh092

    Joined:
    Sep 2, 2018
    Posts:
    52
    Hi there and thank you for this asset, I'm having a great time with it.

    I have a small problem which I'm not sure how best to deal with. If for example I am transitioning from clear weather to rainy weather, the rain starts well before the clouds appear so I am left with rain coming from clear skies.

    The rain and clouds do ramp up correctly though and by the end of the transition everything looks great, it's just at the beginning when things look not quite right.

    Would you have any suggestions as to how I could work around this? Would I need to, for example, transition to a cloudy profile with no rain first, and then transition to a rainy profile? I'd need to do the same thing going back from rainy to clear then too (and snow for example) so that might start to get a bit messy.

    Many thanks and best wishes from Australia

    John
     
  15. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Firstly, thank you for using Azure[Sky].

    The weather transition is a linear interpolation, so it starts and end at the same time for all the custom properties. This is the reason why rain falls before the sky is completely covered by clouds.

    Yes, currently you will need to use an overcast weather to directly link a clear sky with a rainy weather. To be honest, I hadn't thought of this before, but you gave me the idea of adding a ramp curve to each property in the profiles. So you can refine the sky customization and set the rain to start closer to the end of the transition, after the sky is already cloudy. And when you're going from a rainy weather to clear sky, you can set the ramp curve to do the inverse and end the rain closer to the beginning of the transition.

    With this feature, you can adjust the order in which things will happen during a weather transition. It can be useful not only for the rain, but to other settings too. I will do some experiments this week and test if this implementation is viable.

    Thank you for the suggestion!
     
  16. jh092

    jh092

    Joined:
    Sep 2, 2018
    Posts:
    52
    Ooh thanks Denis, that sounds like a wonderful solution if it's doable. Thanks for replying and helping.

    John
     
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    New version released!

    https://assetstore.unity.com/packages/slug/36050

    v7.1.2 (Requires Unity 2019.4 LTS or higher)
    • Added a ramp curve to each custom property in weather profiles. With this new feature, you can control which property should blend first or last during a weather transition. Example: You can edit the ramp curve of the cloud coverage to be completed in the first half of the animation transition, so it will firstly cover the sky with clouds before it starts to rain. And for the ramp curve of the rain intensity property, you can adjust to start blending at the middle of the weather transition and finish the blend at the end of the weather transition, this way you make sure the rain will falls only after the sky gets covered by the clouds.
      RampCurve.jpg
    How it works:
    Let's suppose you want a direct transition from a clear sky to a rainy weather. The rainy weather profile is the target weather profile the transition is going to. A thing you need to keep in mind, is that the ramp curve used by the weather transition is the ramp curves from the target weather profile. Each custom property have its own ramp curve.

    When the weather is clear, and we are going to a storm weather, we want that the sky firstly gets covered by the clouds before it starts to rain. So in the Storm weather profile we need to configure the ramp curve of the property that controls the cloud coverage to starts and ends the blend transition first like it shows in the screenshot below.
    RainCloudRamp.jpg

    But the ramp curve of the property that controls the rain intensity, we configure it to starts and ends the blending when the weather transition animation is close to the finish.
    RainIntensityRamp.jpg

    And when we are in a Storm weather and want to go to a Clear sky, in the clear weather profile we need to configure the ramp curves using the opposite logic. Because now we want to first stop the rain before removing the clouds. So we need to configure the ramp curve that controls the rain intensity of the clear sky to starts and ends the blend transition at the beginning of the weather transition animation. Note that in this weather profile, we are also setting the rain intensity to zero.
    ClearRainIntensityRamp.jpg

    And finally, we configure the ramp curve of the property that controls the cloud coverage to apply the blending at the closer to the animation end.
    ClearCloudRamp.jpg

    Now, we guarantee that we will only see the rain falling if there are still clouds in the sky. This feature can be used to others properties that also require a specific order to happen inside the weather transition animation.
     
  18. jh092

    jh092

    Joined:
    Sep 2, 2018
    Posts:
    52
    Hi Denis, this sounds amazing! Thanks for adding this very powerful new feature!

    Happy New Year

    John
     
    DenisLemos likes this.
  19. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
  20. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Unfortunately, current there is no option to customize the skybox gradient at the ground below the horizon line, it is generated automatically by the shader equations. Generally the sky ground is not visible and the objects gets the reflection and lighting from the terrain or any other ground mesh. You can change the “Environmental Lighting Source” of the “Lighting” window to “Gradient” instead of “Skybox”. It will stop using the skybox as lighting reference, but this way you can set custom colors to the ambient lighting color of Sky, Equator, and Ground. The sky system already handles these color properties by default as they are exposed as custom properties and ready for customization in the weather profiles, look at the properties number 22, 23, and 24 in the profiles.
     
  21. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
    Thank you for the quick reply.

    I was finding that gradient ambient light was not adequate for lighting buildings in shadow, especially during sunrise/sunset. Tests with the skybox providing ambient light was much more promising.

    It's not really a question but I'd be interested in hearing your thoughts. I can provide some examples if it helps illustrate my point.
     
    Last edited: Jan 7, 2023
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    My thoughts are that real-time-day-night-cycles lighting with Unity is not a so simple task to do, but anyway I would go with real-time reflection probes updated by scripting in time intervals instead of every frame to save the most performance as possible. It is already supported by the current version of Azure[Sky], but the Beta version have a new feature called “Timer System” that can improve this even more, check the post number #1580 for more information.

    With the “Timer System” feature, we can configure the entire sky system to be updated in time intervals, this will save even more performance, so we can get a complete real-time lighting as described in the post number #1588.

    I also prefer the “Environment Lighting Source” as “Skybox” because it gets a very better result. But I can't understand the skybox ground issue, for me the Unity's lighting seems to be working as it should.
    Sky1.jpg
    Of course, the objects are reflecting only the sky because the reflection probe by default is configured to render only the skybox. But if you configure the Azure's default reflection probe and the other reflection probes around your scene to also render the ground/terrain, it will look as expected.
    Sky2.jpg

    Feel free to provide us with some examples so that we can better understand what you want to achieve, and also to provide some feedback or recommend new features to take advantage of having a new version in development.
     
  23. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
    I agree, its very difficult thank you for making the plugin. The time function sounds great too.

    Taken from this post

    There is a distinction of 4 light "type" in realtime rendering :
    - Direct diffuse : the lighting coming from light sources, diffused on the object surface toward the camera
    - Direct specular : the lighting from light sources, directly bounced on the object surface toward the camera
    - Indirect diffuse : lighting bounced multiple times in the scenes, until it finally got diffused by the object surface toward the camera
    - Indirect specular : lighting bounced multiple times in the scenes, until it finally got directly bounced by the object surface toward the camera


    I think in the your example you are showing the indirect specular lighting, and when used on non metalic rough surfaces it doesn't contribute much.

    In shadows, the non metalic rough surfaces, are lit by indirect diffuse. Which in our case is the "Enviornment Lighting" setting from the Lighting > Enviornment tab.

    My observation is only about the indirect diffuse which seems to play a huge part in adding visual interest to areas of shadow, for example standing in a courtyard or piazza at least half the buildings would be in shadow so the indirect diffuse is seen often. This also seems to be the key to get a nice sunrise or sunset because the low sun casts more shadows and the ambient light from the sky is particually colourful and vibrant with large gradients.

    When being used for ambient light the sky not having a ground means that the undersides of objects, such as bridges which are always in shadow are noticeably artificially bright.

    FWIW I think new unity tech might help this as I think it's allowing the ambient light probes to be updated realtime like reflection probes and then used for indirect dififuse lighting. Not much help for my current project though.

    I have attached a video of a castle in shadow showing the difference in indirect diffuse between skybox and gradient (and remember the skybox could look even better with the ground in) and a picture of sunset with skybox and gradient.



    sunset sky.png sunset gradient.png
     
  24. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
    I realised I should have provided an example with the ground in the skybox, I've duplicated and rotated the castle which is why the scene looks odd but I think it should prove the point.

    The one with green has the ground in which reveals extra details and is where we could have more depth in the ambient light.

    skybox with ground.png skybox without ground.png
     
    Last edited: Jan 9, 2023
  25. crowmaster

    crowmaster

    Joined:
    Jul 6, 2012
    Posts:
    80
    Awesome asset, i just got a couple of questions though:

    1) How can i most explicitly control sun & moon light intensity and sky color?
    2) How can i control timeline speed, i want to set it to zero?
    3) Will azure fog work with premultiplied alpha transparency in my custom shader?
    4) How this asset performs with deferred lighting mode?
    5) What parameter controls shadow intensity?
     
    Last edited: Jan 23, 2023
  26. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    You mean the light intensity from the skybox? You can control it in the “Scattering” tab of the “AzureSkyRenderController” component, more precisely changing the parameter called “Mie”, secondary the parameter called “Rayleigh”. If you try to change some parameter, and it does not change, it is because that parameter is being controlled by a custom property, so you need to edit it in the weather profiles.
    By default, the Mie and Rayleigh are being handled by custom properties in the weather profiles, both the custom properties are configured to be customized as Curve type, so you can set to it different values for each time of day. In this case, there are not a parameter to control the sun intensity and another to control the moon intensity, you just need to increase or decrease the Mie and Rayleigh values according to the time of day. You can change the sky color by playing with the wavelength parameters and also changing the Mie and Rayleigh colors.

    Set in the “AzureTimeController” component the parameter called “Day Length” to zero.

    By default, the fog scattering effect is rendered before the transparent objects, so it will ignore the transparent materials in the scene. And the standard solution is to include the fog calculations locally in each of your custom transparent shaders. In the “Documentation” folder, you will find the instruction on how to add fog support to transparent shaders. In the “Assets/Azure[Sky] Dynamic Skybox/Shaders/Transparent” folder, you will find some particle shaders already modified to support the fog scattering effect, you can open the shader to see what was changed.

    I think the same way as using the forward rendering path. Azure[Sky] handles only one directional light in both of the rendering paths.

    The shadow intensity is controlled per light, and it depends on 3 other parameters.
    1. Light Intensity: If you decrease the light intensity, the shadow of that light will fade out.
    2. Light Color: If you set the light color to black, the shadow of that light will fade out.
    3. Shadow Strength: By default, I personally use it to control the shadow intensity.
    By default, Azure[Sky] handles one directional light. To control the shadow intensity of the directional light used by Azure[Sky], just set the property “Directional Light Strength” in the weather profiles, more precisely the property number 41 in the weather profiles.
     
    crowmaster likes this.
  27. crowmaster

    crowmaster

    Joined:
    Jul 6, 2012
    Posts:
    80
    Thanks you for comprehensive answer!

    I also got a weird issue when trying to integrate fog into my project. As can be seen in a pic transparent object have
    different fog color even when fully fogged. I was using custom surface shader (a very basic just with Azure fog support added in final_color). What is weird same shader when used in demo project which comes with the asset works as intended and blends with fog correctly. So it means this is not shader issue. Any tips what may cause this effect?
    upload_2023-1-24_16-8-39.png

    upd: after some tests i discovered it was caused by some combination of Azure Sky Renderer parameters. I can not answer what exactly caused this cause i simply reset parameters to default and now objects blend into fog correctly.
    I will update if issue pops in again
     
    Last edited: Jan 24, 2023
    DenisLemos likes this.
  28. PussSallivan

    PussSallivan

    Joined:
    Apr 28, 2020
    Posts:
    2
    Hi! I am loving this asset!
    I have been trying to use Enviro3's fog with Crest Ocean, but the guide you made for Enviro2 doesnt seem to work anymore: https://forum.unity.com/attachments/enviro_crestocean_urp-pdf.596221/
    The path and file "Assets/Enviro - Sky and Weather/Core/Resources/Shaders/Core/EnviroFogCore.hlsl" no longer exists for Enviro3.
    Is it placed anywhere else? or perhaps is there any other way we can apply Enviro3's fog to the ocean.
    Thank you!!
     
  29. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    I'm sorry, but I think you wrote your question in the wrong forum. I'm not the developer of these assets you mentioned here.:)
     
  30. sh4p

    sh4p

    Joined:
    Aug 7, 2020
    Posts:
    3
    Hey, I just wanted to start by saying that i am really enjoying this asset but i am having a couple small problems.
    I have noticed that the sun appears diffused or hazy in the sky, i have found that changing mie somemwhat helps but i cant find a result that satisfies me. maybe i am just being picky :)
    the other thing is that the sun and moons "mie" can be seen through walls, i have linked images of both of these things.
    once again thank you for creating such an amazing asset!
    https://imgur.com/p3n6iOY
    https://imgur.com/eE7JqjU
     
  31. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Firstly, thank you for using Azure[Sky]!

    I did not understudy your first issue very well, I think you also need to play with the other parameters from the Scattering tab.

    Regarding the Mie passing through the walls, you can adjust the “Mie Distance” in the “Scattering” tab of the “AzureSkyRenderController” component.
     
  32. sh4p

    sh4p

    Joined:
    Aug 7, 2020
    Posts:
    3
    Changing Mie Distance worked, thanks

    its hard to explain my first problem in words, here are two images
    https://imgur.com/ZqcLouw sunrise from google, what i want it to look like
    https://imgur.com/j2cCJt1 my sunrise

    I've tried messing around with all the sliders in scattering but nothing seems to help. its like the sun texture isnt even there even though sun texture intensity is 1
     
  33. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    When the Mie bright is with a high intensity, it will hide the sun texture behind it. I think what you are looking for is a Lens Flare effect.
    LensFlare.jpg

    For some reason, Unity have deprecated their Lens Flare asset pack from the Asset Store that works with the Legacy Rendering Pipeline. I will leave it attached in this post for download, so after you import it to your project, you need to:
    • Attach the Lens Flare component to the directional light and set it to be directional, as you see in the screenshot above.
    • Attach the Flare Layer component to the Main Camera, so the lens flare will be visible for that camera.
    Unity have created a different approach to render lens flares using Universal Rendering Pipeline, so the package attached to this post, will work only in the Legacy Rendering Pipeline.

    I hope it can help you!!!
     

    Attached Files:

  34. crowmaster

    crowmaster

    Joined:
    Jul 6, 2012
    Posts:
    80
    Does Azure allow for custom weather effects? I want to make sandstorm weather with dust particles.
     
  35. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Nothing prevents you from using your own particle effect and control it using Azure[Sky]. What you need to do is to create a custom property to control the intensity of the dust particle emission using the weather system.

    If you look at the Beta version, you can note that each particle system is using a component called “AzureParticleFX.cs”. This component is used to update the emission module of the particle always when the “Intensity” property is changed, so the override settings of the custom property should be configured to control the intensity property of the “AzureParticleFX.cs” component. And when it changes, it will update the particle's emission module.

    Here is the “AzureParticleFX.cs” code for reference, you can use it or a similar script to access the particle properties and update it according to the script variables. And you can use the custom property feature to control the scrip variables using the weather system. I hope you get the idea!
    Code (CSharp):
    1. namespace UnityEngine.AzureSky
    2. {
    3.     [RequireComponent(typeof(ParticleSystem))]
    4.     [AddComponentMenu("Azure[Sky] Dynamic Skybox/Azure Particle FX")]
    5.     public sealed class AzureParticleFX : MonoBehaviour
    6.     {
    7.         /// <summary>
    8.         /// Field: The particle system attached to this game object.
    9.         /// </summary>
    10.         private ParticleSystem m_particleSystem;
    11.  
    12.  
    13.         /// <summary>
    14.         /// Field: The reference to the emission module of the attached particle system.
    15.         /// </summary>
    16.         private ParticleSystem.EmissionModule m_particleEmission;
    17.  
    18.  
    19.         /// <summary>
    20.         /// Field: The emission intensity of the particle system attached to this game object.
    21.         /// </summary>
    22.         private float m_intensity;
    23.  
    24.         /// <summary>
    25.         /// Property: The emission intensity of the particle system attached to this game object.
    26.         /// </summary>
    27.         public float Intensity
    28.         {
    29.             get => m_intensity;
    30.             set
    31.             {
    32.                 m_intensity = value;
    33.  
    34.                 if (m_particleSystem)
    35.                 {
    36.                     m_particleEmission.rateOverTimeMultiplier = value;
    37.                     if (value > 0)
    38.                     {
    39.                         if (!m_particleSystem.isPlaying) m_particleSystem.Play();
    40.                     }
    41.                     else if (m_particleSystem.isPlaying) m_particleSystem.Stop();
    42.                 }
    43.             }
    44.         }
    45.  
    46.  
    47.         private void Awake()
    48.         {
    49.             m_particleSystem = GetComponent<ParticleSystem>();
    50.             if (m_particleSystem) m_particleEmission = m_particleSystem.emission;
    51.         }
    52.     }
    53. }
     
    crowmaster likes this.
  36. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Hi,

    I need for my game to know the current light in the scene / sunlight intensity. This is to:
    • calculate how much the solar panels in the game produce electricity
    • add some logic like lights switching automatically on when the scene becomes dark ?

    Is there a way to read that directly from some of the Azure classes ?

    Thanks in advance for your reply.
     
  37. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    There is not a logic like it in any Azure[Sky] class by default. But I think you can do it without using any Azure[Sky] component.
    • You can have directly access to the directional light used by Azure[Sky], you just need to reference the light game object from the scene, so you can get the light intensity value to use in your logic. You can also store a reference of the sun transform used by Azure[Sky], it should be useful to compare directions later.
    • Likewise, you have also directly access to the Unity's RenderSettings class, so you can get more information about the scene lighting.
    • In your logic, you can use the dot product of the vectors to know if it is daytime or nighttime, also use the dot product to know if the directional light is pointing directly to the solar panel.
    Example:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3.  
    4. public class SolarPanel : MonoBehaviour
    5. {
    6.     /// <summary>
    7.     /// Field: The reference to the directional light in the scene.
    8.     /// </summary>
    9.    [SerializeField] private Light m_dirLight;
    10.  
    11.     /// <summary>
    12.     /// Field: The reference to the Azure's sun transform game object.
    13.     /// </summary>
    14.     [SerializeField] private Transform m_sunTransform;
    15.  
    16.     /// <summary>
    17.     /// Field: The reference to your solar panel in the scene.
    18.     /// But, you can use instead a direction of a group/parent of solar panels to not need to pass trough one panel by one.
    19.     /// </summary>
    20.     [SerializeField] private Transform m_panelTransform;
    21.  
    22.     /// <summary>
    23.     /// Field: Stores the dot product between the sun transform direction and the global up direction.
    24.     /// Used to know if it is daytime or nighttime.
    25.     /// </summary>
    26.     private float m_dayProduct = 0;
    27.  
    28.     /// <summary>
    29.     /// Field: Stores the dot product between the directional light direction and the panel direction.
    30.     /// Used to know if the directional light is pointing to the panels.
    31.     /// </summary>
    32.     private float m_panelProduct = 0;
    33.  
    34.  
    35.     // Update is called once per frame
    36.     void Update()
    37.     {
    38.         // The dot product returns a value between (-1.0, 1.0)
    39.         m_dayProduct = Vector3.Dot(-m_sunTransform.forward, Vector3.up);
    40.         m_panelProduct = Vector3.Dot(-m_dirLight.transform.forward, m_panelTransform.forward);
    41.  
    42.  
    43.         // If the dot product is higher than zero, it means that the sun direction is above the horizon line, then it is daytime
    44.         // Otherwise, the sun direction is below the horizon line and it is nighttime
    45.         if (m_dayProduct > 0)
    46.         {
    47.             // Do the daytime logic here...
    48.  
    49.             if (m_panelProduct > 0.5f)
    50.             {
    51.                 // It is daytime, and the directional light is almost pointing the panel
    52.             }
    53.             else
    54.             {
    55.                 // It is daytime, but the panel is not towards the directional light
    56.             }
    57.  
    58.             // Another option
    59.             if (m_dayProduct > 0.5f)
    60.             {
    61.                 // This means it should be more than 9AM and less than 15PM, a good time for an efficient production
    62.             }
    63.         }
    64.         else
    65.         {
    66.             // Do the nighttime logic here...
    67.  
    68.             if (m_panelProduct > 0.5f)
    69.             {
    70.                 // It is nighttime and the directional light is almost pointing the panel
    71.                 // this means we have a bit production of electricity from the indirect sunlight reflected by the moon
    72.             }
    73.             else
    74.             {
    75.                 // It is nighttime, but the panel is not towards the directional light
    76.             }
    77.         }
    78.     }
    79. }
    I'm sure there is a way to improve it by integrating the script with the weather system to have more control of the energy production when it is raining or the sky is covered by some clouds. I'll try to think of an improved solution, so I'll let you know, but I hope it can help you somehow.
     
  38. nicolasdemauroy

    nicolasdemauroy

    Joined:
    Nov 11, 2020
    Posts:
    21
    Thanks a lot for the reply and the good ideas in your script.
     
  39. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Another approach is to change the script to this one and attach it to an empty game object in the scene. Note the new property variable added to the script, called “PotentialEnergy” that will be used in the energy production equation.
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3.  
    4. public class SolarPanel : MonoBehaviour
    5. {
    6.     /// <summary>
    7.     /// Field: The reference to the directional light transform in the scene.
    8.     /// </summary>
    9.     [SerializeField] private Transform m_lightTransform;
    10.  
    11.     /// <summary>
    12.     /// Field: The reference to your solar panel in the scene.
    13.     /// But, you can replace it to a direction of a group/parent of solar panels to not need to pass through one panel by one.
    14.     /// </summary>
    15.     [SerializeField] private Transform m_panelTransform;
    16.  
    17.  
    18.  
    19.     /// <summary>
    20.     /// Field: Stores the dot product between the directional light direction and the panel direction.
    21.     /// Used to know if the directional light is pointing to the panels.
    22.     /// </summary>
    23.     private float m_panelDotProduct = 0;
    24.  
    25.     /// <summary>
    26.     /// Field: The total number of energy produced.
    27.     /// </summary>
    28.     private float m_energyTotal = 0;
    29.  
    30.     /// <summary>
    31.     /// Field: The energy current being produced.
    32.     /// </summary>
    33.     private float m_energyProduction = 0;
    34.  
    35.  
    36.  
    37.     /// <summary>
    38.     /// Field: The potential energy that can be produced along the day-cycle.
    39.     /// </summary>
    40.     [SerializeField] private float m_potentialEnergy = 0;
    41.  
    42.     /// <summary>
    43.     /// Property: The potential energy that can be produced along the day-cycle.
    44.     /// </summary>
    45.     public float PotentialEnergy { get => m_potentialEnergy; set => m_potentialEnergy = value; }
    46.  
    47.  
    48.  
    49.     // Update is called once per frame
    50.     void Update()
    51.     {
    52.         // The dot product returns a value between (-1.0, 1.0)
    53.         m_panelDotProduct = Vector3.Dot(-m_lightTransform.forward, m_panelTransform.forward);
    54.         m_energyProduction = m_potentialEnergy * Mathf.Clamp01(m_panelDotProduct);
    55.         m_energyTotal += m_energyProduction * Time.deltaTime;
    56.     }
    57. }

    Now you can create a new custom property to control the base value of the potential energy that can be produced along the day cycle. Just select the “_OverrideObject.asset” located at the “Profiles” folder and add a new custom property to it and configure according to the image below. Note that it will return a float value and the customization mode in the weather profiles will be a curve, so we can set different values according to the time of day.
    PotentialEnergy.jpg


    This custom property should be now available in each profile for customization. In the image below is the way I have configured it for the “Clear” weather profile. See that along the daytime the potential value is higher and at nighttime the value used as base production is very slow because it is potential energy from the indirect light reflected by the moon. Now you can set different base energy production values according to different weathers, just for example, you can set less potential energy production to the rain weather profiles.
    ClearDaySetup.jpg


    The weather system is now performing all the weather transitions for this new custom property, but the output value is not being used in any place. So the last part is to configure the override system in the weather controller component to send the output value to the script we have just created, overriding the local property variable called “PotentialEnergy”. So, just configure the override item available in the “Override Properties” list according to the image below.
    OverridePropertySetup.jpg


    Now, the energy production should be different according to the weather profile that is current in use. I hope it can help you to best understand how the custom properties feature works, and maybe point you the way to implement a better approach.
     
  40. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    38
    hello, will the new version be released soon or should I start the new game with the released version?
     
  41. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    There is no estimated date to the new version release, so always use the available one! But you still have the option to use it if you want, all the new features of the new version are already implemented and ready to use in the beta version that came with the package.
     
  42. murat303

    murat303

    Joined:
    May 22, 2014
    Posts:
    38
    Thank u, and i have another question, how can i add fog to transparent urp shader graph shader?
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I don't know how the shader graph works because I'm in the code side of the force. But I presume this has the possibility to include a .cginc file and call a function from it. So what you need to do is include the “AzureFogCore.cginc” to your shader and call the function “ApplyAzureFog(float4 finalColor, float3 worldSpace)”, it will return the final color passed by parameter as a float4 with the fog already applied.

    In the post number #1452 there is an explanation on how a customer did it using (ASE), maybe it can help you.

    Another option is to get the shader file generated by the graph and do the edits manually using code. With the package, you will find some very simple particle shaders already edited to support the fog scattering effect that you can use as reference.
     
    StenCG likes this.
  44. ExCeLL61

    ExCeLL61

    Joined:
    Nov 3, 2021
    Posts:
    3
    Hi. I've Azure Sky and Soullink AI Spawner.
    İ set up integration for Azure Sky. Its worked. But i try to Build, failed. Giving these erorrs.

    Assets\SoulLink\Integrations\Common\Azure Sky\AzureWeatherSystem. cs(54,36)...(58,26)...(62,26)...(67.26)

    'AzureProfileProperty' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'AzureProfileProperty' could be found(are you missing a using directive or an assembly reference?

    How can i solve it?
     
  45. ExCeLL61

    ExCeLL61

    Joined:
    Nov 3, 2021
    Posts:
    3
    I temporary solved just disabled codes which give erorrs. now i can build and soullink spawn working.
     

    Attached Files:

  46. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    I don't have this asset to test, but as I can see by the screenshot you attached, it seems the soullink script is trying to access the name of the properties in the current weather profile. But the variable “name” is declared in the “AzureProfileProperty” class this way:
    Code (CSharp):
    1.  // Not included in build
    2. #if UNITY_EDITOR
    3. public string name;
    4. public string description;
    5. #endif
    This means the name and description variables of each weather property are editor only and are not included in the build. Then, when the soullink script tries to access it in the build, it gets the error you mentioned because the variables does not exist in the build.

    The solution is very simple, you can just open the script called “AzureWeatherProfile” and in the “AzureProfileProperty” class declaration, just replace the declaration of the variable “name” outside the editor conditional.
     
  47. ExCeLL61

    ExCeLL61

    Joined:
    Nov 3, 2021
    Posts:
    3
    Thank you. In AzureWeatherProfile script, i find your code. And delete if UNITY_EDITOR. Now its working. Thanks
    Code (CSharp):
    1. .
    2. .
    3. public string name;
    4. public string description;
    5. .
     
  48. dgkoris

    dgkoris

    Joined:
    Jan 6, 2014
    Posts:
    2
    Hi all, I used Azure[Sky] Dynamic Skybox to achieve a graphics style consistent with the environment and I'm very happy with the result. It looks amazing in VR mode too where I had problems with several other weather systems I had tried before.

    This is a preview of my game (still in development) and you can see that Azure[Sky] Dynamic Skybox really shines.

     
    DenisLemos likes this.
  49. Deleted User

    Deleted User

    Guest

    Is there a way to make the weather cycle through each profile in a loop? IE, each day you get a different profile.
     
  50. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Yes, but there is not an automatic solution by default. You need a simple script attached to an empty game object that will call the next weather when a new day starts.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class WeatherCycleExample : MonoBehaviour
    5. {
    6.     /// <summary>
    7.     /// Drag the weather controller component into this field in the Inspector.
    8.     /// </summary>
    9.     public AzureWeatherController weatherController;
    10.  
    11.     /// <summary>
    12.     /// The number of weather profiles attached in the global weather list of
    13.     /// the weather controller component.
    14.     /// </summary>
    15.     [SerializeField] private int m_weatherNumber = 7;
    16.  
    17.     /// <summary>
    18.     /// The current weather count in the cycle.
    19.     /// </summary>
    20.     private int m_weatherCount  = 0;
    21.  
    22.     /// <summary>
    23.     /// Call this method in the OnDayChange event from the weather controller Inspector.
    24.     /// Remember to order the global weather list profiles according to the cycle order you want.
    25.     /// </summary>
    26.     public void StartNextWeather()
    27.     {
    28.         weatherController.SetNewWeatherProfile(m_weatherCount);
    29.  
    30.         m_weatherCount++;
    31.         if (m_weatherCount > m_weatherNumber)
    32.         {
    33.             m_weatherCount = 0;
    34.         }
    35.     }
    36. }
    So, you can just configure a call to the “public void StartNextWeather()” from the script above using the “OnDayChange()” event located at “Inspector” of the “AzureTimeController” component.
    OnDayChange.jpg

    You can reorder the attached profiles of “Global Weather” list to be in the cycle order you want, also set the value of the “m_weatherNumber” variable to be the same as the global weather list size.

    I hope it can help you!
     
    Deleted User likes this.