Search Unity

Volumetric Fog & Mist - AAA realistic and animated fog, dust, low clouds and mist

Discussion in 'Assets and Asset Store' started by Kronnect, Dec 1, 2015.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    The update has been submitted - should be available in 1-3 days. Really adds to the package and I’m quite happy with the results which also perform better.
     
  2. Winterschillstudio_Hakiro

    Winterschillstudio_Hakiro

    Joined:
    Aug 29, 2017
    Posts:
    1
    Hello!

    Should "fog of war" work in VR also? and if so, is there some configuration that needs to be done before?
     
  3. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Yes, it should - however note that in order to work, this option needs some “geometry” behind the fog. So it’s mostly aimed to top/down RTS games or similar where the fog hangs over the terrain.
     
    Last edited: Jan 18, 2018
  4. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I need to create a large area (2x6km) of low-lying fog in a valley -- like this: http://ak8.picdn.net/shutterstock/videos/5474438/thumb/1.jpg

    It needs to be visible from the higher areas of the terrain, 1-3km away.

    Is there a way to create that with Dynamic Fog (for better performance), or should I use a Volumetric Fog volume and try to lower the quality to keep it performant? And if the latter, how do I allow greater Max Distance than 2000m?
     
  5. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    The max distance of 2000 can be increased editing VolumetricFogInspector.cs file.
    Also you can add both effects on the same camera: Dynamic Fog & Mist to cover far areas while Volumetric Fog adds detail to the short-mid range.
     
  6. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    EDIT: Right, I'm setting up the distant fog with Dynamic Fog now, thanks!
     
    Last edited: Feb 2, 2018
  7. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    In Dynamic Fog inspector, choose "Desktop Fog Plus + Sky Haze" effect type and customize distance/height/baseline height to connect to the Volumetric Fog & Mist area. This could be the far fog effect:



    Settings:

     
  8. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    thanks, that's very helpful! I've got it set up with both Volumetric and Dynamic Fog.

    On both, is there a way to tie the wind direction to the Wind Zone in the scene?
     
  9. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Not automatically but you can set it using scripting:

    Code (CSharp):
    1. VolumetricFog.instance.speed = <speed of wind> (float)
    2. VolumetricFog.instance.windDirection = <direction> (vector3)
    Same for Dynamic Fog:

    Code (CSharp):
    1. DynamicFog.instance.speed = <speed of wind> (float)
    2. DynamicFog.instance.windDirection = <direction> (vector3)
    Note that those parameters affect the entire fog.
     
  10. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi @Thrawn75 Im getting an error on the latest store update. It was fine before I updated. Any idea what the problem is? unity 2017.3 version.


    Shader error in 'VolumetricFogAndMist/Sprites/SpriteFog Unlit': undeclared identifier 'unity_SpriteRendererColorArray' at line 80 (on d3d11)
    Compiling Vertex program with INSTANCING_ON
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF3 UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_RGBM_ENCODING
     
  11. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hi, thanks for the heads up! that’s the new Instanced sprite fog shader - I’ll take a look and update the package if needed - in the meanwhile you can remove the Sprite fog shaders in the Resources/Extra if you are not using the sprite fog materials.
     
    Last edited: Feb 6, 2018
    AndyNeoman likes this.
  12. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    @AndyNeoman confirmed - Unity 2017.3 changes how sprite instanced properties are defined but the API upgrade tool does not change it so a new update has been submitted specifically for Unity 2017.3. This is an issue that affects any custom or derived sprite shader with support for instancing.
    You can download the updated packages right now from our support forum on kronnect.com - OR - simply uncheck the "Enable GPU Instancing" option on the Sprite Unlit material itself.



    Regards.
     
    AndyNeoman likes this.
  13. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    Before I take the plunge on this, does it support multiple cameras? I have a game where there are at least two visible cameras at all times and I need the fog rendered to each.
     
  14. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    As this is a camera effect, if you use two cameras you need to add the script to both cameras. So yes.
    Also, support for multi-camera for fog areas is being added - this is needed for VR Panorama Pro Render for example which forks the main camera. A beta will be available on our support forum this week (kronnect.com).
    Regards.
     
  15. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Quick question: Why is "Build Options" only shown when hasCamera is true? I have just updated the package and wanted to set up the build options ... but wasn't able to find them at first. I'm not even sure why my main VolumentricFog component has hasCamera false - but most likely it's because I keep the component disabled.

    For now, I'll simply comment out the if (...) in the custom editor script to make this always visible. But I'm not sure why this is needed at all because changing the build options has a global effect, so I don't think it should only be available on certain VolumetricFog components or under certain circumstances.
     
    Kronnect likes this.
  16. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    That's an interesting case and it will be changed in future versions. Glad you found your way to properly set it up.
    Note that only the scripts attached to the cameras are doing the rendering and also serving the purpose of centralising any global configuration that affects all fog effects, like the shader features management. The common case is that you will have one Volumetric Fog script attached to the active cameras - when the script runs the "OnEnable" code, it sets the hasCamera flag. If it's disabled, obviously this flag is not properly set hence it can be misleading to the inspector.
     
  17. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Yup. In our case, as we have a rather complex camera setup (VR game with a camera rig with different objects for the controllers, spectator mode with a large number of cameras of which always only one is active), we keep that setup in the "main scene". We use Volumetric Fog only in two of our environments, and when those are loaded, VolumetricFog gets activated on all cameras (but there's only one or two cameras active).

    The fog profiles will come super-handy for us: At the moment, we still write a few settings that need to be changed between the two environments with my own code. That was from before the profiles were available. Now, with the profiles, each environment can have its profile as part of the environment, and then I just push that profile into all VolumetricFog components, like we already do it with the PostProcessingProfiles.
     
    Kronnect likes this.
  18. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Just in case it helps, along with profiles, the fog volumes were also updated to support them: a fog volume enables you to define a bounding box in which some fog attributes on the main camera script can change, like fog colors. Now you can also assign different profiles to each fog volume and the settings will lerp between them:



     
    jashan likes this.
  19. yunnis

    yunnis

    Joined:
    Jun 5, 2017
    Posts:
    1
    Hello!
    can i use this assets generate scattered clouds?I see the picture is the sea of clouds.
    thanks
     
  20. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Yes, you can create one or more layers of scattered clouds. The asset includes two demo scenes for the videos below (check the readme in each scene folder for setting them up):



     
    Last edited: Mar 9, 2018
    wetcircuit likes this.
  21. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    The latest beta on our support forum fixes this and also add support for multiple cameras - it will be submitted soon to the Asset Store.
     
    jashan likes this.
  22. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Great!
     
  23. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Hi,
    I like to test Volumetric Fog & Mist before I buy it, is there a demo version to download?
    Thx
     
  24. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hi Nexus, there’s no public demo for latest versions but feel free to contact us by pm and we’ll arrange something.
    Cheers
     
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    We've set up Dynamic Fog as an LOD for Volumentric Fog (as you suggested a few months ago). Now we want the fog to move with the current wind direction (set in WindZone) -- we see how to do that with VF but not with DF -- is that possible to do?
     
  26. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hi gecko,

    Yes, it's just there in Dynamic Fog's inspector:



    (Those options are not available in all effects though)
     
  27. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    Not sure what I'm doing wrong. using Unity2017 import volumetric fog and mist and import demos. None of them work. First error is Horizontal and vertical axis inputs not set up. Done that then get lots of script missing errors which I clear by importing all the unity standard assets. Now it's error free but in all the demos I can't move the character around.
     
  28. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Yes, that’s what the README file says: the demo scenes require you to import Characters, Environment and Camera packages from the Standard Assets first, then import the demo package. As per Asset Store policy, assets are not allowed to include a copy of the Standard Assets to avoid conflicts so they need to be imported manually (just for the demos).

    Regarding the input issues, make sure you have the input names spelled correctly, should be Horizontal, not horizontal, Vertical, etc. https://answers.unity.com/questions/325483/error-input-axis-not-set-up.html
    https://docs.unity3d.com/Manual/class-InputManager.html

    Demos should run straightforward with a standard setup for PC/Mac, try switching your platform to PC if you have it set to mobile or try it again in an empty project.
     
  29. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I'm having an issue with Volumetric Fog & Mist and Tunnel FX 2. I noticed that some of the Tunnel FX 2 files were in my Volumetric Fog & Mist folder, which obviously can cause disaster when updating just one of the packages.

    Now, I deleted both, imported Tunnel FX 2 first, and then Volumetric Fog & Mist. Look what I get:

    PackageMessup.PNG
    I have already tried copying Tunnel FX 2 into another folder with the same name but what seems to be the problem is that the Resources has the same ID in the two different packages, and also Scripts. I hope it's not also the folders below that. Well, it is: Shaders and Textures are causing the same issue.

    Can you fix that on your end? This takes a lot of time, and I'll have to go through the whole procedure each time I do an update. Different packages should have different folder-IDs.
     
  30. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Sure, thanks for the heads up on this issue. I’ll send you an update for Tunnel FX 2 and submit the fix.
     
  31. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    This one is lovely. Never thought Volumetric Fog & Mist could be used in performances like this one - thanks Matthew Bain for sharing it!

     
    Julinoleum and Hitch42 like this.
  32. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hi all,

    Version 9.2 has been submitted with some fixes and minor improvements.

    Also had the opportunity to give it a try along with Cascade, works great!









     
  33. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Hello,

    is volumetric light effect supported by VF&M random google pic ? Does VF&M work with spot lights?
     
  34. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Sun shadows are supported (directional light).







    Spot light is not supported - only directional and point lights.



     
    Last edited: May 7, 2018
  35. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Thank you for your answer, I have few more questions:
    1. What are the limitations of VF&M? Can I have an access to the documentation?
    1a. Does VF&M work with semi-transparent objects like windows?
    2. Spotlights are not supported and won't ever be, maybe they'll be supported in the future but You don't know when or you are currently working on them?
     
  36. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    I've sent you a pm with some additional details. Spotlights may be supported in the future but no ETA yet.
     
  37. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Hi all,

    Just a quick question on how profiles are used in this asset:

    I was assuming the fog script contains mostly functions and all parameters are driven by profiles, but it doesn't seem to be the case? Downsampling for example isn't saved when I try to apply it.

    I sort of understand why (decouple fog style from fog behavior), but having ScriptableObject to drive all parameters makes tuning them much easier, especially in play mode.

    Unity 2018 does have Presets (which is less powerful than scriptableobject, as they can't be linked, only save and load), but Presets behave weirdly when I tried them on the main fog controller (losing parameters; throw errors when I change parameters etc.), probably due to how this script is written and how new preset API is.

    Anyway, if possible, I would recommend going full ScriptableObject route, and leave the controller script as pure as they can be :)

    Thx!
     
  38. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Thanks for the suggestion. You're right indeed - most settings contained in the ScriptableObjects are considered "safe" settings for the fog style and match the hard-coded legacy presets. Additional options like point light or light scattering are not stored in the profiles but in each fog instance itself. So, yes, additional parameters can be added to the profile although the concern here is how it can affect existing setups.
     
  39. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Yeah, I think the most backward compatible approach might be to create a second profile like "fog controller settings", and offload these non-style-related parameters to it.

    By the way, normally having some parameters on script wouldn't be much of an issue, but Unity 2018 has this bug:



    I can only reproduce it on the fog controller, initially I suspect it's because of heavy operations, so UI thread is being throttled. But I have already set downsampling to 8 times, the actual cost during play mode is less than 1ms, so I don't quite understand where this "jumpy" UI bug is coming from.
     
  40. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Thanks for reporting this - it's an inspector bug indeed. Fixed now and sent an update by pm. If anyone else is affected by this issue, please get in touch or download the beta from the support forum.
     
  41. fatality674

    fatality674

    Joined:
    Nov 1, 2012
    Posts:
    24
    Does this asset work with UWS water system (formerly Playway)? Cheers.
     
  42. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Yes, as reported by some customers it works. You may need to play with the image effect script order though. If you find any issue, don't hesitate to send me a pm or email.
     
    fatality674 likes this.
  43. mirts

    mirts

    Joined:
    Dec 26, 2012
    Posts:
    32
    Hi There

    I need to use 2 layered cameras with different Depths to render a weapon always on top of all other geometry. I'm in deferred mode so I can't use a shader level trick for this.

    Now I want the VolumetricFog to affect both cameras, so the weapon doesn't stand out in an ugly way. The problem is, if I put the VolumetricFog script on both cameras, the fog gets doubled and super thick. I can't put the fog only on the top camera with higher depth, as it doesn't render nicely with Depth only clear.

    Can I achieve the effect I want with VolumetricFog?
     
  44. fatality674

    fatality674

    Joined:
    Nov 1, 2012
    Posts:
    24
    I have already bought it and it worked seamlessly! Seems like a great asset and has simplified our fog hugely (came from DeepSky Haze (Deprecated now!))

    One thing I'm looking to do with it is to control the view distance using the fog. For example, if I have an object 1000 meters from the camera, and I set a visibility value to 1000 meters, I should just be about able to make it out. Is there any control like that with the asset or shall I just write my own controller? It's to do with simulation if that helps.

    Cheers!
     
  45. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    hey, thanks for your words :)

    Currently there's no feature to deactivate or hide objects further than the max distance factor. Is it what you want to achieve? But you could "wipe them out" using the Sky Haze option, basically adjusting the far clip camera and Depth parameter so the object gets totally occluded by the sky haze colors:

     
  46. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    There're two options here:

    a) Add Volumetric Fog & Mist only to the higher depth camera (the weapon camera) and enable Compute Depth option with Scope set to everything.


    b) Add Volumetric Fog & Mist to both cameras and set Distance / Distance Max accordingly.
    For instance, the weapon camera could have a Distance 0 and Distance Max 1 or 2. And the scene camera could have a Distance of 2 and the Distance Max you wish.

    Also for your weapon camera you could use Dynamic Fog & Mist instead if you want to give it a subtle fog cover as this variant is faster. Use Desktop Fog Plus + Sky Haze with Sky Haze set to 0 and adjust the distances and alpha.
     
    chelnok likes this.
  47. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hi all,

    Version 9.2.1 is now available which includes the following changes/fixes (with respect to 9.1):

    Changes:
    - Added downsampling options to profile scriptable object
    - Added fallOff parameter to fog void areas with box shape
    - Design changes to editor inspector
    - Dynamic Fog & Mist updated to version 6 (Unity 2017.2+)
    - Increased range for noise sparse to 2

    Fixes:
    - [Fix] Fixed inspector UI refresh issue when using profiles Version 9.2 changes:
    - [Fix] Fixed "Copy Sun Color" bug
    - [Fix] Some settings in inspector could not be changed just after setting a new legacy preset
    - [Fix] Fixed texture binding warning on Metal
    - [Fix] Fixed fog area inspector bug
     
  48. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hi, I really enjoy Beautify, but am having problems with this one.

    Issue 1: With some many configuration settings, I'm trying to create my own presets, and I believe this is done by creating Profiles. The problem is, the profiles don't seem to contain all the settings. For example, if I click on my profiles, "Fog Void" isn't part of it. If I configure "Fog Void", it seems to be a global setting that affects all profiles, and I don't see why it would work this way. I'd like to adjust the Fog Void differently for each profile.

    Issue 2: Previously saved Profiles all stop working entirely after a stopping and starting the project. I had 3 profiles that (other than issue #1) worked 30 minutes ago, and now all 3 show a "The associated script can not be loaded. Please fix any compile errors and assign a valid script" message in the Inspector when I click on the file in the project window.

    Issue 3: I'm having a lot of problems setting values using the sliders. So when I slide the Density settings, the slider control jumps around between it's previous settings, and the value I'm trying to set to. It's as if while I'm adjusting, something else is attempting to also set the slider position. Super annoying. Also, I'm seeing really weird things like I can't always turn Fog animation off. I'll set Fog animation setting to zero, then I'll adjust the density, and it will turn Fog Animation back to .15. Also super annoying.

    Also, once I have these profiles saved, can you show me how to set to one of these via code? I'm not sure how to access the saved profile files from code in order to set it in game at run time.
     
    Last edited: May 12, 2018
  49. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Agreed. Profiles usually contained just style attributes (geometry, colors, animations, sky haze...), but not behaviour related. This is changing so in new versions "behaviour" settings are coming to profiles with a custom "override" checkbox so it does not break any current setup, so fog void parameters will be included in the profiles.

    Are you using latest version? It fixes an recent bug with some sliders and the presets.
     
  50. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hi, right after posting, I saw that you posted an update Yesterday. I just bought the asset 2 days ago, so figured I had the latest version. I have ran the update, which I'm sure fixed the slider issue.

    If the profiles don't save all the settings, I guess I'm wondering what use they are. Since they aren't working anyway, I suppose I'll instead just need to set the variables via code. Everything can be set via code correct?

    Can you give me an ETA on the new version that will include Fog Void in the profiles?