Search Unity

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. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    2,316
    hmm this patch release is screwing up a number of things. God I wish they would get their act together. Playway water transparency is wrong now. My occlusion shader is transparency is off by a huge margin also. Looks like they messed with stuff again without saying anything. I mean come on how hard is it to know if you screw with stuff like that and not tell people, it's not a good thing in a patch release.
     
  2. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Thanks for the heads up.
    You’re right - things should keep working between patches as they should just fix issues and not introduce new ones.
    I’ll check this out and contact Unity for further details. In the meanwhile please submit a bug report as they prioritize bugs in latest version.
     
  3. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @snacktime just checked with Unity 2017.1.1p2 and didn't find any issue using Volumetric Fog & Mist in a new project.
    Do you have any special setup? Or it might be an import issue - try reimporting the shaders folder of both assets: Volumetric and Playway Water.
     
  4. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    2,316
    Hmm I'll try that but I got the same behavior on a build also, which I'm pretty sure recompiles all the shaders. Maybe it's something else like amplify color or something that's causing it.
     
  5. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    2,316
    I re installed p2, this time not using an existing folder (I usually install patch releases to the original release folder just to save space). And it's fine now. So it could be the same folder being an issue, maybe there is some cached stuff there and it was using something from the previous release, or it could have just been a bad install where it didn't recompile stuff. But I'm thinking it's the former because a build was giving me the same issues.
     
    Thrawn75 likes this.
  6. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Gosh, well, glad you sorted it :)
     
  7. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    304
    I've been debating between this and Fog Volume 3. My goal is to create clouds around an existing environment - the idea is the edges of the game world is a waterfall into a bunch of clouds below.

    One of my concerns with Fog Volume 3 is I heard it takes a toll on performance (and it only has 4 stars compared to the 5 stars of this asset). Has anyone done a comparison?
     
  8. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    After upgrading to Unity 2017.2, I´m getting this error messages with your plugin:

    Code (CSharp):
    1. Shader error in 'VolumetricFogAndMist/VolumetricFog': maximum temp register index exceeded at /Program Files/Unity_2017.2.0f3/Editor/Data/CGIncludes/UnityCG.cginc(596) (on d3d9)
    2.  
    3. Compiling Fragment program with FOG_OF_WAR_ON FOG_AREA_BOX FOG_HAZE_ON FOG_BLUR_ON FOG_POINT_LIGHT5 FOG_SUN_SHADOWS_ON FOG_TRANSPARENCY_BLEND_PASS FOG_COMPUTE_DEPTH
    4. 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
     
  9. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @BonsaTech some features are not supported on DX9 due to shader complexity - just remove DX9 from the platform support leaving DX11 (in PlayerSettings uncheck Windows Automatic Graphics API and remove DirectX 9 from the list).
     
  10. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    Particles seem to fade out just by rendering on top of a fog volume. When rendered on top of something else poking out of the fog volume, they render fine. Here's an example screenshot, with additive sparks coming out of a severed zombie robot hand only rendering correctly in front of the zombie: https://imgur.com/5hLj3UB

    As these sparks need to be clearly visible, is there any way around this fading?
     
  11. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    That can happen if Volumetric Fog & Mist is set to render after transparent objects because particles do not write to zbuffer hence they get clipped when no near geometry behind them. Try enabling the Render before transparent objects plus transparency blend. Make sure Volumetric Fog & Mist scripts are first in the camera stack (if you use other effects, for transparency blend to work properly, it needs to run before any other image effect).
     
  12. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
  13. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Cool! Thanks for sharing the footage.
     
  14. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    I duplicated the object with the volumetric fog area (with area topology set to box) from that previous gif, set the new volume's topology to sphere, and moved it elsewhere. Now, I notice that with any more than one volume active at a time, crazy banding occurs everywhere, even places very far from the fog area. It doesn't matter which is enabled and which is disabled; as long as two are enabled at once, the banding occurs.

    Here's an example screenshot taken far from the fog areas (one enabled on top, two enabled on bottom): https://imgur.com/a/GJoy2

    Any way to fix that?
     
  15. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @OhiraKyou try the following: 1) enable dithering, 2) increase density, 3) increase stepping. If none of those helps reducing banding, please send me a copy of the scene just with the two volumes as you have them configured.
     
  16. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    First, shouldn't there be no banding at all if I'm nowhere near a fog volume, though? This is the difference between where the fog is and where that screenshot was taken: https://imgur.com/y9ErXJM Surely fog shouldn't have any affect that far away and with that much stuff occluding it.

    And, second, this occurs specifically when there are two volumes enabled, no matter where they are or where the camera is in the scene. The banding is global. I'm not willing to accept simply reducing banding for fog that shouldn't be visible to begin with.
     
  17. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @OhiraKyou I see. Apologize for the confusion, the banding artifacts are commonly found when using a very low number of samples along with low frecuency fog (dark colors or edges around volumes). Version 8.1 will improve it (beta already available on kronnnect.com).

    Said that, the global banding issue you refer is weird - and you're right - both the scripts and the shaders automatically cull the fog rendering if the pixels are not within area range - whatever it's I can't reproduce it using an empty scene with several fog areas and some random geometry. If there's no fog around the camera, I'm not sure what can be causing that without a repro. Please try the following steps:
    1) Select your camera and make sure Density parameter is set to zero. Each fog area has its own set of parameters - the options of the script attached to the camera are for a non-area based fog - hence if you have a very low density there, it could be causing that effect around the camera.
    2) What build platform do you have enabled (Mac / PC / WebGL..) ?

    Cheers
     
    Last edited: Nov 2, 2017
  18. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    The density on the camera is zero. Target platform is set to Windows x86 in build settings, although this is happening in-editor.

    On an unrelated note while I debug this, I noticed a very strange design decision in the volumetric fog script. Because the player traverses scenes in my game, the main camera isn't necessarily in the scene from the start. So, I disable the volumetric fog script by default and enable it via script after assigning fogRenderer (to prevent errors caused by fogRenderer being null while enabled).

    I decided I needed to add some void space around the camera for the ground fog. So, I set the character field (the void's center) from script as well. In doing so, I noticed that the radius of 5 that I had intentionally set was being reset to 20 on setting the character. Upon investigation, the cause was clear. Here's the offending code from VolumetricFog.cs:

    Code (CSharp):
    1. public GameObject character {
    2.    get { return _character; }
    3.    set {
    4.        if (value != _character) {
    5.            _character = value;
    6.            isDirty = true;
    7.          
    8.            // why u do dis?
    9.            if (_fogVoidRadius < 20) {
    10.                fogVoidRadius = 20;
    11.            }
    12.        }
    13.    }
    14. }
    This should be removed. It makes no sense.
     
  19. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    I tracked the banding problem down to multiple fog volumes not playing nice in linear color space (Edit > Project Settings > Player > Color Space). I sent an example project via PM.
     
    Thrawn75 likes this.
  20. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,085
    I'm seeing an issue with using multiple cameras (one at a time): In our game, we have the VR cam, and several 3rd person cams that are rendered to the flatscreen UI (game window on the monitor).

    The components on all of these cameras are set up exactly the same way and I double checked that the settings for VolumetricFog are in fact the same between different instances.

    The issue is: I get the fog in VR, I get the fog in two of our 3rd person cameras, but it doesn't show up in any of the other 3rd person cameras. I can switch the component on/off without any noticeable effect. In a previous attempt (that was still using version 8.0), earlier today, when I activated Transparency/Blend, I could see that the component did have an effect because changing the slider value of Transparency Blend Power did have an effect on the image.

    But no fog.

    The order in which I activate the camera does not seem to have an effect. It's always the same two cams that work, and all other cameras don't work (so, it's three cams that work: the VR cam, and two specific 3rd person cams).

    I noticed that some cameras that were not activated, yet (in a session), have "Fog Renderer" under General Settings. But the cameras that were active seem to not have any differences in their setup, at least as far as I can tell from looking at the inspector.

    Any ideas what might be causing this?
     
  21. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi @jashan,

    VolumetricFog script can be attached to either a Fog Area object or to the camera. When attached to a fog area (eg. the FogBoxArea or FogSphereArea prefabs) it's just a placeholder for the different fog parameters because the real renderer is another VolumetricFog script attached to a camera. In the Fog Areas case, the Fog Renderer property allows you to assign the camera's component that will render that fog area (by default it will try to pick a suitable camera). You can have multiple fog areas in your scene, all using to the same VolumetricFog component in your camera being this one the responsible to render all of them and compose the final fog effect.

    In this case, the Fog Renderer property is showing up in your camera (and should not) because your camera is disabled from start, hence the VolumetricFog component of the camera has not been initialised so it does not know if it's attached to a fog area prefab or to a camera. The inspector is showing this property but you can ignore for any VolumetricFog component attached to a camera. You can check that as soon as you enable the camera the Fog Renderer property disappears.

    Back to the fog issue with multiple cameras, are you using SPSR? If you do, since you are using a multi-camera scheme with VR and non-VR targets you must specify at each camera the SPSR behaviour: enable each camera and set the correct Single Pass Stereo value under Optimization & Quality Settings (this option will only appear if your camera is enabled):



    If you use SPSR, set Force On or Off to each camera accordingly.

    Let me know if that fixes the issue.

    Cheers!
     
  22. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,085
    Ah, yes - this was it!

    I set this to Force On on the VR-cam, and to Force Off on all other cameras. Not it's working as expected.

    Thank you!

    And yeah, the issue with Fog Renderer showing up when it shouldn't gets resolved as soon as one of the cameras is activated / enabled, so it's not an issue.
     
    Thrawn75 likes this.
  23. Master_Indie

    Master_Indie

    Joined:
    Feb 17, 2017
    Posts:
    8
    How do I enable/disable the VolumetricFog component during runtime? I'm just looking for a simple VolumetricFog.enable = false; kind of thing. How do I turn it on and off for graphics options for the player?
     
  24. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    You can access to all Volumetric Fog & Mist properties through the instance static property:

    Code (CSharp):
    1. VolumetricFog.instance.enabled = false;
    Another example:
    Code (CSharp):
    1. using VolumetricFogAndMist;
    2.  
    3. public class FogToggle : MonoBehaviour {
    4.  
    5.    void Update () {
    6.      if (Input.GetKeyDown(KeyCode.F)) {
    7.         VolumetricFog.instance.enabled = !VolumetricFog.instance.enabled;
    8.      }
    9.    }
    10. }
     
  25. Master_Indie

    Master_Indie

    Joined:
    Feb 17, 2017
    Posts:
    8
    Nevermind, I got it. You just have to put setup your script like this:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace VolumetricFogAndMist
    6. {
    7.     public class ToggleComponent : MonoBehaviour
    8.     {
    9.         public VolumetricFog toggle3DClouds;
    10.         public KeyCode keyButton;
    11.  
    12.         // Update is called once per frame
    13.         void Update()
    14.         {
    15.             if (Input.GetKeyDown(keyButton))
    16.             {
    17.                 if (toggle3DClouds)
    18.                 {
    19.                     toggle3DClouds.enabled = !toggle3DClouds.enabled;
    20.                 }
    21.             }
    22.         }
    23.     }
    24. }
    Gotta have that "namespace VolumetricFogAndMist" part before your script recognizes VolumetricFog as an actual component.

    Edit:
    oh, or this:
    Code (CSharp):
    1. using VolumetricFogAndMist;
    2. public class FogToggle : MonoBehaviour {
    3.    void Update () {
    4.      if (Input.GetKeyDown(KeyCode.F)) {
    5.         VolumetricFog.instance.enabled = !VolumetricFog.instance.enabled;
    6.      }
    7.    }
    8. }
    Thank you for the quick reply :)

    edit2:
    looks like adding "using VolumetricFogAndMist;" at the begging of your script fixes everything. Lol I should have realized that :b
     
    Thrawn75 likes this.
  26. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    In 2017.2.0p2 I'm not seeing the fog at all when I enter play mode with Single Pass Stereo on. My project is using the HTC Vive.
     
  27. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Will check this - in the meanwhile try forcing SPSR option at bottom of Volumetric Fog’s inspector.
     
  28. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    I have seen this happen with a number of image effects in Unity 2017.2 when using single pass stereo. Amplify Bloom has the same problem as well as the Unity Post Processing Stack 1.0. If I have single pass stereo on I don't see any bloom, color correction or fog. With multi pass stereo I see all three. The Unity Post Processing Stack 2.0 beta does have the issue fixed so you might be able to figure out what is different by looking at their code.
    https://github.com/Unity-Technologies/PostProcessing/releases

    I have updated to the most recent version of Volumetric Fog & Mist (8.1). Here are my settings currently.



     
    Last edited: Dec 2, 2017
  29. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    Here is what the scene looks like before I enter play mode.


    When in play mode with single pass stereo on.


    And in play mode with multi pass stereo on. (With single pass stereo is set to forced off)
     
  30. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    In another scene from the same project with different fog settings it is working.
    Here are the settings from the scene with working fog.


     
  31. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    Here is what the fog looks like in this scene.
    In the editor


    In play mode
     
  32. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @265lutab I've checked it's working fine with 2017.2.0p2 with SPSR on (tried demo scene 1).
    Maybe PPS is changing the current render target configuration and that is affecting Volumetric Fog in some way so if no PPS is used or it's used after Volumetric Fog camera scripts it works.

    Please try the following:

    1) Disable Unity's PPS scripts on the camera and see if it works. If that's the cause, try moving Volumetric Fog & Mist scripts before PPS on the camera stack.

    2) If problem persists, try Volumetric Fog & Mist demo scene 1 with SPS and let me know if it works.
     
  33. el-RERS

    el-RERS

    Joined:
    Jul 12, 2014
    Posts:
    9
    Hi, I just bought this asset. It's working well in the editor but can't build my game because I get a TON of errors. I'm using Unity 2017.2.0p2 Personal. These are the build options checked:

    build options.jpg


    These are the errors:

    errores dx9 1.jpg

    errores dx9 2.jpg

    errores dx9 3.jpg


    I read around here that it may be a problem when building with DX9 so I unchecked it in the Player settings but I'm still unable to build because I get these errors:

    dx11.jpg

    https://imgur.com/wEwHaHf

    https://imgur.com/fvP2biM

    I'll greatly appreciate your support so i can give it a 5 star review.
     
  34. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @el-RERS DX9 should be removed yes. However those are import errors which should be fixed reimporting the folder.
    1) Are you using Dynamic Fog & Mist? If not, you can save a bit of time and space removing that folder from VolumetricFog’s “extra” folder.
    2) Look for the Shaders folder inside VolumetricFog folder, right click and select Reimport. Then try again.
    Thanks!
     
  35. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi everyone,

    We have a new beta available on our support forum which supports Single Pass Instanced introduced in Unity 2017.2. If you're doing VR please check it out!

    Regards.
     
  36. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    Thank you. I don't see it on the forum. Do I need to do something to get access to it?
     
    Last edited: Dec 12, 2017
  37. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    311
    Hi,

    Thanks for the continued updates.

    I've recently implemented depth testing for transparent aircraft canopies as indicated, and with downsampling the aliasing around the edges is very noticeable. Would it be possible to run these depth-masked edges through the Improve Edges algorithm as per other objects that appear in front of clouds?

    Thank you!
     

    Attached Files:

  38. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    @265lutab right, beta boards are only visible to registered users. Send me a pm with your username and invoice number, thanks!

    @Karearea sure, will take a look into it.
     
  39. TeemuMV

    TeemuMV

    Joined:
    Nov 10, 2017
    Posts:
    19
    Could add a link to this thread to the asset store description. Kind of inconvenient to find currently.
     
    265lutab likes this.
  40. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    That would be useful.
     
  41. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Will include it in next update. Problem with this forum is that some notifications do not reach their destinations (ie if you don't open the notification mail / link it won't notify you again if there're more messages). So it would be preferable to use our support forum because notifications are reliable and also there's a single thread for every conversation instead of a messy and unclassified thread. But seeing that you appreciate it, I'll put the link into the description with next update.
    Cheers!
     
    265lutab likes this.
  42. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    150
    You could put a link to both and say for a faster response use the support forum, but it would be good to have them both be there.
     
    chelnok and Thrawn75 like this.
  43. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Will do.
     
  44. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hey there,

    Volumetric Fog & Mist 8.2 Release Candidate is available on our support forum. It will be submitted in a few days. For those wanting to give it a try sooner, you can download it from the private board provided you have access (send me a pm with your invoice number to request a download link if you wish).

    Here's the change log:

    - VR: support for Single Pass Instanced (Unity 2017.2.0+)
    With this addition, Volumetric Fog & Mist should now support Multi-Pass, Single Pass Stereo and Single Pass Instanced (tested with Oculus DK2).

    - Point Lights: new "Distance To" or pivot which specifies the reference for distance calculation (good for fog areas + point lights)
    Each fog area supports up to 6 point lights. Using this new option you can make each instance to use the nearest lights to their centers effectively allowing multiple fog areas with multiple point lights each.

    - For of war: optimized setting/restoring fog transparency functions
    Functions that modified the internal data for this feature have been overhauled and improved. Basically they are 100x faster now and you will notice it if you call them many times in a frame.

    - Fog Areas: new option to show the area extents in the Scene View (as Gizmos)
    Now it's easier to handle fog areas in Scene View since you will be able to see the boundaries (they are only rendered in Game View though).

    - Editor: fog of war settings are now visible in inspector (were hidden if this feature was disabled)
    Some fog of war features were not easy to catch since they were hidden until you enabled the fog of war toggle. Now they're visible so you know what's under that section.

    - Dynamic Fog & Mist package updated to version 5.1
    Dynamic Fog & Mist has been updated as well supporting Single Pass Instanced, wind direction and support for Timeline animation.

    I take the opportunity to thank you for using Volumetric Fog & Mist and wish you an awesome 2018.

    Cheers
     
  45. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,015
    I'm setting up Volumetric Fog with point lights in a scene, but at runtime, when I walk towards/away from the lights, they fluctuate greatly in intensity. I've tried tweaking the optimization settings but can't find a way to prevent. Something similar happens in the demo scene, though nowhere near as obvious. Any suggestions?
     
  46. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi @gecko, try reducing significantly the Multiplier factor under each point light slot.
     
  47. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,015
    Intensity Multiplier was 1, I've reduced it to .5, no help. Also, there's a lot of banding on the walls around the point light (even when I disable the actual light on those point lights, so it's only the fog effect).

    Video here: http://www.eduweb-labs.net/PointLight.mp4

    No better with intensity reduced to .2
     
  48. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Strange effect - seems related to the noise. Will check it.
     
  49. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Testing the revamped point light rendering in Volumetric Fog & Mist 9:



    The new update comes with two new options: global intensity (does not change the light intensity itself, but the influence of that light on the fog) and in-scattering (controls the "distance" of the influence of the point lights on the fog - can be thought as a radius multiplier but allows you to spread the light across the fog without changing the radius of the point light):



    Note: youtube and iMovie compression artifacts may show up in the video.
     
    Akshara likes this.
  50. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,015
    This patch fixes the problem completely -- looks fantastic, thanks much!
     
    Thrawn75 likes this.