Search Unity

Graphics Azure[Sky] - Dynamic Skybox

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

  1. Fluff_Corp

    Fluff_Corp

    Joined:
    Aug 10, 2021
    Posts:
    2
    Hi Denis,

    First of all I want to thank you for creating this amazing asset! I'm generally more than happy with the skybox and especially the weather controller adds to much to my game.

    I'm going to be honest: I'm not much of a shader writer. I am just starting to learn about it and I am struggling to grasp it. That's why I love using shader graph. It makes things a little easier and more time efficient.

    My Problem:
    I have got a few shaders using transparency (on the URP, Unity 2020.3) and I cannot get them to work with the fog feature for the life of me.

    I've attached 2 Screenshots of the issue. Neither the monolith (the black thing to the right), nor the water in the background look good and are either too dark or too shiny.
    FogOnTransparency.png

    What have I tried so far:
    - I have tried to export the *.shadergraph file to a *.shader file and manually add the ApplyAzureFog() function from the AzureFogCore asset to the basecolor. Unfortunately, the exported shader has over 3000 lines of code with numerous passes etc. and was a little much to handle.
    - I have tried to create a custom "ApplyAzureFog" function in shader graph, similar to what lightpi has done in post #1452 for the Amplify Shader Editor. For that, I needed to partially rewrite the AzureFogCore asset from a *.cginc to an *.hlsl file (shader graph does not like cginc very much and requires functions in referenced files to be of a certain format). After a lot of work and tweaking, however, I could not make it work.

    Do you maybe have any recommendations or ideas on how to go about this? I require transparent shaders in my project and I really want to make them work with your amazing skybox.

    Thanks in advance!
     
  2. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    I know! You posted many times. I just stated a specific configuration, just in case anybody else has the same situation.
     
    DenisLemos likes this.
  3. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    I'm sorry, but I don't have any experience in shader graph, visual scripting or any other node programming language.

    Just a note: The fog should be applied over the entire output color, not on the base color only. The fog should cover the entire surface, if you apply the fog over the base color only, the fog will not affect the normal details, the specular, the emission, etc...

    When you link the nodes to the Albedo, Normal, Emission, etc... Unity will pack it internally and render the final result of the shader, the fog should be rendered over this final result. I'm not sure if it is supported using shader graph.
     
  4. headcoach_

    headcoach_

    Joined:
    Jul 25, 2020
    Posts:
    3
    Hi Denis,

    Is the scattering fog feature able to work with unity's render objects feature? (URP) Currently it is drawing fog over the rendered object. Trying to setup up first person only objects
     
  5. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    I don't know what is this render objects feature you mentioned, I googled it and couldn't find anything about it.
     
  6. Fluff_Corp

    Fluff_Corp

    Joined:
    Aug 10, 2021
    Posts:
    2
    Thank you so much for your speedy response!

    After considering different solutions to solve my problem (messing around with shader graph, forward renderers, post processing effects, different cameras, etc.), I have found a simple enough solution that works for me.

    If anyone is interested:
    My game is a 3rd person adventure and I am using transparent shaders on many objects to fade them out when they are close to the camera, so they don't block the view of the character. My shaders are made with shader graph and the Azure Fog doesn't work on them (as it turns out, transparent objects do not write to the depth buffer, so the fog system that uses forward rendering to apply the foggy colour tint to objects, uses this depth buffer to get the distance of objects and calculate the correct fog colour to apply).

    So, my solution here was to create two different LODs for my objects. One with the transparency shader, that is applied when very close to the camera (that's when I need the transparency), and one with an opaque shader (for anything else).

    I hope this might help anyone who has a similar issue. Should I ever figure out how to properly solve this issue using shader graph, I will follow up here :)
     
    DenisLemos likes this.
  7. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Hi, I just purchased Azure and am having a lot of fun playing around with it!
    My app previously used Enviro, but it was just too taxing on the systems I was testing on, so Azure seemed like a good, more performant alternative.

    I just have a few questions, maybe someone can help me?
    The most important thing is about changing properties through code. I know I can easily change the time of day and the weather preset, but If I wanted to modify a specific property of the sky, how would I do that?
    I find the documentation about overrides and such kinda confusing for me lol.

    For example, regardless of what weather profile is currently active, I would like to be able to use a UI slider to adjust the cloud density, altitude, or even switch between Cloud modes (Static, Dynamic, or Off) via a UI dropdown menu.
    How would I best do this?

    Thanks so much for your help!
     
  8. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    The weather controller get the properties values in each profile, computes the weather transitions and send the resulting values to the component properties everywhere according to the setup you made in the "Override Properties" list. This is why this feature is called override system, it processes the profiles and send the resulting values to a target property of a target component of your choice.

    To change the sky system properties through code, you just need to do it in the same way as you are used to doing, just access the component of the target property you want to change and set a new value to it. The Azure code is inside the "UnityEngine.AzureSky" namespace, so you need to use "using UnityEngine.AzureSky" in your code to be able to access the Azure classes.
    Example Code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.AzureSky;
    4.  
    5. public class ExampleCode : MonoBehaviour
    6. {
    7.     public Slider mySlider;
    8.     public AzureSkyRenderController skyRender;
    9.  
    10.     // Update is called once per frame
    11.     void Update()
    12.     {
    13.         skyRender.dynamicCloudsDensity = mySlider.value;
    14.     }
    15. }
    Just pay attention to the script order, this custom script should be executed after the weather controller script, otherwise it will be overrated again by the override system of the weather controller component.

    The variable that controls the cloud mode is private, if you want to change the cloud's mode, you should add to the "AzureSkyRenderConrtoller.cs" a public method for changing it locally in the script because it requires to call the UpdateSkySettings() after changing the clouds' mode. I just note that a forgot to add this method by default.
    Code (CSharp):
    1. public void SetCloudMode(AzureCloudMode newCloudMode)
    2. {
    3.     m_cloudMode = newCloudMode;
    4.     UpdateSkySettings();
    5. }
    And call it from your custom script.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using UnityEngine.AzureSky;
    4.  
    5. public class ExampleCode : MonoBehaviour
    6. {
    7.     public Dropdown myDropdown;
    8.     public AzureSkyRenderController skyRender;
    9.  
    10.     // Start is called before the first frame update
    11.     void Start()
    12.     {
    13.         skyRender.SetCloudMode((AzureCloudMode)myDropdown.value);
    14.     }
    15. }
    Let me know if you need more information.
     
    JudahMantell likes this.
  9. xiaojianh6

    xiaojianh6

    Joined:
    Jan 20, 2021
    Posts:
    25
    Can you update it? moon
     
  10. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Thanks so much for the detailed reply, I really appreciate it!

    How do I ensure that it gets executed after the overrides? Like you said, if I try to set the density or any property through a slider, it just gets instantly set back to the value set in the weather profile.
    Thanks!

    EDIT: Note that I don't want to use update, I want to be able to set the values once in an OnValueChanged event on a slider.
     
    Last edited: Feb 7, 2022
  11. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Sorry for the double message, but I'm also running into an issue where from certain angles, a dark patch will appear in my scene. This is both in the game view and scene view. It only happens if the Azure Directional Light is active, so something is casting a shadow, but I don't know what.
    It still happens with everything in my scene disabled and just a ground plane.
    Any ideas as to what it can be?
    upload_2022-2-7_19-36-17.png
    Thanks!
     
  12. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Please be patient! I have a lot of work to do, I'm planning a complete new version of Azure and that requires a lot of study and research, I have a lot of daily emails to respond to and I also have my private project that is currently under development.



    The weather system must be executed every frame because even if the timeline is static, the player can be entering some local weather zone, so it will override the target properties again and again... The OnValueChanged is executed a single time, but after that the weather system will override it again. Current, I don't have a solution for it, maybe if the custom properties were evaluated by tag groups as "time dependent", "weather dependent", "user input dependent", this way it would be more performant because there is no need to evaluate some properties if the time is static, other properties are required to be evaluated only if the weather is changing, and also it will open the possibility to changing it by user input, but it requires a complete rework of the weather system.

    Current, the best way of doing it is configuring the weather system from scratch by creating a new "Override Object" and adding to it only the custom properties you want Azure to handle. And set the density or any other property only by custom script or slider.



    I don't think it is caused by Azure, Azure don't handle the shadow rendering system or lighting rendering system, it is all handled by Unity, Azure only controls the parameter values. I think it is just one more of the hundreds of directional shadow glitches out there.
     
    JudahMantell likes this.
  13. xiaojianh6

    xiaojianh6

    Joined:
    Jan 20, 2021
    Posts:
    25
    After modification, the position of the moon is incorrect
     
  14. xiaojianh6

    xiaojianh6

    Joined:
    Jan 20, 2021
    Posts:
    25
  15. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Thanks again, I appreciate the great support!

    So I could duplicate the existing override object, then remove all of the properties I want control over, and assign that override object to each of the weather profiles?
    And you're saying that that will allow me to set the properties in an OnValueChanged Event?

    EDIT: That doesn't seem to be working. Any help with this would be amazing. Azure is awesome, but this seems like a relatively basic feature that I'm sure there's a workaround for :)
    I'm already replacing the clouds with a different system from the asset store that I'm syncing up with Azure, and I'd hate to have to do that with fog as well.

    Cool! I'm very curious about what's new that you're planning!
    Just a tip: To prevent any issues when updating to a major version, I would suggest publishing it as Azure 2.0 or whatever, and leave the current version up with limited support. That will allow you to charge more for a "better" product, without disrupting the existing users... while giving them access for free, of course :p
     
    Last edited: Feb 8, 2022
  16. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Hi everything is good expect Fog because I can see Fog inside buildings too! Is that possible to add a shadow cancellation option for this to remove fog inside buildings?
     
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    It is working the way it should, the position is not incorrect, it is just a different position than the full moon position. To change the moon phase, you should change the moon position relative to the sun.

    As I said to you in the other post, the moon lighting is automatic according to the relative position of the sun and moon. In the realistic mode, the sun and moon position are based on the time, date and location, so the moon phases will be the same as real world because the positions of the sun and moon will be realistic, the moon lighting is just a consequence of the sun and moon positions. In the simple mode, the moon is tracked at the opposite position relative to the sun, this is why it is always full moon.

    So just now I understand that you want to set the moon phase unrealistic by changing only the phase, but keeping the position opposite to the sun. Why didn't you explain what you wanted to do in detail from the start, instead of waiting for me to guess it?

    And finally, it implies that you tested this solution just now to figured out that it didn't work the way you wanted, but you were asking to update the asset with a feature that you hadn't even tested yet and that wouldn't work the way you wanted!
     
  18. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Yes, but it will require some work to configure the profiles and the override properties list again, just removing any custom property of the override object will mess up the "Override Properties" list in the weather controller component because I don't find a way to sync it perfectly, so it also requires that you configure the "Override Properties" list targets again if you remove a custom property from the override object list or change the list order.

    There is a fast way, Azure will override only the properties you configure it to override in the "Override Properties" list of the weather controller component. So just remove from the "Override Properties" list the property you want to set by slider and Azure will stop to override it.
    OverrideProperty.jpg

    When the override property is empty...
    OverridePropertyEmpty.jpg
    Azure will perform the custom property blends and transitions from profiles anyway, but will not send the resulting value to the target property in the component. In other words, Azure will not handle the target property anymore, and you will need to access the component through your own code to set the property if you want to change it.

    It is not simple if you want to set it by slider and at same time want Azure to handle it using profiles and weather blends. Current, you should choose if you want Azure to handle it or remove it from the override list to take total and exclusive control of it.

    Currently, I don't have many details to talk about, but the override system is one of the points I want to improve, it's very useful and powerful, but it's still rigid, and I want to make it more modular.
     
  19. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    This is a complex and problematic task to do. You may try to change the render queue of the inside build materials to transparent queue if it is allowed, or disable the material depth buffer render in the shader, or just use in the build interiors, a material that don't draw to the depth buffer like a transparent material. There is also the option of using another camera without the fog effect, configured to render only the inside build and objects.
     
    ksam2 likes this.
  20. xiaojianh6

    xiaojianh6

    Joined:
    Jan 20, 2021
    Posts:
    25
    Sorry, I only want the effect of one and a half months. Maybe I didn't make it clear.

    Just switch to real mode and set the correct time. so sorry
     
  21. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Ah, I understand. My intention was to Only override the properties, ignoring Azure, which your suggestion accomplished.
    Thanks so much!
     
  22. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @DenisLemos !!
    How can I get Azure not to implement its sky in order to work with everything else in HDRP? What do I have to delete so that everything works without there being an Azure sky?

    In the past you sent me a modified copy and I ported it to HDRP. But now I would like to update to the latest version of Azure as I am very interested in the new "Override properties" feature as it saves me a lot of work if I want to add some new component for Azure to handle.

    Regards
     
  23. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    I'm also running into an issue where one of my cameras that is rendering to a render texture doesn't have the fog in the same way that the main camera does.
    upload_2022-2-9_19-20-8.png

    You can see the camera in the window doesn't have the effect as strongly.
    Both of them have the same renderer feature assigned to them.
    Thanks in advance for any help!
     
  24. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Each system is now a different and independent component, so I think you just need to remove from the prefab the "AzureSkyRenderController" component and don't use the sky material and fog effect in your scene. There is also the "AzureEffectsController" component used to control the particles and soundFX, I don't know if the particles will work in HDRP.

    You can test the current version in an empty project to see how the new features work before integrate it to your main project, if you don't like it, you can redownload the old package version.


    I just test it here using Unity 2020.3.24f1 LTS, and it is working without any issue.
    RenderTexture.jpg
    Check if the "Depth Texture" is "On" in the camera.
     
    ftejada likes this.
  25. qwert024

    qwert024

    Joined:
    Oct 21, 2015
    Posts:
    43
    Hi,
    sorry if my question is just very simple/basic!
    I just start playing with Azure[Sky] in my URP project today. The document says "Select the URP.asset and disable the Anti-Aliasing".
    I was wondering what if I need Anti-Aliasing? Should I use post processing or other settings to achieve that?
    It would be so great if anyone could help!
     
  26. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Ok thanks @DenisLemos !
    However, I have a question that I would like you to clarify for me.

    What is the "AzureWeatherController->OverrideObject->Target Type" variable for? I understand what the "Shader Property" option is for, but what type of data are the "Field and Property" options for?


    Edit:
    Another question I forgot...
    Does using System.Reflection for OverrideObjects generate so much garbage?
    Greetings
    dennis
     
    Last edited: Feb 10, 2022
  27. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    Exactly, you need to use the post-processing anti-aliasing. In each camera, there is the option to enable the AA.
    Antialiasing.jpg


    "Field" is when the target variable is declared in the original code as we generally do, this way:
    Code (CSharp):
    1. public float myFloat = 1.0f;
    "Property" is when the target variable is declared in the original code as a property, this way:
    Code (CSharp):
    1. private float m_myFloat = 1.0f;
    2. public float MyFloat { get => m_myFloat; set => m_myFloat = value; }
    To set it by writing script there is no difference, but to store the reference to the target variable and set it later, we need to consider the type. Generally, Unity's Inspector variables are declared as property!


    A little, it changes according to the number of custom properties you have. It generates garbage only because we need to store the variable reference, I don't know a way of doing it without using reflection.

    To not generate garbage, you need to avoid the use of the "Override Properties" list, just leave it empty and send the evaluated values to the target variables using your own script, it is very simple, just take a look in the "AzureOverridePropertiesManually.cs" script that is attached to the sky prefab of the "Override Properties By Scripting" scene.
     
    qwert024 and ftejada like this.
  28. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Hm... depth texture is On and the problem still happens. Any other ideas?
    Thanks!

    Edit: Also, can you provide some info on the difference between Azure and Azure Lite? Other than not having weather controls, I'm a bit confused.
    If I just need time of day and the fog (which hopefully I can get working), does lite have any performance benefits?
    Thanks!
     
    Last edited: Feb 10, 2022
  29. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    @DenisLemos But this process of storing the variable reference has to be done at runtime?
    Is it not possible to store the reference of these variables in editor mode, so that this garbage is not generated at runtime?
     
  30. MuntyMcFly

    MuntyMcFly

    Joined:
    Sep 29, 2016
    Posts:
    46
    I am having an issue I can't figure out how to deal with as my moon is showing through all my models no matter what I do. Is there a way to fix this? Using URP and 2020lts everything seems ok besides that and it doesn't show light through during the day part of the cycle. I have increases thickness of walls etc but with no progress.
     

    Attached Files:

  31. qwert024

    qwert024

    Joined:
    Oct 21, 2015
    Posts:
    43
    Hi, thanks for your reply!!
    I just built the sample scenes ("Default", "Weather Zones" and others) with WebGL and noticed that fog is missing and transparent materials turns into pink. They work fine in editor though.
    I was wondering if I missed something.
     
  32. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Unfortunately not, it always works here.

    • The time of day is only the simple mode.
    • The cloud system is only the static clouds.
    • There is no weather controller and profiles.
    • There are no particles, thunders and sound FX.
    • All features in only one script component.
    The sky and fog render will be the same performance because it is almost the same look and almost the same approach. There is the option to render the sky using a skydome mesh and in this case the shader calculations are done in the vertex which is fast, but only the sky render, the fog is still computed by pixel.

    If you disable some features of the full version, you will get a similar performance. The lite version will be deprecated soon, or maybe it will become free, so I don't recommend buying that version.


    That's exactly how it's done!

    What generates the garbage is when the target variable is set, we need to call these C# methods FieldInfo.SetValue() and PropertyInfo.SetValue(). It's the internal code of these methods that is generating garbage, and until then I don't know how to get around it.

    It is not the moon that is rendered over the objects, the moon is in the skybox background. This is the Mie bright from the moon computed by the fog scattering effect. To fix it, just set the "Mie Distance" in the "Scattering" tab of the "AzureSkyRenderController" component.
    MieDistance.jpg
     
    MuntyMcFly and ftejada like this.
  33. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    I just tested it here, and I was able to successfully build all the sample scenes for WebGL.
    AzureWebGL.jpg
    I tested it using Unity 2020.3.24f1 and Universal RP 10.7.0.
     
    MuntyMcFly likes this.
  34. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    476
    Is there a better way of "Disabling" features of the full version rather than just not using them? I'd rather them not taking up performance in the background.
     
  35. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    If you remove the components you don't want to use, it will not waste performance in the background, this is why all system is by separated components.

    If you do not want to use the particles and sound FX, just remove the "AzureEffectsController" and also delete the particles game object from the prefab. If you do not want to use the weather and profiles, just remove the "AzureWeatherController" component and so on...

    You will only get the asset with the best performance, if you create it from scratch with all features target to your own purposes, even the lite version my have some feature you don't want.
     
  36. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    Hey there, I'm trying to integrate Azure with an older version of Crest Ocean- the 4.11 version available in this repository:

    https://github.com/wave-harmonic/crest/tags

    as it was the last version to use 2019.4, and I'm having trouble getting the integration to work. I followed the instructions on the first page of this thread, but im getting some shader error and pink materials.
    Would you be able to confirm if theyre still compatible?
     

    Attached Files:

  37. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    Just tested it here, and I can confirm it is working!
    AzureAndCrest.jpg
    Using Unity 2019.4.34.f1 LTS and Crest v4.11!

    Try the instructions from the first post of this forum again, as I can see by your screenshots, there are syntax errors in your shader code, you may not fill the function "ApplyAzureFog" with the required parameters.
     
  38. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    ah thanks! there was online in the instructions that was slightly different in the implementation:
    "col = lerp(col, scatterCol, saturate(1. - exp(-_DepthFogDensity.xyz * pixelZ)));"

    and the replacement needed to be copied exactly as your example was:
    "col = lerp(col, scatterCol, 1. - exp(-_DepthFogDensity.xyz * pixelZ));"

    Works great thanks!
     
  39. drawkin

    drawkin

    Joined:
    Jan 20, 2013
    Posts:
    1
    Hello! I'm working with AzureSky 6.0.2 & Unity 2021.2.7f1 Standard.

    I'm having a weird issue where the sun texture darkens during a sunset. It should still be emitting light as it goes down, but instead appears to turn off. Is there a setting I'm missing somewhere? Thank you so much! azure_sunset.jpg

    EDIT: We updated to the latest version of Azure 7.0 & the issue still persists. Looking at this more, it appears the sun is being turned off in favor of the moon coming up on the horizon. Is there a way for me to set when the moon's directional light is turned on? Thank you!
     
    Last edited: Feb 17, 2022
  40. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    It works this way for performance and artistic reasons, otherwise it would be required to compute the scattering twice, one for the sun light and another one for the moon light. Also, the calculations are simplified and the sun and moon light are not computed when it is below o horizon line, of course it is more realistic if we see the sun lighting the atmosphere even when the sun is down, but this sky model does not consider the circumference of the planet. So when the time is less than 6:00am and higher than 18:00pm, the sun is considered below the horizon line.

    But maybe there is a trick you can do, I don't know if it will mess up any other settings. Open the skybox shader and change this line in the fragment shader:
    Code (CSharp):
    1. float sunRise = saturate(dot(float3(0.0, 500.0, 0.0), _Azure_SunDirection) / r);
    By this one:
    Code (CSharp):
    1. float sunRise = saturate(dot(float3(0.0, 500.0, 0.0), _Azure_SunDirection) / r) + 0.3;
    You need to make this same change to all sky shader variants, also to the fog scattering shader and also to the function "ComputeFogScatteringColor()" of the "AzureFogCore.cginc" file.

    It will increase the sunset intensity a bit and force the sun light to show in the sky even if it is darkness.
     
    drawkin likes this.
  41. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    hey
    I'm having an annoying problem where no matter what i do, when i add the AzureSkyController prefab to a new scene, when the time changes the DirectionalLight intensity stays stuck at .58, it doesnt change as per the DefaultWeatherProfile values.

    The color is changing, and the position of the sun/moon is changing, but no matter what time it is, the actual Intensity of the Light stays at .58 for all 24 hours. I have ONE scene where it works properly, along with the demo scenes, but any new scene i add it to, it doesnt work. Anything that might be causing this?

    EDIT: actually now it looks like even in my one scene, the Directional Intensity doesnt change anymore. It stays at 1, or whatever the value is at scene Start...
    When I'm in Edit Mode, and i change the timeline, it properly changes the intensity, but not during PlayMode
     
  42. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    I can only know what might be happening if I can reproduce the error here, I've tested several versions of Unity and everything is working as it should. The directional light intensity is controlled by scripting, so if it works here, it should work for you too.

    By default, the directional light intensity is controlled by the override system, check in the "Override Properties" list of the weather controller component if the override setup of directional light intensity is configured correctly.
    DirectionalLightIntensity.jpg

    Try testing Azure on an empty project to see if the same error will happen, or try re-importing Azure into your project.

    I would say maybe you changed some setting, but as you said it works in edit mode and stops working in play mode, maybe this property is being controlled by some other script or system you have in the project because it doesn't make sense to just work in edit mode, as the code executed by Azure is the same in both modes.
     
  43. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157




    Here's a video of it happening.
    It seems to have been fixed by just re-adding the default AzureSky Controller Prefab to my scene, but after closing and re-opening the project again, now its broken again.

    EDIT: sorry wrong video, here's the correct one:




    EDIT: Okay i just tried that fix i mentioned above again, and its still broken. I dont think ive changed anything related to Azure, so im at a loss. It works in the demo scenes, just not any fresh scene i create. those override properties are the same as you described
     
  44. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    AH, okay so it looks like CREST OCEAN is somehow interfering with it, do you know if this is something you've encountered? If i remove the Crest Ocean object from the scene, it works normally, but whenever i have the crest ocean master object, it seems to somehow overwrite the Directional Light Intensity somehow?

    This component "Crest Ocean Renderer.cs" with the Directional Light, is whats doing it. if I remove the light here it works, but Crest stops working properly. Any suggestions of what i might be able to do to avoid this?
     

    Attached Files:

    Last edited: Mar 22, 2022
  45. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    AH, found it. It was this "CrestUnderwaterEnvironmentalLighting" component. Says right on the label it "modifies the Directional Light Intensity," mustve somehow been triggering it when too close to 0 on the World Y axis
     

    Attached Files:

  46. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    This code from the LateUpdate() of the "CrestUnderwaterEnvironmentalLighting" component that is causing the issue:
    Code (CSharp):
    1. // Darken environmental lighting when viewer underwater
    2. if (_primaryLight)
    3. {
    4.     _primaryLight.intensity = Mathf.Lerp(0, _lightIntensity, depthMultiplier);
    5. }
    Just remove this component if you don't need this feature, or you will need to edit it to work with Azure. The script seems to be storing the directional light intensity only in the OnEnable() and using this fixed value in the late update. You can try something like this:

    Include Azure API to the script:
    Code (CSharp):
    1. using UnityEngine.AzureSky;
    Add to it a reference to the weather controller component:
    Code (CSharp):
    1. public AzureWeatherController weatherController; // Remember to attach the weather controller component in the Inspector
    And change the code in the LateUpdate() to lerp the directional light intensity value from the override system output instead of using the fixed one:
    Code (CSharp):
    1. // Darken environmental lighting when viewer underwater
    2. if (_primaryLight)
    3. {
    4.     // The number 19 is referent to the index of override property that controls the directional light intensity in the "Override Properties" list
    5.     _lightIntensity = weatherController.GetOverrideFloatOutput(19);
    6.     _primaryLight.intensity = Mathf.Lerp(0, _lightIntensity, depthMultiplier);
    7. }
    As you can see, you can get the output value from an override property manually and use it anywhere.

    PS: I don't have time right now to test if it will work, but the logic is that!
     
  47. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    157
    Thanks that all sounds right! I just ended up enabling it when the camera enters the water, and disabling when exits, but ill try your suggestions and let you know if theres an issue, thanks!
     
  48. IzMePapa

    IzMePapa

    Joined:
    Apr 19, 2021
    Posts:
    1
    How's the WEBGL support for this?

    We've had spotty results during exporting. Is there a list of certain features or shaders that don't work with WebGL?
     
  49. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    I did the build for WebGL with all the features without any problems here, I just don't remember testing the thunder instantiation, but I don't see any reason why this wouldn't work.

    The Default demo scene with day-night cycle working very well:
    Default.jpg

    The GI demo scene with the reflection probe working very well:

    ReflectionProbe.jpg

    The Weather Zones demo scene with the particles working very well:
    WeatherZone.jpg

    Note that WebGL have some limitations, as no real-time GI support, and I did the tests using WebGL 2.0 and Firefox.
     
  50. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Is there an apk we can get to see performance on android?