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

    jason07

    Joined:
    May 10, 2011
    Posts:
    34
    Hi,

    I recently upgraded the package to version 10.4 from version 9.6.2 and it seems the fog is ignoring the sun even though I assigned it in the inspector. I tried deleting and reimporting the package but that didn't help. I also tried using a different light and unassigning the sun and then assigning it again, but still no luck. Any help you can give is much appreciated! Thanks!
     

    Attached Files:

  2. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Hi @jason07, could you please send me a screenshot of the full inspector settings? Thank you.
     
  3. jason07

    jason07

    Joined:
    May 10, 2011
    Posts:
    34
    Sure, I have attached the settings. Thanks.
     

    Attached Files:

  4. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Since you have "Light Scattering" section fully disabled in Shader Options, fog diffusion is not applied so that can't be the problem. Also you have "Copy Sun Color" disabled so the fog keeps its own color.
    I wonder if it's just a camera order issue between Enviro and Volumetric Fog scripts?
    I just discovered that using downsampling Fog Diffusion is not computed - this has been fixed and it now applies with all downsampling levels. I'll send you an update so you can try the Light Diffusion option under Light Scattering section as well.
     
    Last edited: Jun 30, 2019
  5. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    Hi! is there way to set fog mode to exponential like in unity? i would like to use it with Fog Void Falloff

    upload_2019-8-4_16-3-34.png
     

    Attached Files:

  6. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    To make void falloff follow a curve instead of a linear gradient?
     
  7. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
  8. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Try this: edit VolumetricFog.cginc and insert this line just after the voidDistance calculation:
    Code (CSharp):
    1.             voidDistance *= voidDistance;
    so it reads like this:

    Code (CSharp):
    1. ... #if !defined(FOG_VOID_HEAVY_LOOP)
    2.          #if FOG_VOID_SPHERE
    3.             float3 wpos = fogCeilingCut + adir.xyz * (fogLength/adir.w);
    4.             float voidDistance = distance(_FogVoidPosition, wpos) * _FogVoidData.x;
    5.             voidDistance *= voidDistance;
    6.             voidAlpha *= saturate(lerp(1.0, voidDistance, _FogVoidData.w));
    7. ...
     
  9. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    Thanks it worked! Another question

    i have issue with billboards, fog gets drawn always on top (BETA: V10.1 B1)



    if i turn render before transparency it fixed the first problem but gets another one
     
    Last edited: Aug 4, 2019
  10. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Enable the Compute Depth option and select "Tree Billboards":

     
    NeatWolf likes this.
  11. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    Cool thanks a lot!
     
  12. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Hey. I added two volumetric fog scripts in one camera. One for the sun. The other for the moon. It’s fine for now. I don’t see any error warnings. Might there be a chance that it cause any trouble in the future?
     
  13. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Does this system support Xbox one and PS4? Cause I will publish on both platforms
     
  14. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    It's not a common setup. Usually the camera only takes one script - and that script takes care of all fog areas. Some features may expect that only script is attached to the camera when looking for the main script. But if it currently works for you, then you're fine. It just may break or behave incorrectly for certain features.

    Some users use it on console, yes. However we don't own a console devkit so if you experiment any issue, please send me a pm or contact us and we'll take a look.
     
  15. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Volumetric Fog eat 10 fps of my framerate when I use it with real time day and night UniStorm Weather System. I only use Dynamic Fog now :(
     
  16. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Also the fogs seem to tremble between sky and any object.. it shouldn't happen because Unity default fog is fine. But now performance is a bigger problem
     
  17. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Check out the manual for performance recommendations. In general, Volumetric Fog is quite performant but it depends on how you use it. Also having two scripts attached to the main camera is not optimal. You may need to remove one of them and see how it impacts performance.
     
  18. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Only one script. Performance's still the same.. I will check it
     
  19. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Hey, still don't know why the fog trembles?
     
  20. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    If your world is very large, it can suffer from floating-point precision issues (this is a common problem with any large world). In this case you may try enabling the "Big World AntiFlicker" option in the "Optimization & Quality Settings" section.
     
  21. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Just 1500x1500
     
  22. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    That's quite normal terrain/world size. You should not have any issue. If you can send me a pm with a repro, I'll definitely check it out!
     
  23. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Speaking of floating point issue, from what terrain size it's going to occur?
     
  24. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    My biggest map will be 18000x18000. 1500x1500 that's my fist map
     
  25. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    It depends. Flickering is a general issue due to depth buffer limited precision. The near clip plane greatly determine the amount of flickering you can get from, for example, shadows. A near clip plane below 0.3 will cause shadow flickering beyond just 5km.
    The "Big World AntiFlicker" was introduced to reduce flickering in a scene of 50km due to matrices multiplications in the vertex shader. Just try the option and see if that helps - if not, then the flickering is not related to that.
     
  26. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    So only 18km will not cause much of a problem? I mean other issue other than yours. There's two town in my 18km world. I wonder if there's other issue I might run into. You, as a professional, can you give me some tips?

    -Thank you
     
  27. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    You can search around these forums for tips on managing big terrains/worlds. You could slice your terrain/world in chunks and load/shift them dynamically. Try to keep the action near zero position if possible. As a rule of thumb, don't load what's not needed. Apply distance fog (and disable what's out of view), use LOD and billboards, leverage gpu instancing. Those are usual tricks. Probably you could find better tips in forums from world-building tools.
     
    Sam512 likes this.
  28. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Sam512 likes this.
  29. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Thank you, both of you! Haha just bought the asset
     
    Kronnect and atomicjoe like this.
  30. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    atomicjoe and Kronnect like this.
  31. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
  32. PBJellyGames

    PBJellyGames

    Joined:
    Dec 3, 2017
    Posts:
    1
    Hey guys. I have just purchased your Globe Strategy Bundle and would love to know if this Fog Bundle could be used in some way over the globe scenario. Is this only usable in a Full camera screen situation or could I manipulate it and mask it to only show over the circular section.
     
  33. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Hi! Probably not - the fog asset is designed to render over horizontal terrain. Perhaps if the camera is zooming near the surface of the globe and you manage to have that position rotated and pointing upwards in world space, then yes, you could use a fog volume or the camera script to cover the area.
     
    PBJellyGames likes this.
  34. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    Greetings,
    Nice Asset, recently purchased and started using it. Additionally, Props to your username, Grand Admiral.

    Trying to look at the cloud setup in the demo scenes, but (using Unity 2019.1.14f1) it seems all the 3rd person controllers, simply fall through the terrain/flooring and out of the cloud area, forever. Any thoughts on fixing this? Have disabled gravity on the 3rd person character, moved the mass to 0.1, confirmed terrain has a collider, but the demo still makes the camera falls through the floor and down forever.


    2nd query: Is there a particular scene where we can see an example of super-fluffy clouds, like the video demos show? I know I saw some information about that, but cannot find it at the moment. Hoping to make fluffy clouds, which aren't stretched/flat on a vertical plane. (Trying to eliminate the vert plane look. )

    Thanks!
     
  35. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    Hi,
    Anyone around? ^ - Thanks!
     
  36. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Hi! Apologize for late reply, didn't get or miss the notification for this thread. In the future it's preferable to use the email, our Discord channel or the support forum on kronnect.com.

    Now, regarding the issue with the character controller, this is the first time I see that issue happening. I've just checked the demo scenes of the asset with Unity 2019.2 in an empty project following the given instructions in the README file and it works as expected. 1) Import the Standard Assets 2) Import the demo package. Not sure what the issue could be but it's related to either terrain or something in the character controller itself. Do you see any error in the console? Try using a new project to check the demo scenes (note the character controller, etc. are not part of the asset itself).

    Regarding the cloud shapes, try increasing the noise scale as you increase the fog height. Also the noise sparse slider helps providing some clears and the deep obscurance controls the darkness in them middle. Try not to make a very tall fog layer, instead you could use 2 fog layers to add more variety. You have a shortcut integrated in the Editor to quickly add 2 cloud layers:



    Which creates this:

     
  37. Kolgrima

    Kolgrima

    Joined:
    Feb 2, 2009
    Posts:
    40
    Does this Asset Support LWRP?
     
  38. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    No, but Dynamic Fog & Mist (which is also included in the packege) supports it.

     
  39. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    Any plans to support URP?
     
  40. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    We’re working on it! :)
     
    pixelR and Rich_A like this.
  41. Doomgriever

    Doomgriever

    Joined:
    May 19, 2013
    Posts:
    5
    @Thrawn75

    I'm trying to update the Sky Haze Color at runtime and ran into some issues.
    The color doesn't change in the Game View, but when I select the MainCamera in the Hierarchy it does update (still in the Game View). So only when the camera is selected does the sky haze color update. Is this the intended way? Can I bypass this somehow?

    Using Unity 2019.2.3f1 and Volumetric Fog v 10.5

    Repro:

    1. Create a new Scene with Volumetric Fog component on the MainCamera.

    2. Add this script to the Camera. (below)

    3. De-select the camera

    4. Play (no update in sky color)

    5. Select the camera in the Hierarchy (sky color now updates)

    6. De-select camera agian (no update in sky color)

    Thanks!

    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using VolumetricFogAndMist;
    4.  
    5. public class ChangeFog : MonoBehaviour
    6. {
    7.     private VolumetricFog volFog;
    8.  
    9.     void Start()
    10.     {
    11.         volFog = this.GetComponent<VolumetricFog>();
    12.  
    13.         volFog.skyHaze = 10f;
    14.  
    15.         InvokeRepeating("ChangeSkyCol", 1f, 0.5f);
    16.     }
    17.  
    18.     void ChangeSkyCol()
    19.     {
    20.         volFog.skyColor = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255);
    21.     }
    22. }

    EDIT:

    The problem seems to stem from the fact that in VolumetricFog.cs -> UpdateTexture() doesn't update unless something asks for it (like VolumetricFogInspector.cs -> OnInspectorGUI, that's why it updates when selecting the camera.)

    I solved it for now by making UpdateTexture() public and calling it right after changing the color.
     
    Last edited: Nov 28, 2019
    Kronnect likes this.
  42. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    Posting this support request here, since the kronnect forums server doesn't reply when trying to create a new post.
    I create the new post, then click either preview or post, and it wait for about1 minute, then tells me it didn't receive an http response from the server. A refresh gives the same message.
     
  43. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    Greetings,
    I have a FoxBoxArea prefab providing a thick cloud ceiling for one of my Unity Scenes.
    Attached are the screenshots which show the cloud as I'm flying upwards toward it, but if I angle my view (and only at a certain angle, maybe 45 degrees or so) the cloud disappears and I see the backdrop of the skybox (has wispy clouds drawn into it). All other angles of flying show the cloud, but I'd like to know if I did something wrong, or how to avoid having the cloud disappear when flying at that certain angle.

    Attached is also my settings in the editor for this particular cloud. Noticed that this behaviour occurs both in the editor (play mode) and in a live build.
    Cloud FogBoxArea Settings.png Cloud.jpg No cloud.jpg
     
  44. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Fixed so no need to compute texture again. The fix will be included in next beta.
     
  45. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Fog Areas are also affected by the Max Distance setting in Fog Geometry section (and Camera Far Clip plane). Try increasing the Max Distance just in case. If it's not related, please send me a repro with the camera set position and angle and your volume showing the issue. Thank you.
     
  46. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Oh, I see that you have a Base Height of 250. Set this to 0 and move the volume up 250 (using the usual transform position). The asset culls fog areas based on the volume position and dimensions and in this case it seems the fog is trying to render outside its own volume (volume are defined by the transform position and scale - you can use the Base Height to offset the fog altitud but it should not exceed the volume or will be culled).
     
  47. Doomgriever

    Doomgriever

    Joined:
    May 19, 2013
    Posts:
    5
    Awesome, thanks! :)
     
    Kronnect likes this.
  48. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    Thank-you, this solved the issue. :)
     
    Kronnect likes this.
  49. Antumarin

    Antumarin

    Joined:
    May 21, 2017
    Posts:
    5
    Hello!
    I found an issue while working on very dark VR scene. Any time I have a volumetric fog enabled and as long as it is close to the viewing range of the main camera some sort of scanlines or noise appears in the screen which normally wouldn't be all that distracting but it also causes the scene to lose some of it's darkness (I've been using Fog Area to mark the sections where there should be fog but it seems to be partially ignored) and since the environment is pretty much pitch black it becomes very noticeable, especially while using a headset (tested on Oculus Rift).

    Here's how the scene normally looks (levels of brightness tweaked to make the effect more visible):


    And here's how it looks with a volumetric fog (brightness tweaked, same values as the previous image):


    It's hard to notice on screenshots without tweaking the brightness levels but trust me it's very visible while playing the scene in the headset. I may be doing something wrong since I haven't had much chance to mess around with the plugin's features but everything I tried ends up going nowhere so any help would be appreciated.
     
  50. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    On both camera and fog area scripts, try reducing or disabling Dithering.