Search Unity

Fog Volume 3

Discussion in 'Assets and Asset Store' started by DavidMiranda, Jan 30, 2014.

  1. yvesartanim

    yvesartanim

    Joined:
    Oct 4, 2018
    Posts:
    2
    Hello!

    Thanks for your great plug-in.

    I'm trying to fix a problem with FogVolume and downscaling in our project where the transparency is broken as soon as we turn on downscaling in the FogVolume Renderer. I saw that the problem can be prevented by turning off HDR (which is not an option in our project). Since we have performance problems, turning on downscaling would be be very useful.

    You can see the problem in the following screenshot where the black should be transparent:

    upload_2022-4-13_13-34-46.png

    This is how background should be (instead of black):

    upload_2022-4-13_13-44-50.png


    We are on Unity 2020.3.17 (legacy 3D engine). Any idea ?

    Thanks!
     
  2. aoigai

    aoigai

    Joined:
    May 28, 2017
    Posts:
    3
    Do you plan to release a version of this asset that is compatible with URP?
    Or are you planning to sell it as another asset?
     
  3. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    I like this asset so much, goes well with music tracks I make, sample:
     
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    Agreed! And great track! Did you sculpt that space with primitives?
     
    khos likes this.
  5. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Thanks :)
    For info: Track was made using only Figure and Beatmaker 3 App for IOS on Ipad (that in itself is so cool! that it is even possible), I played around with one of the Fog Volume sample scene parameters to get the colours and details etc. I still want to explore so much with Fog Volume, like different earth bound clouds etc. I wonder what else is possible!
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    Did your GPU lift off?
     
  7. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Hi, not really (I have a 1060 so not that good), you can set the quality of the asset which helps a lot :)
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    I noticed some slicing, which setting did you tweak to get such sharp edges at decent framerate?
     
  9. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    I think the slicing is minimal, I'll have to dig up the project and remember which options it was, I think there is a quality setting, cannot remember exactly now. Another trick I have been thinking of is screen record the scene that is on a very high quality level, moving very slowly, then make a video of that but playing x2 speed, could be interesting. The other option is to buy a HUGE GPU :)
     
    laurentlavigne likes this.
  10. lxy_dean

    lxy_dean

    Joined:
    Sep 13, 2018
    Posts:
    2
    Hello, I have a problem, as shown in the figure under unity 2021.3.10, and FV cannot operate normally 飞书20220921-203703.jpg
     
  11. damarcstudio

    damarcstudio

    Joined:
    Nov 7, 2021
    Posts:
    1
    Does it work only with camera ? I bought it but I can't use camera in my work so, it just doesn't work ? :(
     
  12. SuperPoopsy

    SuperPoopsy

    Joined:
    Jan 20, 2020
    Posts:
    17
    Something broke in 2022.2: the asset will work correctly in editor/play mode, however it won't be displayed in build.
    I tested on a fresh install/empty project, building demo scenes and got the same result.
    The scenes are built correctly (no errors)
    It used to work just fine till 2022.1.24 (the latest version before official 2022.2 released)

    Any clue how to fix it?
     
  13. Avedis

    Avedis

    Joined:
    Jan 12, 2013
    Posts:
    24
    First of all, I love this asset! Making cool volumetric nebulas is so easy and awesome looking! I noticed in the readme that since Unity 2019 VR no longer works...I would like to test this in some newer VR headsets, any timeline when VR will work again?
     
  14. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    Hola David,

    I'm having issues with terrain draw instanced. I don't understand how I need to change render order of fog volume 3, so that the fog properly appears behind terrain, and not always on top.

    Is it something I need to change with terrain materials, don't they write a?

    Thanks for any help!
     
  15. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Last version tested was 2021.2.14
    Testing now 2022.2 and yes, it is broken '-_-
    No errors, no logs, no clue. I've spent a few hours debugging and fixing minor (new) errors, throwing debug messages to the log file but all the checks I've done outputs a correct result. I think that critical data is not being sent to the material. Some values work (color, light direction...), but shader variants seems that are not being activated, although my tests say that they are enabled.
    No shader keyword works in the build, all I get is a flat uniform fog.

    Code (CSharp):
    1.  if (FogMaterial)
    2.             {
    3.                 if (EnableGradient && Gradient != null)
    4.                     FogMaterial.EnableKeyword("_FOG_GRADIENT");
    5.                 else
    6.                     FogMaterial.DisableKeyword("_FOG_GRADIENT");
    7.  
    8.                 Debug.Log("_FOG_GRADIENT " + FogMaterial.IsKeywordEnabled("_FOG_GRADIENT"));
    Output in Player.log: _FOG_GRADIENT True o_O

    I guess I'll keep trying some more, but if I can't find the problem, that's it.
     

    Attached Files:

  16. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Well, at 4 in the morning I can say it is solved. It was indeed a problem with the shader keywords. There is a workaround that is already included in the public version. Buggy, but it works. I'm polishing it.
    Scroll down in the inspector to the bottom. And enable "save materials". When it fails, disable and enable again FV object.
    2023-07-14 04_33_10-Clipboard.jpg
    That option will be mandatory from now on, with warnings, and lights flashing to let the user know that this option has to be active before building.

    Side effect: compilation time will improve A LOT.
     
    sirleto and wetcircuit like this.
  17. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay, this is going well. This will be the new method to save the temporal material to disk.



    Saving to disk will ensure that all the required keywords/shader variants are compiled and available in the build.

    Test done and everything working in 2022.2.2f1


    Update will come soon.
     
    Last edited: Jul 14, 2023
    sirleto, wetcircuit and daville like this.
  18. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Created a new style for the buttons
     
  19. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    By mistake, I uploaded the shader with collision disabled. Go to FogVolume.shader, find the keyword _COLLISION and uncomment it.
     
  20. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Added an option to make the gradient affect the ambient color
    6b9e2756c835d45d160a899779e5b0ee.gif
     
    Ruchir likes this.
  21. SuperPoopsy

    SuperPoopsy

    Joined:
    Jan 20, 2020
    Posts:
    17
    DavidMiranda likes this.
  22. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    You can use an additive primitive for that. Instead of just using the whole volume, you can use a custom box with adjustable edge fade.
    Check the scene static volumetric shadows 2 to see an example of that
     
    Last edited: Jul 15, 2023
  23. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Done. 3.4.5 is ready 2023-07-17 22_54_51-Clipboard.jpg
     
    dsilverthorn, khos and sirleto like this.
  24. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    thanks a lot, will check it in 2 weeks!
    but first i need to backport all my little changes and performance improvements first, so i can then patch your latest version with it :-D
     
    DavidMiranda likes this.
  25. Avedis

    Avedis

    Joined:
    Jan 12, 2013
    Posts:
    24
    Hello, I am running Unity 2022.3.5 (I also tested on 2021.3.28) and Fog Volume 3 3.4.5. The fog looks normal in the editor but in the build it's not rendering properly as shown in the screenshots. Any idea what might cause this?
     

    Attached Files:

  26. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Hi,
    The last supported version is 2022.2.2f1. Make sure to use the new feature "Save temporal material".
     
  27. Avedis

    Avedis

    Joined:
    Jan 12, 2013
    Posts:
    24
    Ah Thank you for the video. I had that checked but I didn't have a camera in my scene since I spawn my players so the dialog box wasn't coming up to prompt where to save the material. I just needed to add a camera, save the material and then delete the camera again.

    Thanks!
     
  28. lacas8282

    lacas8282

    Joined:
    Apr 25, 2015
    Posts:
    139
    How to exclude objects, like a house from hdrp volumetric fog?

    And how to follow the fog my terrain?
    Lets say I have a custom terrain that has a sinus on it?
     
    sirleto likes this.
  29. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    You can create a void space inside a textured fog (using noise or gradient) with primitives. Check the scene "Interior primitives". That scene is using additive boxes. For your case use first a large additive box and subtractive primitives inside.

    As for the vertex displacement, it is not supported.
     
  30. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    Any ideas how one would hack this? Use the height map of the terrain, perhaps? How/where to change your code?