Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Graphics Azure[Sky] - Dynamic Skybox

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

  1. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Gekigengar likes this.
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Working in Progress...

    New Timeline Transition

    Currently the timeline transition feature uses a simple linear interpolation to apply a timeline transition effect to the time of day, this works, but it is somewhat limited. If you apply a time transition starting from 7am to 6pm on the same day, the transition will work very well. But if you want to apply a time transition starting at 10pm of one day to 7am of the next day, the linear interpolation will not work as espected because this kind of transition will make the time of day go back from 10pm to 7am of the same day.

    The new system allows you to create time transition from one day to another and even from any date and time to any other date and time, whether to the future or to the past.

    To apply a time transition, it is only necessary to call the "StartTimelineTransition()" method of the time controller component and pass as parameters the target time and date, the transition speed, as well as the "Forward" or "Backward" time direction. And if for some reason you want to cancel the time transition, just call the "CancelTimelineTransition()" method.

    The new update of Azure(complete version) with all the new features is almost ready, but it will still take a time to be released because I want to make tutorial videos explaining how to use the new features and I am currently using a temporary computer screen with very low resolution.
     
    Gekigengar and one_one like this.
  3. Deleted User

    Deleted User

    Guest

    In URP 10.x i keep getting this warning :
    "You can only call cameraColorTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed."

    Code (CSharp):
    1. UnityEngine.Rendering.Universal.ScriptableRenderer:get_cameraColorTarget ()
    2. AzureFogScatteringFeature:AddRenderPasses (UnityEngine.Rendering.Universal.ScriptableRenderer,UnityEngine.Rendering.Universal.RenderingData&) (at Assets/Plugins/Azure[Sky] Dynamic Skybox/Scripts/AzureFogScatteringFeature.cs:91)
    3. UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset,intptr,System.Collections.Generic.List`1<UnityEngine.Camera/RenderRequest>,Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle)
    4.  
    Any idea why ? And how possibly get rid of it ?
     
  4. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I just started a completely new test project using Unity 2020.2.1f1 and URP 10.2.2 and I imported Azure 6.0.2 free of error or warning messages.

    And to be honest, there would be no way for me to know how to solve this since the warming seems to be related to Unity's internal code and this script in question is also from Unity, from the Blit Render project sample.
     
    Deleted User likes this.
  5. Deleted User

    Deleted User

    Guest

    Apologies; I didn't notice the rest of the warning in my small editor window :
    Crest.OceanDepthCache:populateCache () (at Assets/Plugins/Crest/Crest/Scripts/LodData/OceanDepthCache.cs:268)
    Crest.OceanDepthCache:Start () (at Assets/Plugins/Crest/Crest/Scripts/LodData/OceanDepthCache.cs:100)

    So it's not related to Azure but Crest instead; I've asked them, waiting for reply.
     
  6. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Just showing a video with some of the main features of Azure[Sky] Dynamic Skybox v7.0.0 to come. Some already exist in the current version and have been improved, the main novelty is the feature called Override Property.

    Now I am creating the tutorial videos.
     
    Gekigengar and Deleted User like this.
  7. Deleted User

    Deleted User

    Guest

    Hi Denis, sorry to reopen the case; i've created a blank project (2020.2) and added Azure + Crest. No error like you said. Now when i add an "OceanDepthCache" i get my mentionned error.

    From the Crest guys I got this reply : "... not sure what that is exactly. but it is likely an issue with Azure. their scriptable render feature should be skipping our depth cache camera"

    I don't know what to do; beyond my scope of knowledge; but i hope you understand and we can find a quick fix.

    Also, regarding the Transparent tutorial, is there a way you can provide a concrete example for URP ?

    Thank you again for your help !
     
  8. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Try to change on the AzureFogScatteringFeature the Render Pass Event to something like "Before Rendering Transparent". It can be in any place between the "After Rendering Opaques" and "Before Rendering Transparent". I searched for many examples of how to make a Blit using Render Feature, and in all the examples the code is exactly the same as used in Azure, this seems to be the standard way, so I don't know what may be causing this warning message.

    I don't know what the OceanDepthCache is used for, but if it is used to make the water draw to the depth buffer and thus be affected by the fog, this may not be necessary because you can use the Azure approach to make the fog work on transparent objects that don't draw in the depth buffer.

    I don't have the Crest version for URP, but on the first page of this forum are the instructions on how to add fog scattering support by editing the Crest ocean shader.
     
  9. hdb0

    hdb0

    Joined:
    May 16, 2015
    Posts:
    6
    Hello, one of the Crest devs here, thanks for the thoughts/pointers so far Denis.

    Changing the render pass event did not help, according to onefoxstudio.

    The ocean depth cache renders the scene from a top down perspective to capture the terrain heights to know about shoreline, shallow water and etc. We need to trigger a normal render so that we can get gpu terrains and all that stuff (rather than just loop over meshes and submit them manually), then we grab the depth texture. So us triggering the render is triggering the Azure code and making Unity unhappy for whatever reason.

    I'm fairly sure this is solvable but dont quite know the solution yet. I have added an issue on our github to collect info about this in one place: https://github.com/wave-harmonic/crest/issues/750

    I'm waiting for input from my colleague who knows more about the depth cache rendering mechanism than me.
     
    Deleted User and DenisLemos like this.
  10. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Azure[Sky] Dynamic Skybox v7.0.0 Released!

    Asset Store link: https://assetstore.unity.com/packages/tools/particles-effects/azure-sky-dynamic-skybox-36050

    Requires Unity 2019.4.8f1 LTS or higher. Downloading with a lower version of Unity you will get Azure version 6.0.2, so the old version is still available for those who want to use the old version.
    • New asset made from scratch.
    • New Time Controller component.
    • New Weather Controller component.
    • New Override Properties sistem.
    • New Inspector.
    • And more...

    • [Edited] This is a rethought version made completely from scratch, so everything has changed from class names to how the asset works, this new version is not backward compatible. So if you already have Azure integrated into a project under development you shouldn't upgrade. Version 6.0.2 is still there for everyone who wants to use it.
    Features Video:

    Tutorial Playlist:
     
    Last edited: Feb 11, 2021
    Squize, Monil and Quique-Martinez like this.
  11. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    I was using the old Output Profile system to get when day changed to night and night changed to day. Based on the docs, it looks like I now have to use AzureTimeController.GetTimeline(). But when exactly is the change from day to night and vice versa?

    I need to convert GetTimeline() to a 0-1 value, where 0 is moon at the center of the sky at night and 1 is sun at high noon.
     
    Last edited: Feb 11, 2021
  12. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    What's the proper way to update these in my custom script? I have another cloud asset I'm syncing Azure with.

    Code (CSharp):
    1.         if (SkyBlendType != BlendType.Disable)
    2.         {
    3.             if (AzureSkyController.currentProfile != SkyProfile && tSky > 0.001f)
    4.             {
    5.                 CurrentSkyBlend = Mathf.Lerp(0.001f, MaxSkyBlend, tSky);
    6.  
    7.                 AzureSkyController.targetProfile = SkyProfile;
    8.                 AzureSkyController.isGlobalWeatherChanging = true;
    9.  
    10.                 //BruteForce Begin
    11.                 AzureSkyController.globalWeatherTransitionTime = 1.0f;
    12.                 AzureSkyController.globalWeatherStartTransitionTime = Time.time - CurrentSkyBlend;
    13.                 //BruteForce End
    14.             }
    15.             else
    16.             {
    17.                 AzureSkyController.isGlobalWeatherChanging = false;
    18.                 AzureSkyController.globalWeatherTransitionProgress = 0.0f;
    19.                 AzureSkyController.globalWeatherStartTransitionTime = 0.0f;
    20.             }
    21.         }
     
    Last edited: Feb 11, 2021
  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    As informed in the post above, this is a new version of the Asset, from now on Azure starts the 7ª version cycle. This is a rethought version made completely from scratch, so everything has changed from class names to how things work, this new version is not backward compatible. I failed to not make this clearer in the update notes.

    So if you already have Azure integrated into a project under development you shouldn't upgrade. Version 6.0.2 is still there for everyone who wants to use it.

    Regarding the outputs feature, the new feature "Override Properties" has made it obsolete. This is the first release of the new version 7x cycle, so the new "Override Properties" system still has some details to be improved, but it replaces the old Outputs system.

    But if you still prefer to use the new version, to find out if it's daytime or nighttime, there's a much better way. You can use the GetSunElevation() method from the AzureTimeController component, this will return a float between -1.0 and 1.0.

    If the value is less than zero, then it is night.
    If the value is greater than zero, then it is day.
     
  14. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    If you need Azure for a test, I can send you a voucher, just let me know.
     
  15. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Thanks for the info. I am determined to convert to the new system though, and some of the data I need might even improve the new API.

    So my first question is, how can we dynamically change to a different weather profile in the new system? It seems like we have to register it based on index now, but is there a way to reference a weather profile that is not in weather controller's index, for something that is a one-off situation or unique area?

    I also noticed we can set a time of day using SetTimeline, but we cannot pause the timeline from advancing. There are instances where I want to keep the time of day system from changing. Is there a way we can have this functionality added to the new API like it was in the old API, or is there a new way you recommend doing this?
     
    Last edited: Feb 11, 2021
  16. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    One of the goals of the new version (7.0.0) was to make the system more modular. Now if you want, you can only use the time controller independently of the other components, for example, you can use the time controller to control the time of day, time events, sun, moon and directional light rotations of anyother sky system.

    The same goes for each of the other components, you can remove the sky and fog renderer component and still use the time controller and the weather controller to manage the climate of third party assets, control your own particle effects, sound effects, etc...

    You can even use only the AzureSkyRenderController component to render the sky/fog and control the day and night cycle using your own time of day solution. Azure is close to becoming completely modular.

    To achieve this, I had to move a lot of code around and change a lot of things and for that reason I ended up forgetting to rewrite some very useful methods. All of this as well as other features will be added again in the next updates of the 7x cycle.

    To change the weather profile dynamically, I think you are referring to the old SetNewDayProfile() method, yes this is one of the methods I forgot to rewrite.:oops::)

    Just add this to the "AzureWeatherController.cs" script. I just changed the name of the method to be the same as the one used to change the global weather, so what will set the behavior of each method is just the type of argument you use.
    • If you use SetNewWeatherProfile(int index), it will change the weather based on the index from the global weather list.
    • If you use SetNewWeatherProfile(AzureWeatherProfile profile), it will change the weather for that profile instantly without transition.
    • SetNewWeatherProfile(AzureWeatherProfile profile, float transitionTime), it will change the weather for that profile with a transition time.
    Code (CSharp):
    1. /// <summary>
    2. /// Changes the regular weather profile with transition.
    3. /// </summary>
    4. public void SetNewWeatherProfile(AzureWeatherProfile profile, float transitionTime)
    5. {
    6.     m_targetWeatherProfile = profile;
    7.     m_weatherTransitionLength = transitionTime;
    8.  
    9.     // Starts the global weather transition progress
    10.     m_weatherTransitionProgress = 0.0f;
    11.     m_weatherTransitionStart = Time.time;
    12.     m_isWeatherChanging = true;
    13. }
    14.  
    15. /// <summary>
    16. /// Changes the regular weather profile without transition.
    17. /// </summary>
    18. public void SetNewWeatherProfile(AzureWeatherProfile profile)
    19. {
    20.     m_currentWeatherProfile = profile;
    21. }
    Regarding the time of day, you can add these methods to the "AzureTimeController.cs" script.
    Code (CSharp):
    1.  
    2. /// <summary>
    3. /// Pause the time progression.
    4. /// </summary>
    5. public void PauseTime()
    6. {
    7.     m_timeProgressionStep = 0.0f;
    8. }
    9.  
    10. /// <summary>
    11. /// Starts the time progression again.
    12. /// </summary>
    13. public void PlayTimeAgain()
    14. {
    15.     m_timeProgressionStep = GetTimeProgressionStep();
    16. }
    17.  
    18. /// <summary>
    19. /// Set a new duration of the day cycle in minutes.
    20. /// </summary>
    21. public void SetNewDayLength(float value)
    22. {
    23.     m_dayLength = value;
    24.     m_timeProgressionStep = GetTimeProgressionStep();
    25. }
     
    Exeneva likes this.
  17. Deleted User

    Deleted User

    Guest

    Just upgraded to 7.0; seems to work pretty well. Even my Crest error seems to be gone !
    BUT ... static clouds are GONE now ?! Can't find the option back (nor the textures); pleas re-assure me that it's not gone; my whole style depended on it. Please please please !
     
  18. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Thanks for the code additions. Along the same vein, I noticed there is no Get method for retrieving the current weather profile. Can we add that too?

    Lastly, is there a way to change values of a profile at runtime?
     
    Last edited: Feb 11, 2021
  19. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    The Static clouds have been disabled indefinitely in the 7x version cycle because I'm still trying to find a way to integrate it with the new weather profile system and override properties feature. For now continue using the previous version cycle (6.0.2) until this feature is integrated again.


    You can add this to "AzureWeatherController.cs":
    Code (CSharp):
    1. /// <summary>
    2. /// Returns the current weather profile in use by the system.
    3. /// </summary>
    4. public AzureWeatherProfile GetCurrentWeatherProfile()
    5. {
    6.     return m_currentWeatherProfile;
    7. }
    8.  
    9. /// <summary>
    10. /// Returns the active weather profile from the Default Weather Profiles list.
    11. /// </summary>
    12. public AzureWeatherProfile GetDefaultWeatherProfile()
    13. {
    14.     return m_defaultWeatherProfile;
    15. }
    16.  
    17. /// <summary>
    18. /// Returns the target weather profile if there is a weather transition in play.
    19. /// </summary>
    20. public AzureWeatherProfile GetTargetWeatherProfile()
    21. {
    22.     if (m_isWeatherChanging)
    23.         return m_targetWeatherProfile;
    24.     else
    25.         return null;
    26. }
    To change the value of a profile at runtime I think it is currently not possible, but if you have defined the custom property type as "Slider" or "ColorField" you can access the profile property list and change the value directly.
    Just an example:
    Code (CSharp):
    1. public void SetUpWeatherProfile(AzureWeatherProfile profile, int index, float floatValue, Color colorValue)
    2. {
    3.     profile.profilePropertyList[index].slider = floatValue;
    4.     profile.profilePropertyList[index].colorField = colorValue;
    5. }
     
  20. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    In terms of the old version of Azure Sky Manager, is there any way to decrease the asset size for the PrecomputedInscatter.asset ? At the moment it's coming in at around 8.0mb and we're deploying to web so I want to squeeze it down if possible.
     
  21. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Hmm, I won't be able to fully convert until we can edit profile properties at runtime. I will be on the lookout for the next update to see if it has the functionality :)

    Thanks again for all the support!
     
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    There's nothing to do other than what you should be doing by default like reducing the maximum size of the textures and deleting all the assets that is not used.
     
  23. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    Can we specifically reduce the PrecomputedInscatter.asset though? And if so, how?

    Does reducing the size of all the sky, day, night textures reduce the size of the PrecomputedInscatter.asset?
     
  24. Deleted User

    Deleted User

    Guest

    Thanks i guess i have no other choice. I absolutely love Azure Sky, don't get me wrong but doing breaking changes and removing 'core' functionalities (and it seems from the previous posts it's not only me) was not a 'good' idea. Anyway, thanks for making this great asset, i will actively continue to work with it (and wait for my issues to resolve).
     
  25. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I'm sorry, I got your question wrong, you're talking about a single file and not the entire system, right?

    This specific file stores the data of the precomputed tables needed for the sky to be rendered, neither more nor less data, just what is necessary for rendering the sky, and therefore there is no way to reduce the size, otherwise this would break the system and the rendering would stop working.


    Thank you for understanding, but to take a step forward things like this are necessary. Take a look at the first pages of this forum and see how the asset was at the beginning, a lot of outdated features have been replaced by better ones.

    For each version cycle, I start developing the asset completely from scratch, each version cycle is a completely new asset with new features e new API, but instead of creating a new asset in the store and you have to pay again if you want to use the new version as the most other developers do, since 2014 I keep releasing each new version for free, maybe this will be the last one.

    I could keep this new version and release it for example just 6 months later or next year when all the features are in place. It would be much better for me, as I would have less headcache and less negative reviews with each new cycle start, but most users do not use static clouds and can use the new version starting from now while the rest of the features are being implemented in minor updates.

    Thanks again for your kindness, I hope to implement static clouds again with the new features as soon as possible.
     
  26. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    This is just a clarification question, in the Getting Started for 7.0 (probably in older ones too it just never registered) it mentions this as a step:

    -Disable the Anti-Aliasing on the project ‘Quality Settings’.

    I was wondering if you could elaborate on that one? Is it because it makes the fog have a higher quality if you don't have the quality settings AA, or does it a cause a performance issue? Similarly, what about FXAA, MSAA, or TemporalAA with regards to the fog? Speaking from built-in pipeline point of view.

    I don't have an issue with it if I need to disable it, just curious about it is all.
     
  27. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Good question.

    This is because of an almost imperceptible artifact generated at the edges between the terrain and the sky. I'm not sure if it will happen for everyone.
    FogArtefact.jpg

    There is a gray scale texture that stores the position of each pixel on the screen called "Depth Buffer" or "Depth Texture". Many post-processing effects use this texture to reconstruct the pixel's position from screen space to world space.

    What I understand is that Unity's internal AA is applied to the raw screen, before any other post-processing effect. The problem is that this AA is only applied to the screen output texture and the "Depth Texture" remains the same.

    So when the AA smooths the edges of the scene it moves a few pixels upwards, originally this pixels was located in a place on the screen that draws to the depth buffer texture and consequently is affected by the fog, but now this pixel with the terrain color information is located in a place on the screen that does not draw to the depth buffer texture (where originally there should only be the background sky) and is consequently ignored by the post processing effect, and this causes that artifact shown in the image above with some pixels at the edges of the terrain without receiving fog.

    So the recommendation is to use a post-processing AA, to smooth the screen only after all the other effects have already been rendered.
     
    Acissathar likes this.
  28. hdb0

    hdb0

    Joined:
    May 16, 2015
    Posts:
    6
    Thanks, we did some research into it on our side. Notes here: https://github.com/wave-harmonic/crest/issues/750

    It seems to be a general issue which would happen for anyone that calls camera.Render() in URP 10, which our depth cache does.

    In that issue my colleague linked to a forum post that mentions something similar, and he suggests a resolution - it should be fixed by not accessing cameraColorTarget from within AzureFogScatteringFeature.AddRenderPasses().
     
    DenisLemos likes this.
  29. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi again, thanks for the useful informations. Following your thread I figure out that starting from URP 10.1 the way to do Blit has changed, and here is an example made by Unity that they call (DrawFullscreenFeature) showing how to do it using the new API.

    More precisely, the cameraColorTarget must be accessed and set to the source RenderTargetIdentifier inside the OnCameraSetup() instead of AddRenderPasses().

    @onefoxstudio @Karearea
    I rewrote the AzureFogScatteringFeature.cs script based on the Unity example of the new API, anyone using URP 10 or higher should open the AzureFogScatteringFeature.cs script and replace all the code with the code below. I think this is the right way to do this for URP 10 and later, so probably any issue with Crest should be solved now.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering;
    3. using UnityEngine.Rendering.Universal;
    4.  
    5. public class AzureFogScatteringFeature : ScriptableRendererFeature
    6. {
    7.     public Material blitMaterial = null;
    8.     public RenderPassEvent renderPassEvent = RenderPassEvent.BeforeRenderingSkybox;
    9.     private AzureFogScatteringPass m_azureFogScatteringPass;
    10.  
    11.     public override void Create()
    12.     {
    13.         m_azureFogScatteringPass = new AzureFogScatteringPass(name);
    14.         m_azureFogScatteringPass.blitMaterial = blitMaterial;
    15.     }
    16.  
    17.     public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    18.     {
    19.         if (blitMaterial == null)
    20.         {
    21.             Debug.LogWarningFormat("Missing Blit Material. {0} blit pass will not execute. Check for missing reference in the assigned renderer.", GetType().Name);
    22.             return;
    23.         }
    24.  
    25.         m_azureFogScatteringPass.renderPassEvent = renderPassEvent;
    26.         renderer.EnqueuePass(m_azureFogScatteringPass);
    27.     }
    28.  
    29.     private class AzureFogScatteringPass : ScriptableRenderPass
    30.     {
    31.         public Material blitMaterial = null;
    32.         public FilterMode filterMode { get; set; }
    33.         RenderTargetIdentifier source;
    34.         RenderTargetIdentifier destination;
    35.         int temporaryRTId = Shader.PropertyToID("_TempRT");
    36.         int sourceId;
    37.         int destinationId;
    38.         string m_ProfilerTag;
    39.  
    40.         private Camera m_camera;
    41.         private Vector3[] m_frustumCorners = new Vector3[4];
    42.         private Transform m_cameraTransform = null;
    43.         private Rect m_rect = new Rect(0, 0, 1, 1);
    44.         private Matrix4x4 m_frustumCornersArray;
    45.  
    46.         public AzureFogScatteringPass(string tag)
    47.         {
    48.             m_ProfilerTag = tag;
    49.         }
    50.  
    51.         public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
    52.         {
    53.             RenderTextureDescriptor blitTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
    54.             blitTargetDescriptor.depthBufferBits = 0;
    55.             var renderer = renderingData.cameraData.renderer;
    56.  
    57.             sourceId = -1;
    58.             source = renderer.cameraColorTarget;
    59.             destinationId = temporaryRTId;
    60.             cmd.GetTemporaryRT(destinationId, blitTargetDescriptor, filterMode);
    61.             destination = new RenderTargetIdentifier(destinationId);
    62.         }
    63.  
    64.         /// <inheritdoc/>
    65.         public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    66.         {
    67.             CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag);
    68.  
    69.             m_camera = renderingData.cameraData.camera;
    70.             m_cameraTransform = m_camera.transform;
    71.  
    72.             m_camera.CalculateFrustumCorners(m_rect, m_camera.farClipPlane, m_camera.stereoActiveEye, m_frustumCorners);
    73.             m_frustumCornersArray = Matrix4x4.identity;
    74.             m_frustumCornersArray.SetRow(0, m_cameraTransform.TransformVector(m_frustumCorners[0]));  // bottom left
    75.             m_frustumCornersArray.SetRow(2, m_cameraTransform.TransformVector(m_frustumCorners[1]));  // top left
    76.             m_frustumCornersArray.SetRow(3, m_cameraTransform.TransformVector(m_frustumCorners[2]));  // top right
    77.             m_frustumCornersArray.SetRow(1, m_cameraTransform.TransformVector(m_frustumCorners[3]));  // bottom right
    78.             blitMaterial.SetMatrix("_FrustumCorners", m_frustumCornersArray);
    79.  
    80.             Blit(cmd, source, destination, blitMaterial, -1);
    81.             Blit(cmd, destination, source);
    82.  
    83.             context.ExecuteCommandBuffer(cmd);
    84.             CommandBufferPool.Release(cmd);
    85.         }
    86.  
    87.         /// <inheritdoc/>
    88.         public override void FrameCleanup(CommandBuffer cmd)
    89.         {
    90.             if (destinationId != -1)
    91.                 cmd.ReleaseTemporaryRT(destinationId);
    92.  
    93.             if (source == destination && sourceId != -1)
    94.                 cmd.ReleaseTemporaryRT(sourceId);
    95.         }
    96.     }
    97. }
    In the next minor update I will add an exclusive replacement package for URP 10 because the URP 10 API is not compatible with older versions of URP. Then the user will only need to import the replacement files for the URP he is using.

    For Developers: I'll keep the code public here for anyone to use, the script above already calculates the camera frustum corners and sends it to the blitMaterial in use, so just access the "_FrustumCorners" matrix in the shader to reconstruct the world position from screen space as it was done in the GlobalFog.shader from the old Unity standard assets. This is useful for anyone trying to reproduce post-processing effects similar to or equal to the old Global Fog from Unity 5.
     
    Deleted User likes this.
  30. Deleted User

    Deleted User

    Guest

    Thank you so much Denis for fixing this very annoying warning; I confirm it works fine now. You just need to add back the static clouds in v7 and i'll do the upgrade :)) Thank you again !
     
  31. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Azure[Sky] Dynamic Skybox v6.0.3 Released!
    Azure[Sky] Dynamic Skybox v7.0.1 Released!


    Double update!

    The 6x and 7x version cycle have been updated to prevent the URP issue discussed above, now the asset comes with 2 replacement packages to add URP support, one for URP versions below 10.1 and one for higher and new URP versions .

    So, if new versions of URP come with new API or broken resources, I will only need to add a new replacement package for that specific version of URP, that way it is possible to reduce the number of versions of the asset and the user does not have to redownload Azure all the time to use in different versions of URP, so the user only need to import Azure into the project and then import the replacement package for the version of URP in use.

    v7.0.1 (Requires Unity 2019.4.8f1 or higher)
    • New asset made completely from scratch. Note: It is not backward compatible with the previous 6x version cycle.
    • New Time Controller System.
    • New Weather Controller System.
    • New Override Properties System.
    • New Inspector.
    • Bug fixes.
    • Added static clouds again to the new 7x version cycle. "The down side is that currently it is not possible to make the static cloud blend and change to another texture using the new profile system".
    • Added a different replacement.unitypackage for each significant URP version, so it is possible to keep the asset updated without having to release a new package update for each new version of Unity/URP.
    • Added methods that were missing from the old 6x version cycle API.
    • Added the GetOverrideFloatOutput() method to the AzureWeatherController.cs script.
    • Added the GetOverrideColorOutput() method to the AzureWeatherController.cs script.

    v6.0.3 (Requires Unity 2019.3.0f1 or higher)

    • Added a different replacement.unitypackage for each significant URP version, so it is possible to keep the asset updated without having to release a new package update for each new version of Unity/URP.
    • Bug fixes.
    • Added in the "Options" tab of the "Azure Sky Controller" component the option to update the shaders locally on each material. This is useful if you want to use a different sky for different views.

    For older users: Recalling that the 7x version cycle is completely new and is not backward compatible with the 6x version cycle, if you already use the 6x version cycle in your project, it is not recommended to upgrade. Use the new version 7x cycle only if you are starting a new project or if you like the new version. If you don't like any features of the new version, you are not forced to update, just keep using the 6x version cycle which will continue receinving updates as usual, do not be a 'pampered child' who does not like some new feature and rush to write a negative review without first testing the new features for more than a few minutes or before asking for support, it drastically damages the tool you use.

    Asset Store Link: https://assetstore.unity.com/packages/tools/particles-effects/azure-sky-dynamic-skybox-36050
     
    Deleted User likes this.
  32. Deleted User

    Deleted User

    Guest

    Wow you're like a coding machine ! Thank you so much ! I will give it a try.
    One stupid question though, what if i need to download the 6.x version ? From 2020.2 it's not possible to get older releases with the stupid Package Manager; can only see 7.0.1 ... any idea ? Or possible DM with download link ?
    (With invoice # check)

    Thanks !
     
  33. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    You need to manually delete the package from your system.

    macOS: ~/Library/Unity/Asset\ Store/
    Windows: C:\Users\UserName\AppData\Roaming\Unity\Asset Store-5.x


    And download it again using the right Unity version.

    On Windows the 'AppData' folder is hidden by default.
    • Navigate to C:\Users\ 'Your Account Name'
    • Open the 'View' menu
    • Select 'Hidden Items'
    • The 'AppData' folder will now be accessible

    If you re-download using the right version of Unity, the Package Manager will still show it as version 7.0.1, but it will download the version 6.0.3.
     
    Deleted User likes this.
  34. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Just curious, does the new update allow overriding / editing profiles at runtime? Just waiting on this to be added and I will try the update to the new system once again ^_^

    It's not an urgent priority though.
     
  35. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    No changes were made to this feature, in fact the only change in profiles compared to the 6x version cycle, is that now you set the property type in the "Override Object" instead of doing this in each property of each profile.

    Could you tell me why you need to override the profiles at runtime instead of using an already customized profile?

    And how are you doing this using the 6x version cycle? I am asking this because both the 6x and 7x versions were not developed with that purpose in mind.
     
  36. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    so there is no different with graphic from old and new version right?
     
  37. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    Yes, the graphics are the same in both versions. The changes in the 7x version cycle were in the scripting side and in the way the system works.
     
  38. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    Hey Denis,i Just buy this asset,its shows amazing effect,and work fine with my project!

    here is a problem,i found there is no API offered to stop the time so that i cannot work with my own time system.
    although i can change the sources code to stop the time update and settime by my system,but hope can fully work without the time controller.
    sry for my English.
    thanks again~
     
  39. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    In version 7x you can use the "PauseTime()" and "PlayTimeAgain()" methods from "AzureTimeController" component. Or you can just set on the Inspector the "Day Length" to zero, this will make the time of day remain static, so you can control the timeline using the "SetTimeline(float value)" method.

    You can completely remove the time controller and use your own time of day control system. But you will need to manually set the private fields "m_timeOfDay", "m_sunElevation" and "m_moonElevation" of the "AzureWeatherController" component, these properties are used to evaluate the weather profiles and by default these values are automatically set from the AzureTimeController component, so if you remove the Azure time controller, you’ll need to take care of that.

    That's why I'm changing the Azure API in the 7x version cycle, to make Azure completely modular, so you can choose which component you want to use or not, for example, you can use your own time of day and sky/cloud rendering system, and use only the "AzureWeatherController" component to control the weather. With the 6x version cycle this is not possible.

    But Azure's modularity isn't quite ready yet, so you may need to make a few minor adjustments to the code to work according to your needs.
     
  40. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Long story short, I was not a fan of not being able to change clouds in Azure, and I liked the clouds Massive Clouds Atmos provides, so my atmosphere is a combination of both. I actually got things mixed up - it looks like I don't actually need to edit the Azure profile at runtime, just be able to force a profile change and give it a custom enter / exit time. It's the Massive Clouds part that has runtime profile changes for certain parts of my environment.

    For example, I have a foggy forest, and the transition is done by switching to the Fogness Azure profile (with a custom enter/exit time) but the Massive Clouds profile stays the same and just changes the fog settings.



    Pardon the terrible FPS, parts of the environment are not optimized yet.

    The script that drives this transition:

    upload_2021-2-23_19-59-28.png

    So to reiterate, I mixed things up. I don't need to change an Azure profile at runtime, just need to be able to force a transition to a new profile but give a custom enter and exit time.
     
  41. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    happy to hear that, i will waiting for your new job ,thanks again and best wishes to you
     
  42. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    hi Denis,Please let me know which is the correct lighting setting for azure?
    should I set environment lighting to color or skybox or other?and do i nee to set sun source ?
    sorry for asking the stupid questions,because cannot watch youtube in my country.
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    If that's all you need to achieve, then I see no reason why you shouldn't use the 7x version.

    There are two ways to do this:
    • Use the local weather zone feature.

    • Or change the weather by code in the same way you are doing it now, just use the "SetNewWeatherProfile(AzureWeatherProfile profile, float transitionTime)" method of the AzureWeatherController component. As you can see, with this method it is possible to change the weather for any profile you want and also set a custom transition time. So just call this method when entering or leaving the forest.


    Use what you think is better for your project. You can open the Azure demo scene called "GI" for testing, just press play on the scene and switch the "Environment Source" between "Skybox" and "Color" to see the difference.

    Using the "Skybox" mode, Unity automatically generates lighting according to the colors of the sky. Using the "Color" mode, you can better style the lighting.


    The "Sun Source" is used only to indicate the direction of the sun if you are using Unity's procedural skybox. With Azure it makes no difference to use it or not.

    From Unity Documentation: Sun Source: When the Skybox Material is a Procedural Skybox, use this setting to specifya GameObject with a directional Light component to indicate the direction of the sun (or whatever large, distant light source is illuminating your Scene). If this is set to None, the brightest directional light in the Scene is assumed to represent the sun. Lights with Render Mode property set to Not Important do not affect the Skybox. The default value is None.
     
  44. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    thanks for that~
     
  45. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    What causes this line in the distance? I keep playing with the settings, even changing the render feature order and it's still there. Unity 2020.2.6f1, URP 10+

    upload_2021-2-26_1-26-6.png
     
    Last edited: Feb 26, 2021
  46. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I'm sorry, I don't see anything wrong with your screenshot.

    Are you talking about the horizon line where the ocean ends? What is the result you want to achieve? Do you want the fog to completely cover the ocean line?

    It seems to me that the cloud system you are using is affecting the color of the sky near the horizon line by applying a different color than that generated by the fog. By default the fog blends with the sky perfectly because the same atmospheric scattering calculations are used for the sky shader and for the fog shader, if the skybox gets a different color, the color blend between fog and the sky background will no longer match.

    Another possibility, it may be that your ocean is not perfectly infinite, the impression I have is that the ocean mesh is ending before the "true" horizon line, I'm not sure, it's just the impression that I had. I don't think this is related to URP.

    Here are some screenshots using the GitHub version of Crest Ocean System that generates an infinite ocean mesh. As you can see the fog at the horizon blends perfectly with the sky background.
    Screenshot1.jpg Screenshot2.jpg
     
  47. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Is there a way to do a partial transition or blend to a target profile? This is what I was doing with the old system:

    Code (CSharp):
    1. if (AzureWeatherController.GetCurrentWeatherProfile() != targetWeatherProfile && tSky > 0.001f)
    2. {
    3.     CurrentSkyBlend = Mathf.Lerp(0.001f, MaxSkyBlend, tSky);
    4.  
    5.     AzureSkyController.targetProfile = SkyProfile;
    6.     AzureSkyController.isGlobalWeatherChanging = true;
    7.  
    8.     //BruteForce Begin
    9.     AzureSkyController.globalWeatherTransitionTime = 1.0f;
    10.     AzureSkyController.globalWeatherStartTransitionTime = Time.time - CurrentSkyBlend;
    11.     //BruteForce End
    12. }
    I remember the reason I can't just switch to a new weather profile is because it would be weird if it was raining before you entered the forest, but then it suddenly stopped raining after you entered the forest. What I did in the old system was blend between two profiles. Is this possible in the new system? Do we have equivalents for globalWeatherTransitionTime and globalWeatherStartTransitionTime?
     
  48. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    I'm running the same setup, and had the same issue with Crest URP initially. I can't remember how I fixed it as it was late.. I do recall tweaking scattering settings on the AzureSkyRenderController and the issue resolved itself, it definitely wasn't within the weather profile per se.
     
    DenisLemos likes this.
  49. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I think you are complicating something that could be done in a simpler way.

    I would do it differently, before entering the forest I would first check what the current weather is, then I would change the profile to a variant of that weather previously modified to be used in the forest.

    First, you’ll need to know what the current weather is, so you need to add this custom method to the "AzureWeatherController" script.
    Code (CSharp):
    1. /// <summary>
    2. /// Returns the index of the current weather profile in use from the global weather list.
    3. /// </summary>
    4. public int GetGlobalWeatherIndex()
    5. {
    6.     return m_weatherIndex;
    7. }
    Now the logic:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class ForestExample : MonoBehaviour
    5. {
    6.     public AzureWeatherController weatherController;
    7.     public AzureWeatherProfile defaultForestProfile;
    8.  
    9.     // Add here the forest profiles variants at the same order as the global weather list
    10.     public AzureWeatherProfile[] forestWeatherVariants;
    11.  
    12.     private int m_weatherindex = -1;
    13.     private float m_transitionTime = 10f; // 10 seconds
    14.  
    15.     // Your forest enter event
    16.     private void OnForestEnter()
    17.     {
    18.         if (m_weatherindex >= 0)
    19.         {
    20.             // Go to the variant forest profile
    21.             m_weatherindex = weatherController.GetGlobalWeatherIndex();
    22.             weatherController.SetNewWeatherProfile(forestWeatherVariants[m_weatherindex], m_transitionTime);
    23.         }
    24.         else
    25.             weatherController.SetNewWeatherProfile(defaultForestProfile, m_transitionTime);
    26.     }
    27.  
    28.     // Your forest exit event
    29.     private void OnForestExit()
    30.     {
    31.         // Back to the original weather profile of the global weather list
    32.         // If the m_weatherindex is -1 it will back to the default weather profile
    33.         weatherController.SetNewWeatherProfile(m_weatherindex);
    34.     }
    35. }
     
    Exeneva likes this.
  50. Deleted User

    Deleted User

    Guest

    One thing i noticed is the huge amount of GC the WeatherController.FixedUpdate is doing
    Any idea on how to improve this ?

    upload_2021-3-1_14-37-30.png