Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Enviro - Sky and Weather (Dynamic Sky and Weather System)

Discussion in 'Assets and Asset Store' started by Vondox, Apr 11, 2015.

  1. RealistikDash

    RealistikDash

    Joined:
    Aug 31, 2018
    Posts:
    4
    Hey, the Photon sync seems to be a bit broken (or at least while using the UFPS Multiplayer Photon)
     
  2. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    Fantastic! That works.
     
  3. SveinEven

    SveinEven

    Joined:
    Sep 25, 2014
    Posts:
    99
    Hey! I am trying to get fog to work with Water4, and I have tried your shader that you posted in a previous post, but that gives a couple of error messages. Do you have a fix for this? :)

    Code (CSharp):
    1. Duplicated input semantics can't change type, size, or layout ('TEXCOORD5').
    2. Compiling Fragment program with FOG_EXP WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE
    3. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    Code (CSharp):
    1. output TEXCOORD5 used more than once
    2. Compiling Vertex program with FOG_EXP WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE
    3. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
     
  4. miklelottesen

    miklelottesen

    Joined:
    Mar 7, 2015
    Posts:
    19
    Thanks for your reply, and sorry for my late response. I would greatly appreciate that! I know my setup isn't very ordinary (it actually works surprisingly well, except for the fog issues), so I'm thrilled that you're willing to help me out with my very unusual request :D
     
  5. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    I've found a very serious problem. I'm using EnviroSky and PixelCrusher's Unity Dialogue System. As soon as a dialogue is displayed, I get "object of type 'Material' has been destroyed but you are still trying to access it." (referring to _volumeRenderingMaterial.DisableKeyword("ENVIROVOLUMELIGHT"). Once I rinse and repeat this a few times, the system totally crashes.

    Once the bug appears, moving the mouse starts moving random light sources in the neighbourhood in play mode (!) Then, no blue screen, but a hard reset. That is... an issue.

    Note the lantern lamp with a black texture around it appearing (here at the right bottom) when manipulating the scroll bar in the conversation window. When I move the mouse a bit more, I get about three of these, all from lanterns in the neighbourhood. As said, when I "summon" this bug a few more times, the system suddenly resets.

     
    Last edited: Jan 19, 2019
  6. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    P.S. A temporary workaround is to directly assign a Player & Camera in Envirosky (not using Assign On Runtime), but this is strange nonetheless.
     
  7. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    It's a pain to reproduce it now, as I finally got it fixed, but it must have to do with EnviroSky assuming it must render based on the MainCamera, which is suddenly "stolen" by the Dialogue System for camera sequences (zooming in when an NPC is talking, for example). Telling EnviroSky it must not look for the MainCamera during runtime, but attaching it to the actual player camera makes sure it doesn't get confused if said camera suddenly has no MainCamera tag anymore.

    I think this can be prevented by building in an extra check in EnviroSky making sure that the camera that is being used is not being stolen by other modules during runtime, but maybe that is exactly what the Render Setup box is meant for in the first place. Still, there should be a way to make sure that the _volumeRender whatever it is EnviroSky is looking for is actually there before doing stuff with it resulting in hard system resets.
     
    Vondox likes this.
  8. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, could you please send me your water4 shader? I will modify it then for you. :)
     
  9. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, thanks for your report and debugging this. I will include a fix for this in 2.1.0.
     
    LoekvanKooten likes this.
  10. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    23
    You are planning support for Unity3d 2018.2 ?
    Is not working for me Unity3d 2018.2
     
  11. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, strange it should work with 2018.2. Please send me more details about your issues.
     
  12. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    23
    Build for WebGL

    12345.jpg
     
  13. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Thats because of your Fog settings in the weather prefab. Play with Fog Distance, Height etc to get this better looking.
    Not all settings fit perfectly for big terrains or heigh mountains so you need to create of prefabs or tweak the fog configuration by yourself.

    Cheers
    Ronny
     
    Last edited: Jan 22, 2019
  14. SveinEven

    SveinEven

    Joined:
    Sep 25, 2014
    Posts:
    99
    Thank you!

    I believe this is the one that I downloaded.

    By the way I want to increase the ambient light at night by quite a lot.
    Is there a setting that I cant see, or do I have to change the intensity manually from a script?
     

    Attached Files:

    Last edited: Jan 21, 2019
  15. Skyunarankage

    Skyunarankage

    Joined:
    Jun 2, 2017
    Posts:
    10
    Hello, i changed to a windows build and is not only seeing the clouds in some angles and seeing the clouds on top of everything. things are a little glitchy now, any suggestions ?
     
  16. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, please remove WebGL 1.0 from your graphics api list ("Project Settings" -> "Player" -> "WebGL Settings" tab). You need to run with WebGL 2.0, lower version can't be supported by enviro.
     
  17. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hi, you can tweak the ambient light intensity and colors in EnviroSky -> Edit Profile -> Lighting category. For night you want to change the left half values or colors. Oh I will modify the shader for you tomorrow.
     
  18. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hi, do you mean UWP build? If yes what unity version and do you use xr?
     
  19. btckey

    btckey

    Joined:
    Nov 1, 2012
    Posts:
    23
    Vondox thank you very much. :)
     
  20. DonYep

    DonYep

    Joined:
    Jan 23, 2019
    Posts:
    7
    Hi,
    Can you please tell me a quick way to completely turn off the Skybox horizon gradient & color?
    All we need is a completely black background in space for our planet, & keep your rotating sun/moon/stars of course.
    Been trying but the earth atmosphere color is always there.

    Thanks
    Don
     
  21. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hi Don, please try to set the sun intensity in envirosky sky settings to "0". But you may also want to disable the "sky-fogging" then and that would need some modifications to the fog shader. Enviro is not really meant to be used for space scenes out of the box. So please contact me in private conservation if you need help with that.
     
  22. Venil-Prasath

    Venil-Prasath

    Joined:
    Nov 19, 2018
    Posts:
    8
    I cant able to change the WindZone Main value in playmode…..Can u help with this
     
  23. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, I have answered your mail already. :)
     
    Venil-Prasath likes this.
  24. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    Suddenly I'm getting this. Reinstantiating the skybox does not help.

    It does not happen in Unity. Only in the actual build itself.

    It's clearly the skybox, but how come?

    Edit: It may be the caustics effects of AQUAS, but integration is on and caused no issues before. Investigating...
    Edit 2: Turning the Ignore Raycast layer off in the caustics does not change anything.
    Edit 3: Turning the caustics entirely off does not change anything.

     
    Last edited: Jan 24, 2019
  25. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
  26. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,197
    Hello Hendrik,

    my Question is ia bit specific, but maybe Enviro can help with it:

    In my game it is night. The player is in a dark room and has no torch.
    I want to dress or equip my player. So another camera is turned on which shows the player in its current environment.
    It is dark. If I lighten the whole scene, this is is bad for the current feeling of the Scene...

    Enviro uses some nice lightshafts. Could I create a temporary lightshaft which surrounds the player and enlightens only the player?

    That would be great. If it is too complicated, no problem. But if this can be done with enviro, a hint would be nice :)

    Thanks!
     
  27. XANTOMEN

    XANTOMEN

    Joined:
    Dec 18, 2012
    Posts:
    23
    Sure, sorry for the delay, I don't get Alerts by email.

    In my case, I touched around the Global Snow parameters, and came up with the conclusion that the amount of coverage and look I wanted is achieved by modifying three parameters based on the curSnowStrength variable that comes in Enviro, which goes from 0 to the upper limit specified in the current Weather preset.

    Originally, Weather presets that raise curSnowStrength are Light Snow (maximum 0.5 I think) and Hard Snow (maximum 1).

    So, I just plug Enviro's curSnowStrength into Global Snow's snowAmount, and then use that as the t value of three linear interpolation functions, one per parameter.

    The Lerp in altitudeScatter and AltitudeBlending is inverted as a smaller value results in more snow in the Scene.

    GameManager.instance.globalSnowController is GlobalSnow.cs.
    GameManager.instance.skyWeatherCyclesController is EnviroSky.cs.

    Just put this script somewhere, change the way to access the GlobalSnow and EnviroSky scripts if you want, and set the groundCoverage parameter in GlobalSnow (in the Inspector) to the value you would like it to have when snowAmount is 1 (maximum snow), and initialAltitudeScatter and initialAltitudeBlending parameters in GlobalSnow to the values you would like it to have when snowAmount is 0 (minimum snow).

    Not related to my script, but useful:

    Remember to put the GlobalSnow script in the MainCamera over the Enviro scripts, and not below, or else Enviro Fog appears behind the snow, and not over it. (

    Script:

    Code (CSharp):
    1. using UnityEngine;
    2. using GlobalSnowEffect;
    3.  
    4. public class EnviroGlobalSnowIntegration : MonoBehaviour {
    5.  
    6.     GlobalSnow globalSnow;
    7.  
    8.     //Vars to save initial float values for different parameters.
    9.  
    10.     float initialGroundCoverage; //0.008f is a good value for me
    11.     float initialAltitudeScatter; //100f is a good value for me
    12.     float initialAltitudeBlending; //100f is a good value for me
    13.  
    14.     // Use this for initialization
    15.     void Start () {
    16.  
    17.         globalSnow = GameManager.instance.globalSnowController;
    18.  
    19.         initialGroundCoverage = globalSnow.groundCoverage;
    20.         initialAltitudeScatter = globalSnow.altitudeScatter;
    21.         initialAltitudeBlending = globalSnow.altitudeBlending;
    22.     }
    23.  
    24.     // Update is called once per frame
    25.     void Update () {
    26.  
    27.         globalSnow.snowAmount = Mathf.Clamp(GameManager.instance.skyWeatherCyclesController.Weather.curSnowStrength, 0, 1f);
    28.  
    29.         globalSnow.groundCoverage = Mathf.Lerp(0, initialGroundCoverage, globalSnow.snowAmount);
    30.         globalSnow.altitudeScatter = Mathf.Lerp(initialAltitudeScatter, 0, globalSnow.snowAmount);
    31.         globalSnow.altitudeBlending = Mathf.Lerp(initialAltitudeBlending, 0, globalSnow.snowAmount);
    32.     }
    33. }
     
    Last edited: Jan 24, 2019
    Mark_01, nirvanajie, Vondox and 2 others like this.
  28. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    @XANTOMEN Awesome. Thanks a lot I'm getting a "The name 'GameManager' does not exist in the current context" error though, as I don't have a GameManager script.
     
  29. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    @XANTOMEN Also... Your integration doesn't use World Manager API... which I would ideally like to use, in case the project gets more complex. I'll try to see if I can repurpose your code for WMAPI, unless somebody else has a working solution there?
     
  30. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    And thats good. Integration should not need or rely on another asset. If you want WMAPI to handle some stuff add it by yourself for your project. But getting an integration of Asset A (Enviro) with Asset B (Global Snow) should not involve another asset.

    @XANTOMEN great work man! Right now I am working more on interiors than on terrains with Enviro and Global Snow. Gonna test your script in the future.

    Perhaps Hendrik could take a look and think about an "offical" integration and add it to the upcoming package.

    Best regards
     
    XANTOMEN likes this.
  31. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    For sure @RonnyDance - a direct integration is often best. But I've noticed Enviro and GlobalSnow actually already have WMAPI scripts. Haven't yet gotten them working though.

    But @XANTOMEN 's script works great for me with a simple modification:

    Code (CSharp):
    1. using UnityEngine;
    2. using GlobalSnowEffect;
    3.  
    4. public class EnviroGlobalSnow : MonoBehaviour
    5. {
    6.     GlobalSnow globalSnow;
    7.     //Vars to save initial float values for different parameters
    8.     float initialGroundCoverage; //0.008f is a good value for me
    9.     float initialAltitudeScatter; //100f is a good value for me
    10.     float initialAltitudeBlending; //100f is a good value for me
    11.     // Use this for initialization
    12.     void Start () {
    13.         globalSnow = GlobalSnowEffect.GlobalSnow.instance;
    14.        
    15.         initialGroundCoverage = globalSnow.groundCoverage;
    16.         initialAltitudeScatter = globalSnow.altitudeScatter;
    17.         initialAltitudeBlending = globalSnow.altitudeBlending;
    18.     }
    19.     // Update is called once per frame
    20.     void Update () {
    21.         globalSnow.snowAmount = Mathf.Clamp(EnviroSky.instance.Weather.curSnowStrength, 0, 1f);
    22.         globalSnow.groundCoverage = Mathf.Lerp(0, initialGroundCoverage, globalSnow.snowAmount);
    23.         globalSnow.altitudeScatter = Mathf.Lerp(initialAltitudeScatter, 0, globalSnow.snowAmount);
    24.         globalSnow.altitudeBlending = Mathf.Lerp(initialAltitudeBlending, 0, globalSnow.snowAmount);
    25.        
    26.     }
    27. }
     
    nirvanajie, Vondox and RonnyDance like this.
  32. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, sorry but you can't use the lightshafts for that out of the box. Why you don't use a light that only affects your player? For example a spot light with the volume lighting component? But maybe I just got it wrong what you want to achieve exactly. :D
     
  33. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,197
    Okay, thanks :)
     
  34. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,197
    Enviro is working perfect in my Game, Unity 2018.3.2.f1. :)

    Just one warning, for info for the next Version maybe:

    CheckResources () for Main Camera (EnviroFog) should be overwritten.
    0x0000000141413048 (Unity) StackWalker::GetCurrentCallstack
    0x00000001414194F6 (Unity) StackWalker::ShowCallstack
    0x00000001412FCD7B (Unity) GetStacktrace
    0x00000001401432FE (Unity) DebugStringToFile
    0x000000014178548D (Unity) DebugLogHandler_CUSTOM_Internal_Log
    0x000000001AF138B0 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
    0x000000001AF13503 (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    0x000000001AF12D7D (Mono JIT Code) [Logger.cs:48] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    0x0000000050CFAC4C (Mono JIT Code) [Debug.bindings.cs:149] UnityEngine.Debug:LogWarning (object)
    0x0000000064523313 (Mono JIT Code) [EnviroEffects.cs:79] EnviroEffects:CheckResources ()
    0x00000000645211DD (Mono JIT Code) [EnviroEffects.cs:86] EnviroEffects:Start ()

    Have a nice Weekend :)
     
  35. Nevrosis

    Nevrosis

    Joined:
    Nov 30, 2016
    Posts:
    3
    on 2018.3.0f2

    I have this error when I hit the stop button.

    InvalidOperationException: Destroying a GameObject inside a Prefab instance is not allowed.
    UnityEngine.Object.DestroyImmediate (UnityEngine.Object obj) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:322)
    EnviroSky.CreateEffects () (at Assets/Enviro - Dynamic Enviroment/Scripts/EnviroSky.cs:1074)
    EnviroSky.Start () (at Assets/Enviro - Dynamic Enviroment/Scripts/EnviroSky.cs:493)

    Have a great day!
     
  36. Waterlane

    Waterlane

    Joined:
    Mar 13, 2015
    Posts:
    171
    Haven't used Enviro for a while now - 'trying it with HDRP and can't get anything to show...
    If looking at me 'scene settings' there are options for a range of sky types but not Enviro...
    Any advice ('just a quick question - I'll investigate more as well)
     
  37. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, the EnviroFog component is deprecated, you shopuld not need it anymore.
     
  38. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, thanks for your report. Haven't got this so far and will have investigate that one. But with the changes in 2.1.0 I think this will be already fixed.
     
  39. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, SRP are not supported right now. But I work on an update with srp support.
     
    Waterlane likes this.
  40. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,197
    I do not see an "EnviroFog" gameobject in my scene, and do not see an "EnviroFog" component in or under my EnviroSky gameobject. How do I find it so I can remove it?

    I just found this: If I Change the "Category" in EnviroSky to "Fog" it Looks like this:

    upload_2019-1-27_17-54-26.png

    I never realized a visible fog (but I would like to have some!).
    What do I set here for maximum Performance or to have some nice fog with a good performance?

    Thanks :)
     
  41. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    The EnviroFog component should be on your camera. That settings look okay best performance wise. (Using the simple fog). You now can tweak your weather presets fog settings and should be good.
     
  42. Waterlane

    Waterlane

    Joined:
    Mar 13, 2015
    Posts:
    171
    Thanks for the quick reply and I'll keep an eye open for updates.
    BTW - Here's a thought for the future - some 'artist' friendly slider controls in the scene/game view to edit the visual style (I'm always wanting intuitive ways to control the short-term visuals, rather than day night cycles):)
     
  43. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    63
    Hi @Vondox , do you have plans to add lightning to enviro? Or do you recommend a third party solution with easy integration for that?

    Thank you
     
  44. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    @Vondox What am I doing wrong? When the moon is in the corner of the screen it is all distorted...



    whereas in the middle of the screen it looks fine (this screenshot taken 2 seconds after the previous one)

     
  45. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Weendie-Games likes this.
  46. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hello, looks like high field of view in your camera settings.
     
  47. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    I thought so too but it seems to be set to 56.38021, which sounds reasonable to me.
     
  48. XANTOMEN

    XANTOMEN

    Joined:
    Dec 18, 2012
    Posts:
    23
    Hi @Vondox , how do you feel if I post here publicly a modification of the EnviroSkyRendering.cs code but with ExecuteInEditMode, so the clouds and light diffusion and so on work while in Edit Mode, and not just while playing ?

    I don't know if anyone will need it or want it, but I got it done as it was annoying me while diagnosing a problem I was having, so I thought it'd be a good idea to give it to others at their own risk.:p

    I'm asking for permission as it looks like one of the main files in your paid asset, and don't know how comfortable you are with it, or if you'd have wishes like sharing the minimum necessary segments with a guide instead of the whole file (the whole file is the easiest for me and anyone else), or to share only on private messages.

    -------------------------------------------------------------
    Unrelated question / feature requests:

    1. Is it per chance planned at some point to add a "probability of weather changing to this" / frequency of Weather types per zone? For example, if we would like for a zone to increase the chances of Heavy Snow being picked and decrease the chances of Clear Sky.

    I am aware that I can make my own or just add repeated Weather prefabs to the array to account for it, but I think it's a desirable common feature.

    2. Similarly while a little more specific, would be cool to be able to set Weather patterns. For example, to set that Light Snow is followed by Heavy Snow, then again to Light Snow, then random.

    3. Also to make "Weather Update Interval" a random number in between two numbers rather than a fixed number, so Weather doesn't change like clockwork.

    Cheers
     
    Last edited: Feb 1, 2019
    Mark_01, mmaclaurin and transat like this.
  49. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    About my moon issue... I've got a feeling that what I'm seeing in the sky is the moon's reflection rather than the moon itself. Could that be possible?
     
  50. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,197
    Hi, hm not sure how we could get rid of this, as it is working as intended. All objects in your scene will be getting more distorted at the screen edges with higher fov.

    Here how it looks on my side with your fov of 56.38021 and moon rendered in skybox:
    upload_2019-2-1_13-38-54.png

    If we now render the moon as object/mesh in scene and not in skybox it is the same result (only a little bit bigger):
    upload_2019-2-1_13-39-50.png

    Sorry currently no idea, but will have a more detailed look into that later.
     
unityunity