Search Unity

Graphics Azure[Sky] - Dynamic Skybox

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

  1. Deleted User

    Deleted User

    Guest

    I second the idea of having a Discord.
     
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Unfortunately not, I think it is better to keep all the questions and answers in one place just to make the research easier, but I didn't know about this forum limitation. But feel free to ask any questions here.
     
  3. colleenmacklin

    colleenmacklin

    Joined:
    Aug 12, 2015
    Posts:
    2
    Hi! Loving Azure Sky! However, I am having problems with custom events. They don't predictably trigger for me. Here's the scenario:
    I have a script that increments the timeline at 2x speed from 5am to 3pm. (attached)
    I want to switch from the fogginess1 weather profile to clear when it is 1pm. (editor image attached)

    In runtime, it does not always switch the weather profile. What's wrong with my setup?
     

    Attached Files:

  4. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    I was able to confirm this issue, you found a bug. What happens is that the event system checks if the current time and date is "exactly the same" as the time and date set in the event, when you increase the timeline speed to a very fast value, a few minutes can be skipped and consequently the time will not match the event time.

    I will try to send a fix this weekend, until then you can do the following:

    Add this 2 lines to "AzureCustomEvent" class located at the "AzureUtilities" script.
    Code (CSharp):
    1. public int executedHour = 0;
    2. public bool isAlreadyExecutedOnThisHour = false;
    And replace the method "ScanCustomEventList()" from the AzureTimeController script by this one:
    Code (CSharp):
    1. /// <summary>
    2. /// Scans the custom event list and perform the event that match with the current date and time.
    3. /// </summary>
    4. private void ScanCustomEventList()
    5. {
    6.     if (m_customEventList.Count <= 0)
    7.         return;
    8.  
    9.     for (int i = 0; i < m_customEventList.Count; i++)
    10.     {
    11.         if (m_customEventList[i].unityEvent == null)
    12.             continue;
    13.         if (m_customEventList[i].year != m_year && m_customEventList[i].year != -1)
    14.             continue;
    15.         if (m_customEventList[i].month != m_month && m_customEventList[i].month != -1)
    16.             continue;
    17.         if (m_customEventList[i].day != m_day && m_customEventList[i].day != -1)
    18.             continue;
    19.  
    20.         if (m_hour != m_customEventList[i].executedHour) m_customEventList[i].isAlreadyExecutedOnThisHour = false;
    21.         if (m_customEventList[i].hour != m_hour && m_customEventList[i].hour != -1)
    22.             continue;
    23.  
    24.         if (m_customEventList[i].minute == -1)
    25.         {
    26.             m_customEventList[i].unityEvent.Invoke();
    27.         }
    28.         else
    29.         {
    30.             if (!m_customEventList[i].isAlreadyExecutedOnThisHour)
    31.             {
    32.                 if (m_minute > m_customEventList[i].minute)
    33.                 {
    34.                     m_customEventList[i].executedHour = m_hour;
    35.                     m_customEventList[i].isAlreadyExecutedOnThisHour = true;
    36.                     m_customEventList[i].unityEvent.Invoke();
    37.                 }
    38.             }
    39.         }
    40.     }
    41. }
    I tested it on a 3 minute day cycle that is already very fast and increased the timeline speed to an insane value of 200x and it worked without any problems.
     
    Fibonaccov and Acissathar like this.
  5. colleenmacklin

    colleenmacklin

    Joined:
    Aug 12, 2015
    Posts:
    2
    Thank you for finding this! That's what I thought. I imagine my use case is a little different from most, but it is really nice to be able to create sped up cinematic effects with your tool!
     
  6. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    Hi,

    I'm using Volumetric Fog and Mist 2 on URP (asset by Kronnect), and I'm trying to make my fog volumes work with the fog system that comes with Azure. I have set the Fog Material that Azure uses to use render queue Transparent+100 (3100) so it uses the same as volumetric fog and mist 2.

    However, it doesn't work - My fog volumes are not affected by the Azure fog.

    Here's my setup in my renderer:
    upload_2021-4-28_17-38-41.png

    Any idea? Setting it to "After rendering transparent" made my tree leaves behave in a weird way, if I recall correctly.
    Thank you :)
     
  7. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    I am not sure that these assets will work together.
    • These assets were developed for similar purpose and not to work together, they are probably incompatible.
    • I suppose the Volumetric Fog and Mist 2 is some kind of post processing effect, in this case there is no way for the Azure fog system to recognize this other fog effect in the depth buffer and affect it with the Azure fog, in other words, for the Azure fog system this other fog effect do not exist, no matter the render queue you set for the Azure fog material or the Render Pass Event you set for the Azure Fog Scattering Feature.
    But if Volumetric Fog and Mist 2 uses some kind of 3d mesh in the scene to render the fog, you can try to edit the Volumetric Fog and Mist 2 shader using the Azure approach to implement support for transparent materials, in this case it may work.

    Another option is to try to merge the Azure fog shader into the Volumetric Fog and Mist 2 shader, so you can compute the Azure fog and Volumetric Fog and Mist 2 using the same world space coordinate and apply both effects as a single effect in the same pass, but this is a very difficult task to do and requires that you have a good knowledge of shader development.
     
  8. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    They actually have thought of this it seems. Here's the docs about it:

    upload_2021-4-29_20-11-58.png
    upload_2021-4-29_20-12-33.png

    So I should probably edit the Azure material?

    Thanks a lot for your time.
     

    Attached Files:

  9. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    The technical problem here is another one, this part of the Volumetric Fog and Mist 2 documentation that you mentioned is to support this asset for transparent materials. Azure also has an approach to support the fog system on transparent materials.

    I think you misunderstand how post-processing effects works.
    Post-processing effects works after the final image is rendered by Unity, so the shader takes that image and applies the post-processing effect to it.

    Fog effects like Azure and Volumetric Fog and Mist 2 works only with the final screen output image, but in this case the depth buffer texture is also used to compute the world space position of each pixel on the screen and apply the fog over the final image according to the distance the object redering that pixel is from the camera.

    Both Azure and Volumetric Fog and Mist 2 fog effects need the depth buffer information to know the distance and position of each pixel on the screen and then compute the amount of fog that pixel should render.

    Most transparent materials do not draw to the depth buffer texture and in this case the fog system does not know that these materials exist in the scene to include it to the fog computation. That is why this kind of effects must be set to be rendered before transparent objects and why Azure and Volumetric Fog and Mist 2 has an approach to dealing with transparent materials.

    The Volumetric Fog and Mist 2 approach is what you just posted, Azure uses a different approach that you need to do edit the transparent shader to include the fog calculations locally per material, similar to the Unity default fog.

    So why won't Azure's fog system work with Volumetric Fog and Mist 2? Because Volumetric Fog and Mist 2 is a post-processing effect and Azure fog system is also a post-processing effect, each of the effects does not know that the other exists, so the Azure fog system does not include the Volumetric Fog and Mist 2 in the fog computation because Volumetric Fog and Mist 2 is invisible to Azure.

    And why is Volumetric Fog and Mist 2 invisible to the Azure fog system? Because as I said earlier, these kind of effects only "see" what is rendered in the depth buffer texture. And that's why I said in the previous post that Azure is probably not going to work with Volumetric Fog and Mist 2.
     
  10. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340

    Thank you. I have made it so the volumetric fog objects are getting "whiter" the further the camera is from them, so it actually works quite well to fake the desired effect. I was just wondering if there was a simpler way. I totally understand the post processing part, thanks for your help.
     
  11. Deleted User

    Deleted User

    Guest

    Just a quick question; there's no setting for the Global Fog Color right ? It takes the color from the scene's global fog ?
     
  12. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    The fog is an extension of the sky, if you change any scattering settings, it will affect both the sky and fog. So there is no global color for the fog.
     
    Deleted User likes this.
  13. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Hi, Denis! Small question. Is it OK thay I cannot see fog on Scene Window? Tested on DEMO and my own scenes.
    Unity 2019.4, URP 7.5

    Never mind! Just set as default my custom renderer (the one with the FogScatteringFeature)

    Thanks!
    Eduardo
     
    Last edited: May 4, 2021
    DenisLemos likes this.
  14. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Does Azure Sky Lite work on oculus quest 2 using standard renderer with multi-view for android?
     
  15. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    Regarding the oculus quest 2 I don't have this device for testing, but anyway Azure is not targeted for mobile devices.
     
  16. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Hi,

    Is there a way to reduce the shadow intensity of the directional light at night only? I want the moon to not have as strong shadows as the sun.
     
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    There are a few options:
    • You can decrease the directional light intensity curve at night.
    • You can increase the brightness of the ambient color gradient at night.
    • You can decrease the directional light "Shadow Strength" property, this property controls the shadows intensity/opacity.
    By default, these properties are already created in the "_OverrideObject.asset" profile as custom properties, but in case of the "Directional Light Strength", it is set as slider, you need to select the "_OverrideObject.asset" and change the "Customization Mode" of this custom property to "Timeline Based Curve" , that way you can set different values at any time of day and you can reduce the directinal light shadows only at night.

    Keep in mind that if by default Azure doesn't provide a property to control something you want, you can create your own custom property and use the override system to expand Azure's capability.
     
  18. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    Hey Denis
    Is there anyway to safely remove weather vfx(rain/snow etc)but keep weather sky change?
     
  19. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    I mean How can I use this asset with a very lit way,
    only include daynight cycle/skybox/timeline.get;set;/weather environment change.
     
  20. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    If you remove the "Azure Effects Controller" component, the sound and particle effects will stop working, I assume you don't want to use these features.

    To safely remove this component, you must also remove all custom properties from "_OverrideObject.asset" that are related to this component, the override object profile is located in the profiles folder. So, remove all the custom properties from "Light Rain Intensity" to "Wind Direction".

    Now you can safely remove the component and delete the "Sounds, Particles and Wind Zone" game objects from the sky prefab.

    Azure is designed to be able to remove any component or use each component independently, you can mold Azure for your use. By default, some components are referenced to the "Override Property" system of the "Azure Weather Controller" component, so you just need to take care to remove the references with this component by editing the "_OverrideObject.asset" or start building a new "Override Object Profile" from scratch.
     
    ununion likes this.
  21. ben_and_his_beard

    ben_and_his_beard

    Joined:
    Nov 29, 2016
    Posts:
    6
    I've been using Azure for a few projects recently and, now that I'm applying it to a non-standard sky, I'm finding there's a particular area that keeps disrupting my ability to intuitively use the profiles. For now, I'm still using the previous release prior to the UI and profile update until I have time to migrate my profiles over, and I have fog disabled because it doesn't work on Quest in VR (Oculus's fault). Obviously the math under the hood is way over my head, so if my understanding is a little off, feel free to ignore the suggestions.

    When making a sky from scratch, the most disruptive part of the workflow is having to dramatically transition various scattering settings at sunrise and sunset. Almost every curve is forced to include that jump to make things look natural, yet in reality the atmosphere itself hasn't changed at all. Not only does this make it impossible to properly understand how things like Mie and Rayleigh scattering work, it also makes it really difficult to properly balance those pivotal minutes of the day when values are shifting so dramatically. Some changes are easier to work with because they're more artificial, like colors and multipliers.

    I've tried my best to figure out why that workflow feels wrong, and the answer I've come up with is simple: it's impossible to describe the atmosphere separately from the light sources. Atmospheres exist and can be described even when there is no light source. If the sun disappears, Earth's atmosphere will scatter light according to the exact same rules as before. The chemical makeup of our atmosphere is the same when the sun goes down as when the moon rises. Cloud cover doesn't change in that instant, nor does the thickness of the atmosphere. All of the qualities describing the atmosphere should be primarily static throughout the day.

    So what does change and force all those curves to spike? The energy of the sun relative to the energy of the moon. Azure forces me to establish that fact repeatedly in each and every variable. Without carefully tweaking the curves on all those jumping values, I end up with highly visible skips.

    Profiles would be more intuitive if the energy inputs of the sun and moon were split into their own variables. Then I could set their brightness values once, and set the atmosphere's scattering once, rather than redundantly inserting that change into all the atmospheric values. I could still subtly shift them to create more pleasing results, but there shouldn't be any reason to make those variables behave so wildly.



    (And some other thoughts while I'm here...)
    A more complex control could be used to derive the energy of the moon based on its angle relative to the sun. When they are on opposite sides, the moon radiates its full energy value (as a reflector). When the moon is on the same side as the sun, though, it won't reflect anything and its value is multiplied lower.

    In the long run, I would love to have the celestial bodies be modular themselves. By default they operate as Earth's sun and moon with calendar driven positions, yet it would be rather nice to be able to experiment with custom emitters and reflectors. Being able to insert multiple suns or multiple moons, for example, and to assign them different orbit speeds so that you might have a moon that orbits in sync with the planet, remaining overhead for years. Each celestial body could be described as either a light emitter (sun) or a light reflector (moon), with brightness or reflectivity values corresponding to them.

    For more artistic purposes, I often find myself wishing for an artificial gradient overlaid on the pole opposite the sun. Sometimes it's a matter of creating a better two-tone color shift, or to reintroduce different types of darkness while keeping the brighter colors I've developed near the sun (imagine dark shadows under storm clouds on the horizon behind you as the sun sets in clear skies opposite them). Really, a whole range of fake gradients could be useful to have alongside the accuracy driven base equation. Sometimes I just need a gradient around the horizon or above or below the world.

    Thanks!
     
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    Thanks for your feedback!

    There are several reasons why Azure is the way it is, the main ones are: Customizability and performance.

    I could make most settings work automatically in the shader, but for that I would need to set some arbitrary values based just on my particular taste. As Azure is a product, I've chosen to leave as many configurations as possible entirely in the user's hands.

    The reason the scattering settings are the same for the sun and moon is to improve performance, otherwise all sky calculations would have to be double computed, once for the sun and once for the moon (same for the fog scattering computation), that way it is also possible to take advantage of the same curve. Why waste performance twice? Why evaluate two curves if you only need one?

    You have a lot of good ideas here, but the problem is that most would fit better in a new product because I don't want to change Azure's visual identity or make big changes that might upset the current user base, some might not be possible because to the sky model used by Azure and others because I don't have the necessary knowledge to implement.
     
    ben_and_his_beard likes this.
  23. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class Example : MonoBehaviour
    5. {
    6.     public AzureTimeController timeController; // Drag the time controller here!
    7.  
    8.  
    9.  private void Update()
    10.     {
    11.         if (timeController.GetTimeOfDay().x == 7)
    12.         {
    13.             Debug.Log(gameObject.name + " - Start a new day!");
    14.         }
    15.  
    16.         if (timeController.GetTimeOfDay().x == 18)
    17.         {
    18.             Debug.Log(gameObject.name + " - End the day zzzZZzzz");
    19.         }
    20.     }
    21. }


    I think you should integrate this code in the documentation, 'cause I've browsed 26 forum pages to find an answer to my question! :confused::D

    So adding some scripts example would be much appreciated by noobs :rolleyes:
     
    Last edited: Jun 13, 2021
    DenisLemos likes this.
  24. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    Hi,

    I was expecting longitude and latitude + calendar to affect the sunrise and sunset time, but it doesn't seem to do it, looks like the sun is always setting at the same time.

    Is there a way to have longer or shorter days?

    Thanks!
     
  25. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    You need to set "Time Mode" to "Realistic" if you want the position of the sun and moon to respect the latitude, longitude, time and locatioln as in the real world, this way the sun will rise and set at different times of the day according to the date and location.

    If you set "Time Mode" to "Simple" the latitude and longitude will just tilt the sun's path across the sky regardless of date and geographic location, this option is great for simple games that don't need full realism and also saves performance because it does not require extensive calculations to compute the celestial positions.

    You also have the option to "Evaluate the Time of Day by Curve": See the video at 3m:10s
     
  26. Lishnor

    Lishnor

    Joined:
    Aug 19, 2017
    Posts:
    1
    Hi,
    Thank you for this amazing asset. There is a problem with rendering for VR with URP. Rendering for one eye is black and for the other is white. Is there a planned update to fix the issue? Or maybe there is a way you could help me fix this issue?

    From problems that I have found there in line 125 of FogScattering.shader is
    UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
    instead of
    UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(Input);

    And also in AzureFogScatteringFeature in OnCameraSetup depthBufferBits is set to 0 and I am not sure if it's correct because it seems unity automatically corrects this value and generates a warning.

    I hope we could resolve this issue and get it working properly because I really like this asset.
    Sorry for my English I am not a native speaker.
     
  27. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    Unfortunately I'm not a VR dev and I don't have a VR device for testing, so I can't properly support this platform. For this reason, this feature is not even disclosed in the description of the asset in the store.

    I just followed the step by step from the Unity documentation to make Azure shaders compatible with Single Pass Instaced rendering and made the edited shaders available in a replacement package.

    Before adding this replacement package to the asset, I sent it to some users to test and they said it worked, and in my tests using just the editor without a VR device everything seems to work fine in URP. But it's strange that the line of code you quoted from the fog scattering shader didn't show any compilation errors on the console (I'll fix that in the next update, but I'm afraid that won't be enough).

    Regarding the initialization of "depthBufferBits" in OnCameraSetup, this is how it is done in the example code provided by Unity, here no message is shown on the console, not even a warning message. I'm using Unity 2021.1.2f1!

    I'm sorry I can't give the best support on it, but unfortunately without a VR device for testing there's no way I can replicate the issue to fix.
     
  28. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Hello there,
    I need help with Wind!
    Please I need to rotate objects, and let some cloth react to wind that should connected to the weather (obviously).

    So please give me some c# example 'cause I'm lost! :confused::(
     
  29. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    I think your first question is not related to Azure in general, do you want to rotate objects according to some Azure custom property? Maybe this isn't the best choice because Azure's custom properties feature doesn't currently support Vector3.

    By default the Azure prefab comes with a directional WindZone and custom properties already added to the profiles to control the direction and main intensity of the WindZone, just set the value you want in each weather profile.

    To be honest, I don't know if Unity can handle the physics of cloths affected by a WindZone, but if that's possible I think the only thing you need to do in Azure is set the proper wind intensity for each profile and let Unity handle the simulation.

    An alternative would be to configure the physics of your clothing as shown in the video below:


    Then add custom properties to the profiles and use the "Override Property System" to access the "Interactive Cloth" component and set different values according to the weather profile used. To learn how to add custom properties to profiles and how to use the "Override Property System" see the video tutorial at 2min50s:


    Please try to elaborate your first question better because I don't quite understand what you want to achieve.
     
    Last edited: Jun 27, 2021
  30. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I've got no time to investigate weather system in Azure, but I guess it will randomize the wind direction, anyway what I'm trying to do is to syncronize all involved objects in the scene with the Azure Wind...
    At this point I guess I have to code by my self for terrain grass, for tress, ropes and cloth.
     
  31. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    No, Azure doesn't randomize the wind direction, you set in each profile a wind direction value between 0 and 1 and the weather controller sets the rotation of the WindZone Y-axis between -180 and 180 by overriting the "Wind Direction" property of the "Azure Effects Controller" component. When you change the weather to another profile the wind direction will be interpolated between the current profile and the new profile. This is a basic behavior, you can change it for your use case by editing or removing this line of code on the Update of the "Azure Effects Controller" component.
    Code (CSharp):
    1. windZone.transform.rotation = Quaternion.Euler(new Vector3(0.0f, Mathf.Lerp(-180f, 180f, windDirection) + 180.0f, 0.0f));
    The weather controller only gets the interpolated value (0-1) from the profiles and send it to another script property overrinting the original value, you use this overrited property the way you want.

    Regarding the wind intensity, the weather controller gets the interpolated value (0-1) from the profiles and uses it to overwrite the "Wind Intensity" property of the "Azure Effects Controller" component, the effects controller component works here as a link and send the overrited value to the WindZone component. I did it this way to be more organized, but you can use the overwrite system to overwrite the main wind intensity directly on the WindZone component as shown in the video tutorial teaching how to override the opacity of directional light shadows. Did you watch the video?

    Usually the grass and vegetation shaders are integrated with Unity's wind system and you only need to set the wind intensity, that Azure already does or can do for you. If you are creating your own vegetation system, you just need to access the "WindZone" component, get the wind main intensity value and send it to the vegetation shaders.

    You can also access the WindZone component to get the wind intensity and transform direction, and use that with the Rigibody.AddForce to roll a ball or barrel according to the WindZone properties.
     
    MaximilianPs likes this.
  32. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I really like Azure, and thanks for your kindness, now it is much more clear, and I've found a solution for rope and cloth that interact with WindZone, so I guess I can easy resolve my issue :)
     
    DenisLemos likes this.
  33. Gleb_Taranow

    Gleb_Taranow

    Joined:
    Jan 30, 2017
    Posts:
    5
    Hey there, with Unity 2020.3.10f with URP, using the newest version of Azure with the Crest water asset (and the Ocean shader configured as per Azure documentation), im getting these weird transparency issues:

    These happen with a lot of different opaque surface shaders.
    Going trough the frame debugger, I could see that this was the first time the issue ocurred:

    Any help appreciated
     
  34. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    Unfortunately I don't have the Crest URP version for testing, but you said you followed the documentation instructions to implement the fog support for transparent materials, I suspect this might be the problem. As Crest is a more complex system it requires a custom implementation, so you should follow the instructions on the first page of this forum which is a bit different from the instructions on the documentation that comes with the package.
     
  35. Gleb_Taranow

    Gleb_Taranow

    Joined:
    Jan 30, 2017
    Posts:
    5
    First of all, thanks for the fast reply,
    Now, I didn't word this too well, but I actually followed the instructions of the forum post you linked, and the issues stil persist.
    Any other idea what could cause this?
    EDIT: Further clarification: When I remove the Fog Scattering Feature from the Renderer, the issue goes away.
     
    Last edited: Jul 13, 2021
  36. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    I can't imagine what could be happening, for me Azure and Unity 2020.3 URP is running smooth both transparent implementation and opaque materials, unfortunately I don't have the paid version of Crest to test.
    AzureURPTest.jpg

    I know a lot of customers use Azure and Crest URP and I don't remember anyone reporting problems so far.

    Try changing the fog feature's "Render Pass Event" to anything between "after opaque" and "before transparent".

    Do Azure example scenes work? If they work then there must be some incompatibility between Azure and Crest that I don't know about.
     
  37. Gleb_Taranow

    Gleb_Taranow

    Joined:
    Jan 30, 2017
    Posts:
    5
    Hey Denis, after fiddling around for some more time, I sadly still have not come up with a solution, the problem still persists. Changing the Render Pass Event does not affect the issues, and the sample scenes do work, it is certainly a weird interaction between azure and crest specifically.
    I am in contact with the crest devs, trying to figure this out, and I understand you can not test this yourself, as you do not posess the asset for URP, but are there any other suggestions on what it could be you could give anyways?
     
  38. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    I apologize for the delay!

    This could be a lot of things, we can't say for sure that it's a problem with Azure or Crest, it could be a URP bug or something related to your hardware. On my computer if I set the "Render Pass Event" specifically to "After Rendering Opaques" the fog works weird, here I need to set it between "Before Rendering Skybox" and "Before Rendering Transparents" to run smoothly. This is weird because I'm using the same code provided by Unity to create the fog feature, so I assume I did it exactly the way they designed the URP to work.

    Now the fog feature is set to "Before Rendering Skybox" by default, but for a long time it has been set to "After Rendering Opaques" which is logically right and only one or two users had reported the same problem as me, for other users it worked without problems. I believe this is due to some hardware configuration.

    Azure's fog feature uses the depth buffer to reconstruct the pixel's world position on the screen and thus apply the right amount of fog according to the distance. That's why the "Render Pass Event" needs to be set between "After Rendering Opaques" and "Before Rendering Transparents".

    Transparent pixels don't draw to the depth buffer and therefore there's no way to know the global position of a transparent pixel, that's why you need to edit each transparent shader to calculate the fog individually on each material (per object).

    Maybe somehow Crest is manipulating the depth buffer texture before Azure uses it.

    There is an alternative option to use Azure fog, but it will be a lot of work, but I think it would solve any depth buffer problem because in this case it would not be necessary.

    You can use the same approach used to add fog support for transparent materials, but instead of just editing your transparent shaders, you do the same for opaque shaders and stop using the fog feature.

    This is how Unity's default fog works, if you look at the source code of the shaders provided by Unity you will find in each of them the commands that calculate the fog. I believe this is the right way (old school) to work with fog in games, post processing makes it a lot easier and faster, but it brings with it a lot of bugs and limitations.

    If nothing works, send me a private message with your invoice number and I'll give you a refund.
     
    Last edited: Jul 25, 2021
  39. AtomicWolfGames

    AtomicWolfGames

    Joined:
    Feb 15, 2018
    Posts:
    2
    Hi Denis,
    Your asset is fantastic! I only have one small problem with the fog.

    My configuration is Unity 2020.3.0, URP 10.3.2 and Azure v.7.0.4.
    I have R.A.M. 2019 water in my project (https://assetstore.unity.com/packages/tools/terrain/r-a-m-2019-river-auto-material-2019-145937) and I'm trying to modify its shaders for Azure fog support.
    So, I changed surface shader like this:

    Code (CSharp):
    1.                     surface.BaseColor = _Lerp_420a897962e93785a1c13220e0ce7eaa_Out_3;
    2.                     surface.NormalTS = _Lerp_e1a089f0b8e23b80aa4f164d07b1322f_Out_3;
    3.                     surface.Emission = float3(0, 0, 0);
    4.                     surface.Specular = _Vector3_1c022fc7a6c5f68e83c89cd86ba29826_Out_0;
    5.                     surface.Smoothness = _Lerp_686b755a9fdb3e839cb54b79442f36b0_Out_3;
    6.                     surface.Occlusion = _Property_2cfdd8606d404f84b73185f1663b8068_Out_0;
    7.                     // *** start
    8.                     float4 azureFog = ApplyAzureFog( float4(surface.BaseColor, 1.0), IN.WorldSpacePosition);
    9.                     surface.BaseColor = azureFog.rgb;
    10.                     // *** end
    11.                     surface.Alpha = _Branch_64b824b3a95100869055ff8a632abb7d_Out_3;                  
    12.                     return surface;
    13.                 }

    It works but fog's color on water is bad (too bright, almost white at noon). The color changes with day's time but it is always different from the rest of the fog.
    What am I doing wrong?

    fog_bad_color.jpg
     
  40. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    Unfortunately I don't have this asset, but from what I could see, the shader seems to be a surface shader, am I right?

    The problem in this case is that you are only applying the fog over the base color and this is wrong, in fact you should apply the fog using the final shader color as input so that the fog can cover the entire surface of the water, the way you used "ApplyAzureFog" function makes fog ignore emission, normal map, specular, oclusion, etc...

    But if this really is a surface shader, the implementation might be similar to the one shown on the first page of this forum for adding support to the water (surface shader) that comes in the Gaia package.
     
  41. AtomicWolfGames

    AtomicWolfGames

    Joined:
    Feb 15, 2018
    Posts:
    2
    R.A.M. shader was originally a surface shader, but this type doesn't work in URP, so R.A.M.'s author patched it with shader generated from shadergraph.

    You were right, when I moved the ApplyAzureFog() to the end and using the final shader color as input, everything started working fine.
    Thank you!

    fogOnWater.jpg
     
    DenisLemos likes this.
  42. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Are there any compatible lightshafts asset avaialble for this sky system ? I cant seem to find an option on Azure itself to enable lightshafts (URP)
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Unfortunately Azure doesn't currently have this feature, I think you should look for something like "volumetric light" or "sun shaft effect", as you want the effect to work in URP will be harder to find. I found this free asset, but I don't know if it works in URP.
     
  44. potatosallad3

    potatosallad3

    Joined:
    Sep 10, 2019
    Posts:
    31
    I'm really struggling to find a solution to this issue I am having. I cannot figure out why my lighting does not update at runtime. If I start a scene, it will look like this:

    If I then either leave AzureSky to run through its day night cycle, or drag the time manually, the lighting does not update and it ends up looking like this:


    Where as at night it should look like this:


    The environment light intensity and colour is being set by a sun curve in the azureSky profile I am using. All lighting settings I can find are set to real time, and yet Unity still has to generate the lighting. Or else 3d objects and clouds DO NOT receive any lighting information except what the lighting was when the scene started. I'm totally confused. What steps should I take in order to achieve consistent day night cycle lighting in real time, like what is shown in your latest videos? Such as this one, around 2:30 in:

     
    Last edited: Aug 10, 2021
  45. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    What do clouds and water use for lighting? Do they use global illumination or do they get information from a reflection probe?

    Usually effects like these use information from a reflection probe to apply lighting and reflection, if this is the case, check if the reflection probe state in the "Azure Reflection Controller" component is set to "On" and if the "Refresh Mode" is set to "Every Frame" or "Via Scripting", by default it is set to "On Awake" which makes the probe update only at the scene start.

    For some reason I'm also unaware of, Unity builds the lighting only at the start and doesn't seem to update it anymore regardless of whether the lighting settings change or not, I think this is not related to Azure. Try checking the "Auto Generate" option of the "Lighting" window and make sure that in the same window the "Realtime Global Illumination" option is enabled.

    The videos are using the settings that come in the profiles by default, you can check the "_Default" sample scene.
     
  46. potatosallad3

    potatosallad3

    Joined:
    Sep 10, 2019
    Posts:
    31
    Hi, yes I checked the Azure Reflection Controller, it is set to On, and to Every Frame.
    The clouds just receive direct and environment light values, the water is Lux water which I believe uses probes, but I'd have to check.

    Yes, is this an issue that you are also noticing? Is anyone else running into this issue? I am having this issue with Auto Generate selected, and Realtime Global Illumination enabled. It almost seems as though Unity is ignoring this and forcing me to pick one set of lighting data, and once that has been picked, it simply refuses to change it until I restart playmode. I don't know if its a bug per se, or if theres a setting I am missing... not sure. But if its not a bug it seems like a ridiculously constricting design choice, many games have changing light conditions...

    Thanks for your answer
     
  47. potatosallad3

    potatosallad3

    Joined:
    Sep 10, 2019
    Posts:
    31
    Testing on your _Default scene, I can recreate my issue by turning off the terrain. Once the terrain has been turned off, the lighting is completely broken, objects retain whatever lighting conditions were present at scene start. Unity seems to be using erroneous prebaked lightmaps at all times, even when explicitly told not to. This is a bizarre constriction to impose, as it essentially makes any form of day night cycle impossible without some fairly extreme effort. Very strange. It is simply not practical to make a separate scene for each time of day, but it is now not possible to set the time of day on scene load as the lighting data will be incorrect. I'm really lost as to what it is that I am missing.
     
    Last edited: Aug 11, 2021
  48. lightpi

    lightpi

    Joined:
    Aug 6, 2018
    Posts:
    2
    Hi Denis, is it possible to provide a general method to modify the Shader made by Amplify Shader Editor or Shader Graph? :(This will become extremely friendly to custom transparency Shader interaction with fog scattering.:)
     
  49. yy2045

    yy2045

    Joined:
    Jul 22, 2021
    Posts:
    4
    Hello

    I've purchased and used your asset and I'm very satisfied!

    But while working on it, I suddenly found out that there was a dotted line in the background that I had never seen before.

    It disappears when I use Unity's default skybox or change the cloud mode to Dynamic or Off.

    The end of the dotted line (the top of the sky) looks as if it is being sucked into a point.

    When I adjust the Static Cloud extension and the Saturation, the dotted line remains the same.
    But Opacity is affected. (If the Opacity is 0, the dotted line will also disappear.)

    When you import a new package to a new project, there is no dotted line..

    But I've already done a lot of work on the prefab that has dotted lines.
    I want to know why this came about and how to get rid of it.

    Thank you very much.



     
  50. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Hi,

    I'm not familiar with this kind of visual programming, so I don't know if it's possible or if it's going to have some kind of limitations. I'm going to investigate and see what I can do, but if I'm not wrong it's possible to convert the shader graph to code and then implement the fog to the shader later.


    I think this is related to the texture import settings, did you change anything? In my tests this issue only shows up when the texture has the mip maps enabled in the texture import settings. Try to disable the "Generate Mip Maps" option in the texture import settings of the static cloud textures, if it is eventually enabled.