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

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    135
    Hello,

    I am considering purchasing this asset for my project, but I have a specific use case, and I need to clarify that this will work.

    I am in a similar position to "Susihiisi", who posted a few pages back. They asked about rotating the fog/clouds to make them work on a large spherical planet.

    I am not expecting the asset to cover such a huge area, what I would like to do is to create a fog/clouds volume surrounding the player as the stand on the planet, then move than fog area as the player moves.

    In order to achieve this, I need to be able to rotate the fog/clouds volume to align with an arbitrary up vector, ie, the player will not be always facing along the y-axis, their up vector will be changing as they move around the planet.

    I will also need to be able to move the fog volume as the player moves around the planet.

    Is this possible with this resource?

    Thanks.
     
  2. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Nope, sorry. The fog volume is AABB aligned and can’t rotate around the planet.
     
  3. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    135
    Thank you!
     
    Thrawn75 likes this.
  4. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    568
    Just wondering if it might be possible that if the camera can't see through the mist/fog that the density will allow dynamic occlusion culling assets to work - basically it would trick the camera into thinking the fog is a solid object and therefore anything behind it would naturally have its rendering disabled by the occlusion culling system/
     
  5. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    The fog is a post-process image effect, there's really nothing in the scene that could hint other assets that something is occluded by the fog. Either accommodate the camera far clip plane or perhaps you could parent a quad to the camera and push it at some distance with same color than distance fog.
     
  6. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,015
    I'm trying to reduce keywords (with your excellent Shader Control tool!) to get under the 256 limit. On Volumetric Fog, we're not using any Point Lights, but there are 6 keywords for them -- is it safe to prune them?

    Also, I'm not sure if I"m using the various Sprite Fog shaders...how can I tell?
     
  7. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Yes, you can remove those 6 keywords although in latest version they’re no more, just one keyword for point lights feature.
    The Sprite fog shaders are only used with sprite materials. If you have not assigned the sprite material to any sprite renderer then yes you can safely remove them as well ;)
     
    gecko likes this.
  8. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    45
    @Thrawn75 Hi I just purchased this product and loving it so far!

    Having issues getting it to work with Steam VR at the moment though. I've seen all the posts about others asking about it and gone over your responses there but it's still not working.

    My projects Stero Rendering Mode is set to Single Pass
    I have verified that SPSR is enabled at the bottom of my volumetric inspector

    Maybe I am putting the volumetric script on the wrong camera? I am putting it on the "Camera (eye)" which is also where I put my Post Processing effects (which do work).

    Any ideas?
     

    Attached Files:

  9. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    That's correct and should work out of the box that way. Are you getting wrong rendering or nothing at all? Which Unity version are you using?
     
  10. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    45
    @Thrawn75

    No fog is being rendered at all, and it causes this weird double screen rendering when I hit play. Capture.PNG
     
  11. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Try the demo scenes on your headset. If they work (should), try disabling other PostFX on your camera (for testing purposes). If problem persists let me know which VR device and Unity version are you using. Thanks.
     
  12. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    292
    Hello,

    How can I have a very thick fog on the bottom of the island and a very small density as you climb the mountains? Also I notice artifacts at the edges of the terrain (AA is enabled)
     
  13. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi,
    You can set the baseline height at the bottom of the island and increase the height to match the peak. Experiment with noise options.
    Another option is to add a fog area and make it surround the player changing its values according to the position or height (this gives you more control).
    Regarding the artifacts you see on the terrain edge, could you please send a screenshot by email?
    Thanks
     
  14. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    292
    You can see the black lines on the edges, maybe anti aliasing is off? Im testing in another scene and setting it from the settings but im not sure in that case, if the fog caused the problem or it was there before (wasnt that visible before)

     
    Last edited: Dec 19, 2018
  15. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Try using FXAA or SMAA instead of MSAA.
     
  16. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    292
    My main camera has a check box "Allow MSAA" that was checked, and when I disabled it, the artifacts are gone as far as I can see. How to start using FXAA or SMAA and what are the downsides if I don't?
     
  17. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    FXAA and SMAA are post-processing effects - you can find them in the Post Processing Stack and also here.
     
  18. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    45
    @Thrawn75

    After lots of testing I managed to figure out what the problem was.

    I had moved this plugins folder into another folder so it wasn't at the root anymore. And I guess that makes the single pass stuff not work. The fog was working fine in normal non VR stuff so I didn't think that would be a problem.

    After moving the folder back to root, it started working.

    If you can fix that next update that would be cool. I have too many plugins and ones that require the folder to be at the project root piss me off.
     
  19. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    You should be able to move it to any other folder as long as you force a reimport of the Shaders folder. Since the shaders folder uses some include directives, when you move around the plugin Unity does not refresh the references. A right-click->reimport on the Shaders folder should fix it.
     
  20. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    45
    Ok awesome thanks!

    Another quick question, my fog is rendering in front of some sprites that I have in my scene. Is there a setting to not do that?

    Edit: To clarify, I have the distance up on my fog, but its still showing in front of a sprite that is in front of the fog
     
  21. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Sprites do not write to _CameraDepthBuffer which is read by Volumetric Fog to calculate the fog accumulation between the observer and the sprite. To fix that you need to use a shader that writes to this special texture.

    Try the sprite shader that's included in Resources/Extras folder.

    Also this tool can fix other transparent objects as well.
     
  22. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Another option is to force the fog render before transparent queue, although I guess you have already tried that (the checkbox on top of its inspector).
     
  23. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Merry Christmas to everyone!
    I'm happy to announce Highlight Plus on the Asset Store.



    All new asset for highlighting scene objects! And it's free :)

    Highlight Plus adds outline, glow and see-through effect to any object in your scene.

    Highlight Plus has been designed with platform compatibility and performance in mind. It's compatible with Mac, Windows, Android, iOS, WebGL and VR (Single and Multi-Pass).
    It's also compatible with Standard and Lightweight Rendering Pipeline (LWRP).

    Web demo

    Visual Features:
    ✓ Glow color, width, alpha, animation speed, dithering.
    ✓ Outline color, alpha and width.
    ✓ Overlay color, alpha and animation speed.
    ✓ See-Through effect intensity, tint color and alpha.

    Other Features:
    ✓ Preview effect in Editor (no need to go into play mode).
    ✓ Can affect selective objects or run in automatic mode with layer option.
    ✓ Event system to fine-control automatic mode.
    ✓ Works with normal and skinned meshes.



    Get Highlight Plus on the Asset Store!
     
  24. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
  25. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    95
    @Thrawn75

    This is a response to a conversation we're having in the Kronnect forum regarding the setup of empty fog areas using the SetFogOfWarAlpha function:

    Unfortunately your forum won't let me post a reply in the topic I created anymore - check out your post logs to see how many times I tried!

    Anyway, the restore duration value is already set to 0 on the component, and this is working as the area for the sphere object remains clear.

    Can you post the code for your cube for me to compare with mine:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using VolumetricFogAndMist;
    5.  
    6. public class VFM_BuildingVoidArea : MonoBehaviour {
    7.     // Use this for initialization
    8.     void Start () {
    9.         StartCoroutine(SetFogOfWarAreaWhenPlayerReady());
    10.     }
    11.  
    12.     private IEnumerator SetFogOfWarAreaWhenPlayerReady()
    13.     {
    14.         while (VolumetricFogAndMist.VolumetricFog.instance == null)
    15.         {
    16.             yield return null;
    17.         }
    18.  
    19.         if (gameObject.name == "Cube")
    20.         {
    21.             Bounds buildingBounds = new Bounds(transform.position, transform.localScale);
    22.             //Bounds buildingBounds = GetComponent<Renderer>().bounds;
    23.             VolumetricFog.instance.SetFogOfWarAlpha(buildingBounds, 0f, 0f);
    24.  
    25.             Debug.Log(gameObject.name + " [" + buildingBounds.ToString() + "] VFM fog of war area set.");
    26.         }
    27.         else // "Sphere"
    28.         {
    29.             VolumetricFog.instance.SetFogOfWarAlpha(transform.position, transform.localScale.x, 0f);
    30.  
    31.             Debug.Log(gameObject.name + " [" + transform.position.ToString() + " - radius:" + transform.localScale.x.ToString() + "] VFM fog of war area set.");
    32.         }
    33.  
    34.         GetComponent<Renderer>().enabled = false;
    35.     }
    36. }
    37.  
    This is with your v9.6zb1 beta (in the FogOfWar demo scene).
     
  26. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi @tntfoz
    The antispam filter is too strict sometimes more if you post code - I'm checking this with the plugin creators. In the meanwhile I've whitelisted your email address so you should have no new issues when posting.
    I have tested your code (thanks for that) with the demo scene. Here's a video:

     
    tntfoz likes this.
  27. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    95
    @Thrawn75

    Haha, those few seconds where you disable the the Demo Fog Of War script are what did the trick!

    As soon as I disabled that the cube started working properly!

    Thanks for your help :D
     
  28. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Yeah, the devil in the details.... glad you got it working now.
     
  29. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    I have just bought the plugin and tried it with Unity 2018.3.0f2. It works in editor but the fog is not working in the build. It looks different from no fog but it doesn't look the same as intended, the sky becomes white, pretty strange.

    No error message. I'm using Vive Pro on PC. I tried to run in editor with Vive Pro and it works.

    Anything to set before build? Thanks.
     
    Last edited: Jan 10, 2019
  30. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hello.
    Between what you see in the GameView and a build, there's no special setup required on Volumetric Fog side.
    Yes, it’s strange you can see the effect correctly in GameView but not in the build.
    I've just checked a new build using demo scene 1 on Oculus DK2 using Single Pass Stereo and it works as expected. Try building the demo scene 1 and/or using Multi-Pass / Single-Pass - make sure you disable non-used shader features (the Shader Options button at the start of Volumetric Fog inspector), you could try disabling Sky Haze.
    Also if you are using other image effects you can try disabling one by one just in case there’s some conflict.
     
    Last edited: Jan 10, 2019
  31. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    I alternated several fog settings and build again, now it works, strange. Thanks anyway.
     
    Thrawn75 likes this.
  32. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    111
    Is there any plans for supporting the spot lights? That would be great feature for this asset.
     
  33. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    I'm afraid that this asset is behaving very strangely in my Unity. I add the script to one of the two cameras. Result:

    Fog everywhere

    However, I only want it in the woods.

    Anyway, I drag a fogboxarea to the woods.

    I now see thick fog in the woods plus fog everywhere.

    I now want to get rid of the fog not in the woods. I tweak a few things (for example setting the fog starting distance of the main camera to 1000). All fog now disappears. Also in the woods.

    Once this is done, I can do whatever I want, tweak whatever I want, reset my components, kill the scripts, redrag them to the camera et cetera, but nothing happens. The fog will not come back anywhere. Trust me: I've tried every slider and button. What does remain is the haze. This stays on no matter what.

    I've also noticed that the scripts constantly jump cameras.

    Reimporting does not help.

    I then kill the entire directory, then reimport, and then rinse and repeat.

    I'd like a step-by-step explanation. I have two cameras: Main and Pegasus.

    I want to see the fog on both cameras, and only in the woods. How do I accomplish this?
     
  34. Thrawn75

    Thrawn75

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

    Follow these 3 steps to create a fog area and make it visible through your two cameras.

    For simplicity make sure one of your cameras is tagged "Main Camera".

    1) Create a fog area (Right Click -> Create Other -> Volumetric Fog Area (Sphere):


    Position/scale the fog area using the normal transform properties so they cover the woods area as desired.

    2) When you add a fog area the first time (you can create multiple fog areas), a Volumetric Fog & mist is also added to the camera (so you have two scripts, one attached to the fog area and another to the camera). The script attached to the fog area holds properties specific for that fog area (like colors, animation properties as well as more stuff related to that specific fog area) but all the rendering is done by the camera script itself.

    Because the camera script can also render fog and since you only want the fog area, make sure this camera script has density = 0 but do not delete it:


    3) Finally to ensure the fog area is visible by the other cameras add a Volumetric Fog & Mist script to any other camera, set its density to 0 and enable the option "Enable Multi Camera":



    Hope this helps.
     
  35. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    That worked! Thank you very much for your insanely fast response.

    Problem was that I assumed I had to add the script manually to the camera, not seeing that it had already been added to the other camera automatically (which was accidentally set to Main Camera too - that is my mistake).

    I recommend to implement the above explanation in the manual, as it's not very clear at this moment.

    It's working exactly as I want now. Thanks a lot!
     
  36. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Will do.
    Cheers
     
  37. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    115
    @Thrawn75 - when I have dynamic fog enabled I can see the outline of my terrains through my water plane (both Lux and Aquas). Is there a way to prevent this?

    Thanks.
    dynamic_fog1.png dynamic_fog2.png
     
  38. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi,
    I’m checking with Lars better integration with Lux Water for Volumetric Fog & Mist.
    Using Volumetric you could add a transparent plane covering the entire subsurface and add this plane to a custom layer telling Volumetric Fog to compute depth on this layer. That will make a smooth transition.
    Using Dynamic Fog & Mist not sure what the workaround is. Maybe adding an opaque plane with a proper color.
    Reason is both assets use depth to compute fog accumulation. If there’s a gap between adjacent positions in depth it can expose some difference which is what you see (apparently - I’m out of office so I cannot check your screenshots with clarity but that should be the reason).
     
  39. jekifow

    jekifow

    Joined:
    Jan 27, 2019
    Posts:
    3
    Hey, I just got this plugin and it's well suited to my needs and is quite awesome. I was wondering though why upon hitting play the settings reset to the saved fog profile asset. Wouldn't it be better if it persists but if you want to reuse the profile across several cameras/projects then you need to save to asset?
     
  40. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Probably you’re right - let me check this behaviour and I’ll get back to you.
     
  41. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    Hi, How do I get this to work for 2d?
     
  42. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    To make it compatible with orthographic camera go to Volumetric Fog & Mist inspector, click on Shader Options button at top and scroll down until you find the Enable Orthographic Camera checkbox.
     
  43. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    Ok Thanks, but how do I make the fog not cover the entire camera?
     
  44. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Use the Fog Geometry settings like baseline and height properties.
     
  45. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    is there a way to place the fog were you want it in 2d? I can only
    see how to change the fog covering the entire scene.
     
  46. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    You can place fog areas in the scene (right click in hierarchy and select Create / Other / ...). Use the GameView to place and size the fog area.
    When you say 2D, you mean a sprite based scene with something like parallax scrolling? Because the asset works with depth buffer and that kind of setup is not depth-friendly.
    The orthographic support is meant for orthographic camera on a 3D world (a scene with depth).
     
  47. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    So the asset doesn't work with a sprite based scene?
    including the dynamic fog and mist asset.
     
  48. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    It can but you need to use the sprite materials including in the Extras folder. Those sprites shaders are compatible with the _CameraDepthTexture generated by Unity and used by the asset to compute depth.
    Check out the Elephant sprite in demo scene 1.
     
  49. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    Ok, Thanks for the reply!
     
  50. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    Hi, can I have your email address for a refund?