Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

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

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

  1. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    I'll review that and get back to you. I guess those changes could be included in nthe upcoming update.
     
  2. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    @HeadTrip it's possible to set the base height below zero. Problem is that inspector clamps the minimum to zero, so you need to modify a couple of lines:

    In VolumetricFog.cs, around lines 151-156, remove the clamping function, so it reads:

    Code (CSharp):
    1. ...
    2.         public float baselineHeight {
    3.             get { return _baselineHeight; }
    4.             set { if (value!=_baselineHeight) { _baselineHeight = value; UpdateMaterialProperties(); isDirty = true; } }
    5.         }
    6. ...
    And in VolumetricFogInspector.cs, same change, around line 119. Change it so it reads:

    Code (CSharp):
    1. ...
    2. _fog.baselineHeight = EditorGUILayout.Slider(_fog.baselineHeight, -500, 1000); // GUILayout.Width(80));
    3. ...
    4.  
    That will set the minimum to -500 in the inspector, reduce if necessary.
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,409
    Strongly considering purchasing imminently. Is there any photos or video that show me what the Time Of Day compatibility offers visually?
     
  4. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    @elbows here's a quick video showing what do they look like together.

    This is Volumetric Fog & Mist and Time of Day just imported on an empty project, added Time of Day to the first demo scene.

    Basically the compatibility has to do with lightning / daylight sync with fog. Just add the Sun game object under the Sky Dome to the Sun field in the Volumetric Fog & Mist inspector.

    I set Time of Day day duration to 1 minute to accelerate the demo:



    You can play with different thresholds for the specular to make the dawn more spectacular...
     
    elbows likes this.
  5. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Thank you!

     
  6. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Hi @Ascensi

    Check out this demo of the point light support in the new beta of V4:


    (This update is already available on kronnect.com for registered customers).

    With this new option, you can create long range gradients and many kind of visual effects. See how the light scatters through that mist!

    Enjoy!
     
    radimoto and elbows like this.
  7. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Does this work with Tenkoku or Skymaster? I see direct support for Time of Day which I don't own.
     
  8. anydayzz

    anydayzz

    Joined:
    Feb 13, 2016
    Posts:
    111
    Is it possible to save and load the fog of war?
     
  9. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    I'll add support for that in next release. In the meanwhile, you could add this to VolumetricFog.cs file to retrieve and set fog of war data:

    Code (CSharp):
    1. public Color32[] fogOfWarTextureData {
    2.             get {
    3.                 return fogOfWarColorBuffer;
    4.             }
    5.             set {
    6.                 fogOfWarEnabled = true;
    7.                 fogOfWarColorBuffer = value;
    8.                 fogOfWarTexture.SetPixels32(fogOfWarColorBuffer);
    9.                 fogOfWarTexture.Apply();
    10.             }
    11.         }
    12.  
     
    anydayzz likes this.
  10. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    I don't own those so I can't confirm but I'd say that as long as they add a Sun game object with correct orientation during the day/light cycle that you can add to Volumetric Fog inspector then yes, it should work.

    Volumetric Fog & Mist takes into account the current orientation of the Sun game object to compute the lightning factors of both fog and sky haze.
     
    radimoto and wolfen231 like this.
  11. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Skymaster Ultimate is insane and I think it does, but I am pretty sure Tenkoku does too. Just afraid to buy a new sky if I have to just for this system (because I think your assett looks cool so far hehe)
     
  12. anydayzz

    anydayzz

    Joined:
    Feb 13, 2016
    Posts:
    111
    Thanks for great reply.
     
  13. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    577
    Is it possible to have a void area of fog using a spline system? this would be great for underwater scenes whereby underwater tubes can have no fog but outside itself is effected only. I've seen a few 3D spline assets that can repeat an object as you draw the line, it would be amazing to use your product in the same way perhaps also having the ability to lock the spline in the center of objects such as a tunnel/tube then set the volume for specific nodes. Actually adjusting the height from snapping to a distance from a collider surface might be easier than programming snap to the middle of hollowed objects.
     
  14. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Teila likes this.
  15. anydayzz

    anydayzz

    Joined:
    Feb 13, 2016
    Posts:
    111
    Cool. I want to buy it but I would like to see the fog of war from a top down perspective first to see how smooth it looks when removing the fog. Thanks.
     
  16. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Fog of War feature is implemented with an alpha mask, which you may set from 1 (fully fog covered with its noise and animations... normal fog visibility indeed) to fully transparent 0. There's a function which yo may call to clear a circle at a given position and radius and it applies a gradient from center to the edge. So the smoothness is quite customizable if you need it.
     
  17. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Void areas in current version are implemented as:
    - Spherical or boxed real 3D area (with customizable width, depth, height, falloff and character follow)
    - Alpha mask (useful for top-down view but not so much from inside the fog).

    We have some ideas to make alpha mask work in 3D but will need some time to make it work with performance in mind as well.
     
  18. anydayzz

    anydayzz

    Joined:
    Feb 13, 2016
    Posts:
    111
    Great. The clearing of the fog seen from 1st person in the fog of war demo is not the smoothest then? The removal of the fog there is a bit too rough to work for me like it removes too large chunks each time.
     
  19. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Yes, the demo could be more refined.

    What it does is call this method:
    Code (CSharp):
    1. SetFogOfWarAlpha(Vector3 worldPosition, float radius, float fogNewAlpha);
    With a radius of 4 and an alpha value of zero. It makes that cell completely clear of fog in one frame.
    You could call this method several times to create a fade out effect.
    And you could also increase the size of the mask texture, so the cell size is smaller and your gradients can be more refined.
     
    anydayzz likes this.
  20. anydayzz

    anydayzz

    Joined:
    Feb 13, 2016
    Posts:
    111
    Thanks for all the help. Looks like a great tool.
     
    Thrawn75 likes this.
  21. 2dgame

    2dgame

    Joined:
    Nov 24, 2014
    Posts:
    83
    Hi,
    I got a couple of questions:

    • Would this work well in conjunction with uSky?

    • I saw in an earlier post that particles are drawn on top of the fog. Is there an option to do it the other way around like you have with the transparency drawing order? I think if the fog was drawn on top of the particles it would look much more realistic.

    • Does the plugin have the capability to define small areas (like a swimming pool) where fog should be on top of not affecting the rest of the scene including areas that may be lower than the pool? I saw that there are void areas, I guess what I'm asking for is the opposite of that.

    Thanks!
     
  22. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Don't own that system but if it adds a game object to the scene that rotates around the terrain acting like the Sun with the correct orientation, then yes, it would work same way as Time of Day. Basically the integration with sky systems consists of syncing the light direction, color and intensity of the Sun with the light properties of the fog. If the sky system does not have a Sun game object but can provide the day time, the calculation could be done in a similar fashion (think of a rotating vector pointing towards the center of the terrain).

    Yes, changing the rendering order (before or after transparent objects) is specified with a toggle in the inspector.

    This will be added in next release, V4, as an enhancement to the void areas. As you suggest, the behaviour is just the inverse of boxed void area.
     
  23. 2dgame

    2dgame

    Joined:
    Nov 24, 2014
    Posts:
    83
    Sorry, what I meant to ask is whether fog can be drawn on top of particles. The video only shows particles on top of the fog.
     
  24. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Yes. Image Effects can be drawn on top of everything (by default) or before transparent queue (where particles are usually rendered). You can choose Volumetric Fog to be rendered on top of particles with this toggle.
     
  25. 2dgame

    2dgame

    Joined:
    Nov 24, 2014
    Posts:
    83
    Thanks for clarification :)
     
  26. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    montyfi likes this.
  27. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    6 point lights:

     
  28. propeller

    propeller

    Joined:
    Jul 2, 2012
    Posts:
    201
    Love your fog system! Looks really great. I have one feature request:

    It would be awesome to control the void area with a greyscale/alpha texture!
    Pretty much like the Fog of war system but instead of using the position of a gameobject
    use the alpha of a texture. This way i could paint a custom void area for my maps.
     
  29. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Well, Fog of war feature works pretty much like you say. You set the alpha channel of the fog of war texture using the function SetFogOfWarAlpha(). In V4 you have direct access to the fog of war texture so you can manipulate it on your own.
     
  30. propeller

    propeller

    Joined:
    Jul 2, 2012
    Posts:
    201
    hmm ok I see, so I would actually have to iterate through my grayscale texture and call the function SetFogOfWarAlpha on every pixel of my painted map? Is this the correct workflow?
     
  31. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Not necessarily. You could just call GetPixels32() on your texture and assign it to fogOfWarTextureData property. This property is available in V4 on kronnect.com (among many other improvements and features) which will be submitted to Asset Store today.
     
  32. propeller

    propeller

    Joined:
    Jul 2, 2012
    Posts:
    201
    perfect! :)
     
  33. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    V4 has just been submitted! :)

    I'd say many of you would like to update :) Why not sign up on kronnect.com and grab the latest fresh version now?
     
  34. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    280
    the question everyone wantts to ask but nobody dares

    can you achieve the "fog/smoke"-effect of the new unity demo?

    hope you have seen it

    best seen it
    1:35


    a literal F***ton of people asked for that effect in chat
     
    Last edited: Mar 15, 2016
    gurayg likes this.
  35. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,409
    I'm not surprised. I've had a fetish for that sort of volumetric fog since I first heard about Bart Wronski's SIGGRAPH 2014 talk that detailed this type of solution. Who wouldn't have, especially as that sort of thing was used by some to hype the 'next gen' of consoles and can be seen in a few other very modern engines.

    It's certainly not a trivial solution to pull off. To simplify considerably I might break what makes that technique look stunning down into a number of areas. Actually being volumetric, the way it responds to lights, the animation and apparent resolution of the fog density. And all manner of detail relating to these (e.g. does it respond to all unity light types, has the density animation been pre-baked or faked in some way, how expensive is the effect).

    Of course I would be more than pleased if an existing volumetric fog asset could incorporate some or all of the techniques shown in this system. But there are numerous good reasons why they may not want to go down that route or be able to, especially before we all have access to the version made by talented unity graphics programmer(s) for that demo, and from whats said on the website that won't be till June at least.
     
  36. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Stay tuned for Volumetric Fog & Mist 4.1.
     
    turboscalpeur likes this.
  37. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Hi!

    Volumetric Fog & Mist 4.1 is ready for download on kronnect.com for all customers!

    It features important changes and improvements with regards to V3.x series and also improves V4.0.
    Please remove existing copy from your project before importing this new update.

    The new update includes light scattering option:

     
    radimoto, elbows and Arganth like this.
  38. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    867
    I 've been working on the game all the day and didn't notice I couldn't pull out a Windows build anymore: it is stuck on the UnityShaderCompiler.exe on all CPUs like, forever. I moved away the VolumetricFog folder and it started building again.
    It did the same yesterday, but for unknown reasons moving in and out the assets fixed the problem.

    I'm a bit lost, do you have any idea about what's going on?

    Here's a screenshot of a WIP for a game jam, featuring the fog.
     

    Attached Files:

    • asd.jpg
      asd.jpg
      File size:
      69.7 KB
      Views:
      522
    Thrawn75 likes this.
  39. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Wow! Lovely scene. Thanks for sharing.

    Are you using 4.1 beta2 from our forum on kronnect.com? One thing you could try is to reimport the folder or even remove some shader features which you are not using in the project. Please check the documentation included for a list of shader keywords you can remove (multicompile pragma options). That should reduce the compiler time.
     
  40. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    280
    god dammit should have gotten that asset while it was on sale :D

    how easy is it to use in indoor scenes? or is it just better or only useable outdoors?
     
  41. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    hi @Arganth
    you have several choices here, from setting a boxed / circular void area inside the building to use fog of war feature or distance fog.
    You also have the option to purchase the asset on kronnect.com with a 10% off.
    Cheers!
     
  42. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Hi all!

    Happy to announce availability of V4.1 with the following changes:

    New Features:
    - New Light scattering option (a.k.a. god rays, sun shafts or volumetric scattering). Demo scene included. Check out this example.
    - Support for Point Light (up to 6 point lights) with auto tracking - another option for creating artistic effects. New Demo Scene. Video demo.
    - Can invert void areas, so fog only appears inside them.
    - Extra: new Sprite materials & shaders (Sprite Fog Diffuse, Sprite Fog Unlit)
    - Extra: includes Dynamic Fog & Mist 1.5

    Improvements:
    - Improved performance
    - Reorganized inspector settings in foldable sections
    - Integrated Dynamic Fog & Mist to avoid issues with shared resources (no more independent .unitypackage but you still can delete it if you don't need it)

    Fixes:
    - Minor fixes and usability improvements across the asset

    Please, remove previous version before importing this new one.
     
  43. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    867
    Hi,
    I stripped some multicompile away from the shader as you suggested and seems to be more performant, thank you.

    I tried to compile for an HTML5 build but failed, so I switched to the old good WebPlayer because I had no time for investigating (the game just needs to work on a browser).

    Just curious: does this work on HTML5? What about Dynamic Fog&Mist?
     
  44. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Yes, there's some strange issue regarding to shader variant creation that prevents Volumetric Fog & Mist run on WebGL for now. We've submitted the bug to Unity.

    Dynamic Fog & Mist works flawlessly on WebGL though.
     
  45. Elbon

    Elbon

    Joined:
    Jul 24, 2013
    Posts:
    8
    What music are you using for your first trailer on the Unity asset store? I absolutely love it!
     
  46. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116

    this is fantastic!!
     
    Thrawn75 likes this.
  47. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Thanks! It's Reaching Higher.
     
  48. turboscalpeur

    turboscalpeur

    Joined:
    Nov 29, 2015
    Posts:
    286
    Tried out yesterday the Volumetric Fog & Mist on my Gaia's Scenes, used the GX Extensions, did some custom tweaks too coupled with Time of Day & some others Assets on Unity 5.3.0.
    Awesome! i must say, if i would build a game one day, the Volumetric Fog & Mist will be sure one of the essential Assets on my list and working within' to create Great Atmospheres and Sceneries; i found the Asset easily tweakable and complete to make a lot of Fogs & Mists Variants, all of this without going too much forwardly in my settings :)
    Some Screens:




     
    Thrawn75 likes this.
  49. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258
    Really amazing panoramas. Your grass is gorgeous btw. Thanks for sharing @turboscalpeur !
     
    turboscalpeur likes this.
  50. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,258