Search Unity

Graphics Azure[Sky] - Dynamic Skybox

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

  1. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    I've been looking into the outputs but I'm a bit of a noob so I could use some help here.

    I have a heightfog camera effect that I want to sync with the time of day in Azure. The camera effect uses 0 for night, 1 for day, and it transitions between the two. I want to sync this with the time of day transition in Azure. How might I convert the time of day into an output between 0 and 1?
     
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Azure comes with a default lighting setting and it is likely that this setting will be different from the one you are using when you add the Azure prefab to the scene, there is no way I can guess the setting that each user wants. So when you drag the Azure prefab into your scene, it's obvious that you'll need to adjust the Azure's lighting settings.

    You control the lighting settings of the scene using Azure through the "Lighting" tab of each day profile, if you set there the same configuration you used before adding Azure, everything will look the same as before.

    I will repeat what I wrote in the last answer: If you spend a few minutes playing with all the customization parameters available in the profiles, you will figure out what each one is for and which you need to modify on certain occasions. Simple things like this you should be able to solve on your own if you just try to play around with the parameters to find out how the asset works.

    Please stop flooding the forum and add images directly to the forum without external links, my anti virus application for some reason is identifying some of your links as malicious, otherwise your posts will be completely ignored.


    Hi, just create an output profile: Create> Azure [Sky] Dynamic Skybox> New Output Profile and add to it a property/output of "Timeline Curve" or "Slider" type, this will return a float between 0-1.

    The sky system need to know that this output profile exists, so you need to attach this output profile to the "Azure Sky Controller" component and also to each day profile you use. The new property will be avaliable for customization on the "Output" tab of each day profile using that output profile. If you set the output to Timeline Curve type, just customize the curve with a value of 0 at night and a value of 1 at daytime.

    You need a simple script to get the output value from the sky controller and send it to the property you want to control.
    Code (CSharp):
    1. usingUnityEngine;
    2. usingUnityEngine.AzureSky;
    3.  
    4. public class AzureOutputExample : MonoBehaviour
    5. {
    6.     public AzureSkyController azureSky;
    7.  
    8.     private void Update()
    9.     {
    10.         // Get the value of the first output from the output list
    11.         myHeightFogValue = azureSky.GetOutputFloatValue(0);
    12.     }
    13. }
    See the documentation and example scene for more details.
     
    Exeneva likes this.
  3. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
  4. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
  5. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    If I want to set the Azure time of day upon entering a box collider trigger and then stop the flow of time while inside the box collider, how might I do that?
     
  6. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    You will need to add this 2 methods to the "AzureTimeController.cs" script:
    Code (CSharp):
    1. /// <summary>
    2. /// Pause the time progression.
    3. /// </summary>
    4. public void PauseTime()
    5. {
    6.     m_timeProgressionStep = 0.0f;
    7. }
    8.  
    9. /// <summary>
    10. /// Starts the time progression again.
    11. /// </summary>
    12. public void PlayTimeAgain()
    13. {
    14.     m_timeProgressionStep = GetTimeProgressionStep();
    15. }
    Call one of the methods above whenever you want to pause or restart the day's progress. You can call PauseTime() inside the OnTriggerEnter() to pause the time progression and call the PlayTimeAgain() inside the OnTriggerExit() to start the time progression again.

    The GetTimeProgressionStep() method uses the "Day Length" to cauculate the time progression step, so the PlayTimeAgain() will only work if on the Inspector of the "AzureTimeController" component the "Day Length" property is set to a value other than zero.

    To set the time of day, you just need to access the "AzureTimeController" component and set the public var "timeline" to the value you want.
    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.     private void OnTriggerEnter(Collider other)
    9.     {
    10.         timeController.timeline = 12.0f;
    11.         timeController.PauseTime();
    12.     }
    13.  
    14.     private void OnTriggerExit(Collider other)
    15.     {
    16.         timeController.PlayTimeAgain();
    17.     }
    18. }
    The script above is just a demonstration, you have to elaborate it better so that the code is executed only when the game object enters the right collider.
     
    Last edited: Sep 15, 2020
    Exeneva likes this.
  7. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158
    Having some serious trobule getting this to work with lighting. I can't seem to have ANY lights in the scene, or bake it at all. Which is...kind of okay during the day, but at night obviously i...need lights.

    Adding point lights of any kind increase the tris count to like 20 million, since they cant be baked, so its really kind of unuseable. Is there a fix for this? I just need light...
     
  8. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,
    Do you think I would keep a day/night cycle asset in the store for more than 5 years with a serious problem like that?

    I can assure you that the lighting works at night. Below is a screenshot showing the lighting set by Azure at night, you can test the same scene as it is included in the package.
    Screenshot.jpg

    If you look inside the Azure prefab, you will see a directional light, this directional light is responsible for making the illumination coming from the sun and moon, it automatically switches to sun or moon depending on which one is visible in the sky.

    If you can't see the lighting at night, the only causes I can imagine now are:
    • You are using the realistic time system with a date and location that has no moon in the sky at night. As we all know, in certain periods of the month the moon is visible only at the daytime, not every night the moon will be visible in the sky. Consequently, if there is no moon in the sky at night, the scene will not receive any natural lighting.

    • The directional light intensity setting is too low at night. To solve this you need to select the day profile currently in use and increase the night time value of the curve that controls the intensity of directional light in the "Lighting" tab of the profile. I don't think that's the problem because by default the directional light intensity setting at night is the same as you see in the screenshot above.

    • It doesn’t make much sense to use a day and night system and bake the lighting, there’s a good chance that this is the problem because if you want the lighting to be controlled by Azure, it must be in real time.
     
  9. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158

    Hey! Sorry i meant for smaller areas. The global directional light works fine, but for areas like a village or an interior, I would need to bake the lightmaps on those areas.

    I seemingly can solve it by removing the sky prefab, baking, then adding it back in, but im wondering if theres a better way?

    EDIT: Looks like I can bake those areas, then reable the point lights, set to realtime, and set them to only effect the player or NPC layers!
     
    Last edited: Sep 16, 2020
  10. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    So we are in the same boat because I am also looking for a good solution to this problem in my game. This is not a limitation of Azure or any other asset like this, I think this issue should be overcome by the game design.

    Using a day and night system with baked light is not a solution, you can use a lightmap and real time lighting at the same time to gain performance, but this is useful only for specific cases. Example, you can bake the scene light and use real-time lighting only for dynamic objects such as player or animated objects, this will save performance because Unity will calculate the shadows in real time only for these dynamic objects. Here an excellent video tutorial on this topic. But using this technique in a game with a day and night system will not work because the instant you change the time of day, the baked lighting will not change making the lighting of the scene a big crap.

    As we are talking about a game with dynamic time of day, I would use lightmap only for indoor scenes where it is not possible to see the environment or the change of the time of day outside as in caves and taverns.

    In my game I will use Azure and I intend to do the lighting completely in real time because the time of day will be dynamic. I am planning things as follows:

    The game will run on a completely empty main scene, this scene will only contain lighting controllers (Azure), audio controllers, game controllers, player and camera as well as essential things needed to keep the game running. All other things like islands, small villages, etc... will be stored in sub scenes and will be loaded into the main scene only when the player is close to the location, as the player moves away from the location that sub scene will be unloaded to free up memory and improve the performance.

    You can even store the interiors of buildings as a sub scene to use only when necessary without wasting performance when the player is away from the building.
     
  11. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158


    Thats exactly what i had in mind! Currently setting up building prefabs to accept lightmaps on walls and floors, and all small pieces use light probes. So in theory, when i bake, the interiors of buildings should have lightmaps for nightime, or indoors.

    The outside terrain is on its own layer as well, so really the directional light in the Azure prefab should handle realtime shadows and lighting on everything outside, and the point lights only bake the interior walls, etc.
     
  12. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158
    Also I'd love to know your scene setup. I have World Streamer but have hesitated to use it. Currently im just loading the player into different instances per-Scene, and transferring inventory, saved data, etc
     
  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    I don't have a scene set up to show you, because I'm still doing the GDD and developing the tools that I will use, I will start the project only when everything is well planned to avoid problems resulting from a bad game design.

    The game will be a "mini" open world and the player will be able to walk anywhere on the map and enter any building, cave etc... That way it will not be necessary to use an instance of the player for each sub scene because all places will be easily accessible and the sub scenes will be loaded and unloaded as the player moves around the map. I still don't quite know how I'm going to get around the limitation that prevents references across sub scenes, maybe scriptable objects will do the trick.
     
  14. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158
    Hey! So I'm using Dialogue Systems from pixel crushers to send data to instances of my player in different scenes,

    However based on what youre describing, have you looked into Additive scene loading? This is stuff ive been putting off experimenting with, but ive seen some really good results with it. Same with World Streamer, again i havent dived into it too much but it does what you're describing!

    I also tested Planet-scale stuff with floating point origin, but found that a little too much for what im doing.


    Also i've successfully got the baked lighting working with Azure! I just used walls and floors that have LOD groups, and the closest LOD gets baked GI from lightmaps, using the point lights for interior, and exterior. and the last few LOD groups get GI from light probes

    I used the GPU Progressive and Shadowmask option, and that gave me lightmaps on the buildings for the close LOD, and didnt really interfere with the daytime Directional light in the Azure prefab.

    Then i just set those same lights to realtime, and culling layer to the Player, and voila! 15 to 120 fps

    Still probably a better way to optimize that, but if you need a quick bake that seem to work!
     
    DenisLemos likes this.
  15. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    @TaylorCaudle
    I'm glad you managed to make it work, thanks for sharing the solution here on the forum, this will be useful for other users.
     
  16. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Working in progress...

    Realistic Celestial Position of the Planets

    I haven't been here for a while, but the work is still behind the scenes. I am working on the development of Pixel Painter, the next version of Azure and also planning new features for 3D Tilemap System.

    For the next version of Azure, each component will work as an independent system, for example, the time controller will be responsible for managing everything related to time, date, sun and moon rotations and events (the current event system will be integrated to the time controller system). That way the user will have the choice to use only the components that are needed and remove the others to save performance or even use only one component for a given task.

    The time controller will also come with a new feature that calculates the realistic celestial position of the planets in the sky from Earth's perspective based on time, date and location. Below is a comparison between the result achieved with Azure and that shown on the Solar System Scope website using the same time and location.
    CelestialCoordinates1.png CelestialCoordinates2.png
     
    Last edited: Oct 13, 2020
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Working in progress...

    Override Properties

    As mentioned in the previous post, each component of the new version of Azure is being developed to work as a independent system and the new Weather Controller component could not be different, but this is not the big news.

    The way in which day profiles currently work in Azure will change completely and the current "Output System" will be removed, in fact it will not be removed but improved to another level because the whole day profile is going to be a kind of improved Output System.

    The current "Day Profiles" is going to be called "Weather Profiles" because it is more intuitive to understand. By default the weather profiles will be completely empty, that's right, there will be no properties to customize because it will be the user who will determine what he wants to customize and how to customize. In other words, you will be able to add custom properties to the weather profiles and use them to control anything in the scene without using code.

    You start by creating an "Override Object", where you will find a list to add or remove as many custom properties as you want.
    OverrideObject.jpg
    For each custom property you should set:
    • Output Type: The outrput type returned by that custom property. For while it supports "Float" and "Color".
    • Customization Mode: The way you want to customize the custom property on each weather profile: Slider, Curve, Color or Gradient.
    • Property Name: A custom name to help you remember why that custom property is used.
    • Description Area: A place to write a description about that property, it helps you remember what you are using the property for. The description will also be used later in the weather profile Inspector as a tooltip.
    After that, just create a "Weather Profile" and attach the override object to it and the custom properties will be shown automatically to be customized the way you chose previously.
    WeatherProfile.jpg

    Now in the "Override Property List" of the "Azure Weather Controller" component, you set the target properties that should be overwritten by the outputs resulting from the weather profiles.
    WeatherController.jpg
    • Target Type: If the property you want to override is a "Field", "Property" or "Shader Property".
    • Game Object/Material: The game object from the scene or material with the property you want to override.
    • Component Name: If the target is a game object, you just need to write the component name containing the target property you want to override.
    • Property Name: The name of the target property you want to override.
    • Multiplier: The multiplier you want to apply to the output before sending it to the target property.
    The "Azure Weather Controller" will perform all the weather profile blend transitions (Global Weather, Local Weather Zones, etc...), take the resulting value from each custom property and send it to the target property by overwriting its value, all automatically without you having to use any code.

    As you can see from the "Rain Intensity" custom property, you can use the same output to override more than one target property. In this demonstration case, the resulting output from the "Rain Intensity" custom property is being used to control the amount of rain particles and also the wetness on the terrain shader.

    All the properties of the sky system will be prepared to use this new method and the user will choose which property he wants to integrate with the weather system, in this way the performance can be improved because the weather controller will perform the blend transitions only for properties embedded with the weather profiles, different from the current version where all properties from the day profiles are computed by the weather transitions even if not used.

    Thanks for reading this far, let me know if you have any questions!
     
  18. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    This sounds awesome, @DenisLemos ! Is there an ETA on when we can try the beta? I can stress test it in my extensive environment I've been working on:



    My goal is to create a foggy forest, which means I need to be able to transition the sky to a foggy sky regardless of time of day, something like this:


    Will this type of transition be possible with the new system? I'm currently using a fog camera effect to simulate when you're inside the forest, but the transition is nonexistent right now.
     
    Last edited: Oct 14, 2020
  19. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    I don't have any ETA yet, but I believe it will take a while to be released because there is no way to know the time it takes to develop a new feature and also for this update I want to make tutorial videos detailing each feature.


    In the current version there is already a feature to perform this type of transition called "Local Weather Zones", you can test the standalone demo "Tropical Forest + Global Weather + Weather Zones" available for download in the asset description on the Asset Store page.
     
  20. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158
    Can confirm, i have a bunch of weather zones. You just increase the blend value and it smoothly transitions! Couldnt be happier with this Asset, makes every scene so much better.
     
  21. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158
    One question I had, is it possible in the current version to have the time of day stay consistent across scenes? I think I could manually set it up, was just wondering if theres a specific way i missed.
     
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    There is no such feature in Azure because this is a level designer issue for each game.

    To synchronize the time of day from one scene to another, you must do the same as you would for any other type of data. The solution I would use in my games would be to use scriptable objects to store the data from the current scene and read it at the start of the next scene.

    I've already answered a similar question before, take a look at the post number #1077 for more information. But note that the names of some Azure classes have changed such as "AzureSkyManager" has changed to "AzureSkyController". And some systems that were within the "AzureSkyManager" class are now in separate new classes such as "AzureTimeController" and "AzureProfileController".
     
  23. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    158

    Yeah thats what I''d already started working on. Thanks! Basically just an internal clock on the player.
     
  24. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Hi there,

    as per this thread it looks like the renderer feature system went through an undocumented change. I've managed to get the AzureFogScatteringFeature working in URP 10.1.0, although I'm not sure if this would be backwards compatible.

    Within the AzureFogScatteringPass, I've added this
    Code (CSharp):
    1.         public void Setup(RenderTargetIdentifier source, RenderTargetHandle destination)
    2.         {
    3.             m_source = source;
    4.             m_destination = destination;
    5.         }
    6.  
    7.         public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
    8.         {
    9.             var renderer = renderingData.cameraData.renderer;
    10.  
    11.             var src = renderer.cameraColorTarget;
    12.             var dest = RenderTargetHandle.CameraTarget;
    13.  
    14.             Setup(src, dest);
    15.         }
    And then shortened the AddRenderPasses like so
    Code (CSharp):
    1.     public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    2.     {
    3.         if (blitMaterial == null) return;
    4.         renderer.EnqueuePass(m_fogScatteringPass);
    5.     }
     
    DenisLemos likes this.
  25. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Thanks for the information, this will be very useful in the future. Unfortunately these changes are not compatible with the current version of URP. But that won't be a problem because when the new URP version is available I can simply add an extra replacement package for the new version just as it is for the current version.

    Then the user only imports the replacement package for the URP version he wants to use.

    Thank you!
     
    Karearea likes this.
  26. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Some time ago @DenisLemos gave me a "trimmed" version of Azure to be able to modify it for HDRP and to be able to use the native Unity volumes, (types of skies, fog, etc).

    Currently this version of Azure has control over the most relevant parameters that were needed to create a cycle that is as realistic as possible in lighting:

    - DirectionalLights parameters such as intensity in lux, color and temperature

    - All parameters of Unity's HDRP fog

    - The "Exposure" parameter of the HDRI sky type, to be able to control its intensity

    - Various parameters of (Aerosols, Artistic Overrides and Miscellaneus) of the "Physically Based Sky"

    - Parameters for PostProcessing "Exposure" and "IndirectLighting"

    You can add any parameter in the Azure Profiles if you want.

    Although the compression of YouTube has made the video lose quality, I leave here a small video of how the progress is going.
    I'm looking forward to seeing the new system for Azure that Denis is working on, since from the explanation she gave, it seems that it can be very versatile to be used with HDRP without the need to make almost any modifications, (except that

    The day / night cycle seen in the video is made with the HDRI sky type.


    Cheers
     
    Bartolomeus755 and DenisLemos like this.
  27. jso1980

    jso1980

    Joined:
    Nov 11, 2019
    Posts:
    13
    Hello, just trying the sky at the moment..
    the fog and lighting is working but not sure how to get rain to show?

    Also the rams water is coming up as black and not supported yet?
     
  28. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,
    Try to attach your main camera to the "Follow Target" field in the "Particles" tab of the "AzureEffectsController" component. This will make the particle emitter follow the camera.

    I didn't understand this question very well, did you mean the color of the rain is black? I'm using Unity 2019.4.8f1 and the rain and the other particle effects are working smoothly.
    Rain.jpg
     
  29. Deleted User

    Deleted User

    Guest

    Hi, just bought the asset; already having very much fun with it ... however in 2020.1 it seems that there's a weird bug going in/out from playmode; sometimes i end up having complete dark sky (so, empty basicaly) - but moving out the mouse shows it back ... it's kinda weird; i'm wondering if i'm the one with this bug (btw i'm on Mac) thanks !
     
  30. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    This can be an update issue, when you exit playmode the sky shader properties are reset. Editor scripts only execute the "Update()" in edit mode when the editor is refreshed, to save performance Unity only refreshes the editor when there is some user action or the lighting needs to be reculculated. Consequently, Azure will only be able to update the sky material when the editor is refreshed.

    This is something that should not cause any problems to the game once built.
     
    Deleted User likes this.
  31. Deleted User

    Deleted User

    Guest

    Thank you @DenisLemos for your reply; just wanted to make sure.

    I went ahead and switched to URP; light & skybox seems to work just fine but with the fog scattering i have this 'ghost'ish issue ... it's fine in the editor but not in game view.

    What am i missing here ?

    Thank you !

    URP 8.2.0 Unity 2020.1.10f1 MacOs Metal

    Capture d’écran 2020-11-23 à 10.21.41.png

    Capture d’écran 2020-11-23 à 10.21.53.png Capture d’écran 2020-11-23 à 10.24.20.png Capture d’écran 2020-11-23 à 10.21.20.png
     
  32. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Try to change the "Render Pass Event" of the "Fog Scattering Feature" to something like "Before Rendering Skybox".

    In the latest versions of Unity/URP, the fog generates some black artifacts on the horizon somewhat similar to your screenshot, here this is completely fixed by changing the execution order of the fog pass event.
     
  33. Deleted User

    Deleted User

    Guest

    And indeed it did ! Superb, should have thought of this before. If there was a 'hack' to get the scene to refresh automatically after getting out of playmode that would be cool; it's not bad, it's just a bit annoying to go from clear sky to pitch black ...

    Otherwise, this asset is asbolutely superb ! I am really enjoying it so far !
     
  34. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    For me Unity always refresh the editor after getting out of the playmode, but you can try to activate the option "Auto Generate" on the Lighting window. This will force the editor to update whenever there is a change in lighting or when returning from playmode.
     
  35. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    657
    Hmm, i read through near everything here, and no one seemed to ask if there's a quick dirty method to return formatted Time based on the timeline for text / clock displays.

    I suck at math. O,o

    Awsome Asset though mate. :D
     
  36. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Hi,

    You only need to access the public "hour" and "minute" variables of the "AzureTimeController" component and use as you wish.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.AzureSky;
    3.  
    4. public class Clock : MonoBehaviour
    5. {
    6.     public AzureTimeController azureTimeController;
    7.  
    8.     void Start()
    9.     {
    10.         Debug.Log(azureTimeController.hour.ToString("00") + ":" + azureTimeController.minute.ToString("00"));
    11.     }
    12. }
     
  37. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Hi great product. So saw this issue with azure fog scattering on the main camera. So I have three screen shots here. The first is a bit back from the character, the second is the same except zoom camera into first person so that camera is closer to the ruined cities on the horizon. The third is where the issue is and that shows the camera rotation around the character so the ruins are at a slight angle but the camera is no closer to the ruins that is would be in either of the other two shots. However you can clearly see that the ruins are far clearer then they are in the other two shots. I would have thought this was completely based on distance but it also appears to have something to do with the camera angle, moving the camera horizontally, does not cause this to happen so side to side as long as the camera angle is still pointing straight out to sea the ruins look the same. Its only when the cameras rotation angle changes . Any thoughts on this? thanks a ton.

    upload_2020-12-19_8-49-42.png

    upload_2020-12-19_8-49-54.png

    upload_2020-12-19_8-50-9.png
     
  38. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    This is because the fog is being calculated using the far clipping plane, this causes the fog to be rendered as a wall. I didn't realize it before because in the vast majority of cases it is imperceptible. Fortunately the solution is simple, it is only necessary to change the distance calculation to be radial.

    Open the FogScattering.shader and change this code:
    Code (CSharp):
    1. // Calcule fog distance
    2. float globalFog = smoothstep(-_Azure_GlobalFogSmooth, 1.25, depth * _ProjectionParams.z / _Azure_GlobalFogDistance) * _Azure_GlobalFogDensity;
    3. float heightFogDistance = smoothstep(-_Azure_HeightFogSmooth, 1.25, depth * _ProjectionParams.z / _Azure_HeightFogDistance);
    By this one:
    Code (CSharp):
    1. // Calcule fog distance
    2. float globalFog = smoothstep(-_Azure_GlobalFogSmooth, 1.25, length(depth * Input.interpolatedRay.xyz) / _Azure_GlobalFogDistance) * _Azure_GlobalFogDensity;
    3. float heightFogDistance = smoothstep(-_Azure_HeightFogSmooth, 1.25, length(depth * Input.interpolatedRay.xyz) / _Azure_HeightFogDistance);
    I think that should solve the issue.
     
  39. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Yep that did it. Thanks for the very fast response, great work.
     
  40. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    Having an issue with Azure Sky's fog scattering feature in 2020.2 that uses URP 10.

    Fog scattering feature enabled:
    upload_2020-12-24_22-46-21.png

    Fog scattering feature disabled:
    upload_2020-12-24_22-46-43.png

    Will we get an update that fixes the fog scattering to work with 2020.2's URP 10?
     
  41. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    Yes, the new version will come with a replacement package for each URP, v8 and v10. But for now you can try to apply the changes described in post number #1274 just above.
     
  42. Mojsov

    Mojsov

    Joined:
    Jul 6, 2015
    Posts:
    1
    Hi, I would like to ask a question as I need urgent assistance in finding a viable solution...
    Any suggestions on how I can mask the edge of my 3D terrain to blend it with the skybox horizon, knowing that the color of the skybox is dynamic and uneven as you change the period of day/night...
    Thanks in advance,
    Kocho.
     

    Attached Files:

  43. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    I made those changes, but they don't appear to work in the URP 10 that comes with 2020.2

    upload_2020-12-28_0-33-5.png
     
  44. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    I am sorry for the delay, I am experiencing technical issues, the screen I use on my computer has stopped working and is all dark, I can barely read texts, so it is likely that I will be away until the repair. Because of the pandemic it is difficult to find maintenance stores with parts in stock.

    Just add the fog scattering effect and set the proper fog distance and height.

    If you are using the Standard RP, just attach the AzureFogScattering.cs to the camera.
    If you are using the Universal RP, just add the "Azure Fog Scattering Feature" to the ForwardRenderer.asset in use by the camera and also enable the depth texture on the camera as explained in the documentation.

    You should get a result similar to the screenshot attached below.


    I just tested Azure on Unity 2020.2.1f1 with URP 10.2.2 and everything is working smoothly and without the need to make any modifications to the fog script.
    AzureURP10.jpg

    After importing Azure to the project, I just added the Azure Fog Scattering Feature to the ForwardRenderer.asset in use by the camera and enabled the Depth Texture on the Inspector of the same camera.

    The only additional detail was that I needed to change the Fog Scattering Feature's Render Pass Event from "After Rendering Opaques" to "Before Rendering Skybox" to remove some artifacts already mentioned above in post number #1281. I suspect it's the same issue.
     
    Mojsov likes this.
  45. potatosallad3

    potatosallad3

    Joined:
    Sep 10, 2019
    Posts:
    31
    I'm having a problem with the Particles/Alpha Blended shader that is provided with Azure[Sky]. The shader works perfectly well, enabling particles to properly blend behind Azure Sky's fog, however it prevents the particles from being lit properly at night. Screenshots of my issue:



    These particles are appearing as if they are lit by sunlight, when I have the moonlight and ambient light values set very very low. I am not good at shader coding, so I am wondering if theres some way I can make a quick edit to the shader to fix this, or is there an option I am missing? Like I say, particles using this shader look correct during daytime, but they dont actually seem to be being lit by the environmental lights.

    Cheers
     

    Attached Files:

  46. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    The transparent/particle shaders included in the package are just a demonstration/tutorial of how to implement the fog scattering effect with transparent shaders. This approach just adds the Azure fog to the shader without changing the structure and operation of the original shader in any way, if the shader has a lighting problem it must not be due to the fog implementation.

    Currently Azure uses only one directional light to simulate both the sun and the moon. At night the directional light automatically changes from the sun to work as a moon, so there is no way the particle is being affected by the directional light from the sun at night because there must be only one directional light in the scene used by Azure.

    As far as I know, Unity's legacy built-in particle shaders don't receive any light or ambient lighting. I think the particles in your screenshot are bright at night due to the blend mode of the shader.

    Try changing the color of the particle("Tint Color") to a darker shade at night. You can use the Azure Output System to control this color at any time of the day using a gradient and send the final color to the material.
     
  47. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    @DenisLemos Is it possible to use everything in Azure except the skybox material? I have a handpainted texture + procedural skybox (including sun, moon, stars, moving clouds) I'd like to use to match the project's style, but would like to use Azure's fog, time, weather, etc. Is that something I'd be able to do without much trouble?
     
  48. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    102
  49. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    787
    I don't think this is a good idea because the Azure fog scattering was developed to work with the Azure sky material, as the calculations of both shaders are similar, the blend of the sky and fog is perfect. If you use a different skybox, the blend of the sky with the fog/horizon will not be smooth.

    But if you still want to use Azure this way, it will be possible. You just need to replace the Azure skybox with your custom skybox and remove the follow code from the "OnEnable()" and "Update()" of the AzureSkyController.cs to prevent the controller from always setting the Azure sky material to the skybox.
    Code (CSharp):
    1. if (skyMaterial)
    2.     RenderSettings.skybox = skyMaterial;
    Or you can just attach your custom skybox to the "Sky Material" field on the "References" tab of the "AzureSkyController.cs" component.

    The next big update of Azure is being developed to make it even easier to use Azure components in combination with third-party assets. You can read more about it by looking at the posts above number #1266 and #1267.


    Hi,

    I will be gone for a few days, so as soon as I get back I’ll make a try following the documentation and send you the shader if I can add support for single pass instanced, but unfortunately I don’t have a vr device to test, so I’ll be limited to test on the Unity's editor only.
     
    Acissathar likes this.
  50. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Thank you! I'll play around with it some, and if anything I suppose I can try to really just re-use the clouds in some way.