Search Unity

[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
    Hello there! I am having an issue with UFPS again. I can't see my weapons. I did try your previous advice to change the moon to its own layer but I noticed it changes back to the Weapon layer.
     
  2. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Hi. I'm getting this error although my Sun does seem to be set up...

    Code (CSharp):
    1. [Exception] UnassignedReferenceException: The variable SunTransform of EnviroSky has not been assigned.
    2. You probably need to assign the SunTransform variable of the EnviroSky script in the inspector.
    3. Transform.set_localPosition()
    4.  
    5. EnviroSky.CalculateSunPosition()    Assets/Enviro - Dynamic Enviroment/Scripts/EnviroSky.cs:1926
    6. 1924:   GameTime.solarTime = Mathf.Clamp01(Remap (sunTheta, -1.5f, 0f, 1.5f, 1f));
    7. -->1926:   SunTransform.localPosition = OrbitalToLocal(sunTheta, sunPhi);
    8. 1927:   SunTransform.LookAt(DomeTransform.position);
    9.  
    10. EnviroSky.UpdateSunAndMoonPosition()    Assets/Enviro - Dynamic Enviroment/Scripts/EnviroSky.cs:1856
    11. 1854:   else
    12. 1855:   {
    13. -->1856:       CalculateSunPosition(d, ecl, true);
    14. 1857:   }
    15.  
    16. EnviroSky.Update()    Assets/Enviro - Dynamic Enviroment/Scripts/EnviroSky.cs:1513
    17. 1511:   {
    18. 1512:               UpdateTime();
    19. -->1513:               UpdateSunAndMoonPosition();
    20. 1514:               CalculateDirectLight();
    21. 1515:               UpdateAmbientLight();
    22.  
     
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @Vondox When I build the game (PC) my volumetric effect and light shaft doesn't show up. It works fine in the editor. Unity 2018.3f2 Windows DX 11 running on Geforce 1060

    Not sure if this will help, but looking at the output_log I found :
    d3d11: failed to create buffer (target 0x2 mode 0 size 0) [0x80070057]

    Any ideas? Seems weird when it all works fine in the editor but not in the build.

    Also please fix any unnecessary warnings in the script for compile for Unity 2018.3 :D
     
    Last edited: Dec 27, 2018
  4. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, the curves and gradient are evaluated based on sun altitude not time of day. Here is a quick drawing I made and hope it will help you. I am not talented in drawings. :D

    (Yellow circle is the sun, time is the time value that will be evaluated on your curve/gradient.
    So from left to right -> 0 - 1)

    Sun_Curve_Gradient.png
     
    eaque likes this.
  5. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, does your objects only shine bright when you look into sun? That could the related to light shafts. Please try to modify the sun lightshafts intensity or treshhold color gradient around time value of 0.5.
     
  6. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, hard to tell from here. Could you please send me your profile and weather presets? Also do you use linear or gamma colorspace?
     
  7. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, you have to set the moon layer in EnviroSky -> "Rendering Setup". After that also check if UFPS weapon layer will be rendered by your weapon camera.
     
  8. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, please check EnviroSky -> "Component Setup". It should look like this:

    upload_2018-12-27_19-12-41.png
     
  9. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, you have to add the Enviro/VolumeLight shader to the list of "Always Included Shaders" in Unity -> Graphic settings.

    upload_2018-12-27_19-14-7.png
     
  10. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Great Thanks!
     
  11. MojaveMoore

    MojaveMoore

    Joined:
    Jun 26, 2018
    Posts:
    3
    I'm real enjoying Enviro Sky but can't figure out how to change the size of the moon and sun to create the eclipse needed in my game and story line. I've tried changing the scale in the inspector but to no avail, any help would be greatly appreciated.
     
  12. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Is there a way to completely turn off lightshafts?
     
  13. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    It does... except that I have the Sun's transform as as my "Direct light".

    I had copied all the components from the Enviro Directional Light and copied them to the Sun, then deleted the Enviro Directional Light game object.
    Dragged a new EnviroSky prefab into my scene and deleted the old one and all is well now.
    Cheers.
     
    Last edited: Dec 28, 2018
  14. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, sorry that would not work. We need to add eclipse feature directly in skybox shader to hide the sun disc and get an eclipse effect. It's on my list and will be added in one of the next updates.
     
  15. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, you can disable those in "Feature Controls" section in EnviroSky component.
     
  16. AtomicIsland

    AtomicIsland

    Joined:
    Sep 20, 2018
    Posts:
    12
    I finally tracked down the source of the problem. After messing with the settings some more, I remembered that I had changed the Skybox Mode to "Custom Skybox" in my project, to change the color of the sky. Returning the setting to Default brought back the Flat and Cirrus clouds. I also figured out that changing the "Weather Sky Mod" color gradient in the weather settings is the correct way to change the sky color.

    Thanks for the help and the amazing asset! I'll leave a 5 star review on the Asset store :)
     
    Vondox likes this.
  17. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Can we possibly track down and eliminate GC created by EnviroLightShafts OnRenderImage ? It is creating 2kb GC every frame. Which is pretty a lot.
     
  18. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, hm strange I can't reproduce this on my side. What Unity version do you use?

    upload_2018-12-29_16-22-59.png
     
  19. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    Hi, I'm getting moon shafts when I don't want them. The shafts only appear through the mountains when it is rising. When it clears the mountains everything is fine and the shafts are gone. The sun shafts are working fine. Sun Light Shafts are checked, Moon Light Shafts are not. Any thoughts? I'm using Map Magic, Aquas, Vegetation Studio, CTS and Unity 2018.3
     
    Last edited: Dec 29, 2018
  20. Hitman772

    Hitman772

    Joined:
    Aug 26, 2017
    Posts:
    3

    Thank you for the speedy reply
    What where these features used for? im new with the Asset?
     
  21. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hello!! Is there ANY way I can use baked light with enviro? Realtime is so expensive... I would have so good frames with baked
     
  22. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    maybe it's volume lighting, it produces some shafts too
     
  23. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am using Unity 2018.3.f2 Windows
     
  24. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    You can. Just disable simulation of time of the day, and set the light to mixed mode, bake your scene just like you would normally do. I don't see why baked static time scene can't be done? What is the problem?
     
  25. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Simulation is the whole point of this asset.. And it need to be realtime or else the shadows wont update and lightning overall
     
  26. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yes the asset is primarily made for realtime simulation. But there is nothing stopping you from using it as static baked mode. I am just saying it is possible to do static baked scene using the asset. Having said that, it is not the asset's problem of not being able to do a baked lighting simulation. It is mostly to do with Unity's implementation of the lighting. You want to use "baked" lightmap mode, and yet want to do "realtime" change of light... Well.. that's not going to work no matter what assets you are trying to use. For Unity's realtime lighting, you need to use Enlighten realtime GI. You can't expect any asset to over come this by using baked mixed mode lighting. ( and expect simulation of time of the day with GI )
     
  27. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Yeah I know that now...
     
  28. dwaldrum

    dwaldrum

    Joined:
    Jun 20, 2015
    Posts:
    48
    Our project is using HDRP and I saw you were working on this, so we just bought your asset. Saw that you had a beta for HDRP support, could we grab a copy of that so we could start testing the asset? Thanks!
     
  29. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    Hi,
    A little thing i didn't dig into, but when i set the moon layer, the moon disappears...I see the moon shaft but not the moon itself...What am i doing wrong?
     
  30. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Yeah, I can send you a download link in the next days. But it still is in an early state. Please send me your invoice number in a private message.
     
  31. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, where do you set the moon layer? You need to set these in "EnviroSky" -> "Rendering Setup".
     
  32. bobbyrocks

    bobbyrocks

    Joined:
    Jan 27, 2014
    Posts:
    14
    Question about your asset. I use the Enviro that comes with atavism and I have noticed when I add it to atavism.. there is a huge drop in FPS and it literally keeps dropping frames until it gets down into the teens. It will start around 60 and just constantly drop.. The minute I remove Enviro, my FPS stays around 65-70.. what adjustment need to be done because I really want to use just the night and day effect. I am not super interested in all of the other stuff. well maybe the weather .. but the other stuff I could care less about. Could you help please. The atavism guys directed me to you
     
  33. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, that isn't the normal behaviour. Do you could check if you get any error or debug spam in your console please?
     
  34. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,270
    new Enviro?
     
  35. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Is this working with LWRP ?
     
  36. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, not yet. SRP support in in development right now.
     
  37. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    No new enviro, but a major update is coming out soon with a lot of improvements and new stuff both for lite(mobile) and standard enviro versions. :)
     
    mmaclaurin and SickaGames1 like this.
  38. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm setting up Enviro's integration script with Lux Dynamic Weather, but I'm a little uncertain how it works. The Enviro script has variables for Raining Temperature and Snowing Temperature, but when I set Enviro weather to Heavy Snow, the temperature on Lux changes to what's set on the Raining Temperature, and I get wetness effects in the scene, rather than snow effects. Any tips on how this works? (I can ask Lars also, but figured I'd try you first since it's regarding the integration script.)

    Thanks!
     
  39. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hi, hm works correct for me. Currently it is using a workaround as enviro 2.0.5 does not simulate temperature. (But 2.1.0 will do that.) Could you please check the max snow and wetness intensity of your heavy snow preset?

    Oh I also changed the rainfall code in 2.1.0 a little bit to set it to "0f" if we only have very little wetness or snow coverage in enviro.
     
  40. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    On the Heavy Snow preset, Max Wetness is zero and Max Snow is 1. So that's correct, right?

    If I change the Raining Temp on the integration component to -20, then it works, and snow appears....so that's still puzzling.

    When will 2.1 be ready?
     
  41. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Right now Enviro is not compatible to NatureManufactor Tree Assets regarding Wind Effects.

    Wind generation with Enviro will not work with following assets:

    Meadow Environment
    https://www.assetstore.unity3d.com/en/?stay#!/content/132195

    Mountain Trees Dynamic Nature:
    https://www.assetstore.unity3d.com/en/?stay#!/content/107004

    I talked with Bart who recommended to write a recalculation script which will translate wind power into km/h for the assets. Did someone made this already when using Unity Standard Shader (No LDRP etc)?

    This could be added to new Enviro version so Enviro Wind also works with NatureManufactor Assets.

    Cheers
    Ronny
     
    transat likes this.
  42. XANTOMEN

    XANTOMEN

    Joined:
    Dec 18, 2012
    Posts:
    41
    Hi again @Vondox , hope the new year is treating you well.

    I successfully managed (following your guides) to make Enviro Fog work with R.A.M and AQUAS. I however don't manage to apply the same shader code strategy for using Global Snow from Kronnect with Enviro Fog, I imagine amongst other things because the shader GlobalSnow/Snow isn't using StandardSpecular.

    As a detail of some interest, the Fog does work with objects that are beyond the Detail Distance of the Quality section of the Global Snow config. I'm using Forward rendering.

    Any chance you also have a manual for this case, or some tips? I'm a shader newb.

    Thank you!

    EDIT; SOLVED:

    It turned out that I just had to move the Global Snow script in the Camera to be above the Enviro Sky Rendering script, so the Snow image effect happens earlier than Enviro Fog. That's it!

    :D

    If you arrived here through search and this doesn't solve it for you, it might be related to a different material and you might benefit from the answers in the documentation included in the Asset, under the title:

    "Some objects that get clipped when Global Snow is enabled (forward rendering)"
     
    Last edited: Jan 5, 2019
    Vondox and RonnyDance like this.
  43. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    I am using Global Snow of Kronnect with Deferred Rendering and I don't see any issues so I assume it must be the Forward Rendering? But perhaps I did not look so closely.
    Anyway it's nice to see that you brought the Global Snow Asset of Kronnect up because right now there is not any Enviro support of it. Meaning that Enviro can't controll the Snow Amount, Snow Falling etc when it's winter season or Snowing as Weather Prefab.
    I talked with Hendrik and Kronnect about it and also about a general support of each other, so they should be working on it hopefully. Since Global Snow is the best Snow Effect for everything (Meshes AND Terrain) a support of it would be really awesome.

    Cheers
    Ronny
     
    nirvanajie, transat and XANTOMEN like this.
  44. XANTOMEN

    XANTOMEN

    Joined:
    Dec 18, 2012
    Posts:
    41
    Thank you for your reply RonnyDance :)

    Yes, I tested and with Deferred it definitely works, but I'm using Forward for plenty of other things and so I wish it'd work in Forward.

    You are right, it'd be extra nice to have integration. Fortunately both Enviro and Global Snow are very clear and expose their variables very transparently, so it took me just a few minutes to get Global Snow to depend on Enviro in the way I wanted it to. It sounds like you have a handle on things but if that's not the case and you want me to point at the variables or something it'd be my pleasure.

    Cheers!
     
  45. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Where can I find what those lines are?
     
  46. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hi @Vondox
    I have a small issue, which is more just a warning than an issue, but I always try to not get a single warning in my builds



    I explain the setup:

    1 base scene with my player character, enviro and some managers script - That scene is never ever unloaded
    1 additive loaded scene with the actual level (so I always load a new scene and unload the previous one)

    As stated Enviro is on the base scene, the issue is the second scene never have a skybox referenced and that triggers that warning

    Is there any way to feed the skybox info on my other scenes when they're loaded?
     
  47. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello Ronny, thanks for your feature suggestion! I will add support for this in 2.1.0.
     
    RonnyDance likes this.
  48. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    It will be a bit delayed as I wanted to add a few more smaller features for 2.1.0 that users suggested. But I try to get last beta version out in next week and after some testing online in asset store.

    Does it work correctly if you just swap the temperature settings for now? With 2.1.0 we don't need this workaround anymore, so it only would be for now.
     
  49. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello.

    First you need to add the enviro include with the fog function:

    Code (CSharp):
    1. #include "Assets/Enviro - Dynamic
    2. Enviroment/Resources/Shaders/Core/EnviroFogCore.cginc"
    Now for Unity surface shaders:

    1. Add the "finalcolor:ApplyFog" pragma statement.

    2. Add the "Apply Fog" function like:
    Code (CSharp):
    1. void ApplyFog(Input IN, SurfaceOutputStandardSpecular o, inout fixed4 color)
    2. {
    3. //Get ScreenPosition
    4. float3 uvscreen = IN.screenPos.xyz / IN.screenPos.w;
    5. // Calculate Linear Depth
    6. half linear01Depth = Linear01Depth(uvscreen.z);
    7. //get World Position
    8. float3 wPos = IN.worldPos.xyz;
    9. // Calculate Fog and apply volume lighting tex
    10. float4 fogClr = TransparentFog(color, wPos, uvscreen.xy, linear01Depth);
    11. #if _ALPHAPREMULTIPLY_ON
    12. fogClr.rgb *= o.Alpha;
    13. #endif
    14. #ifndef UNITY_PASS_FORWARDADD
    15. color.rgb = fogClr.rgb;
    16. #endif
    17. }
    3. You may also need to add "screenPos" and "worldPos" to your Input struct.

    For Vert/Frag shaders:

    1. Make sure that you calculate worldPosition, screenPosition and eyeDepth in your vertex shader.
    2. Add the "TransparentFog" function at the end of your fragment shader:
    Code (CSharp):
    1. float4 output = TransparentFog(float4(finalColor),float3(worldPos),
    2. float2(screenPos),float(linearEyeDepth));
    I also will upload some guides for popular assets here. These may will help you modifiy other shaders aswell. If you stuck you also can contact me in private message with your shader and I will modify it for you. :)
     

    Attached Files:

    Mark_01 and DrInternet like this.
  50. Vondox

    Vondox

    Joined:
    Jun 3, 2013
    Posts:
    2,422
    Hello, please try following workaround:

    Add Enviro in your second scene so it does add the EnviroSkybox material, after that delete Enviro object and save your scene.