Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Fog Volume 3

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

  1. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay. Maybe it was not available in that version
     
  2. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Well, it worked just fine in Unity2017. I guess it had some missing default assets in 5.50b5. Thanks for the help :)
     
  3. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Do you know if there is something for the triggers? I couldn't find anything.
     
  4. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Marvelous! Burn that gpu now :cool:
     
  5. GarretPolk

    GarretPolk

    Joined:
    May 26, 2013
    Posts:
    49
    I'm quite happy with the tech so far. Here's what a couple hours messing around got me. It is pretty much exactly what I wanted in my next game. I will have to improve the performance a bit, probably make the clouds smaller.

     
    SirTwistedStorm and Alverik like this.
  6. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Nice. Are you using the camera script and downsampling?

    And btw, how are you doing fog? Because its being painted after fog volume:
    2017-06-29_11-38-10.jpg
     
  7. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I will check out that fast clouds soon enough but a simple sky isn't the effect I am going for at the moment. The Venus image I uploaded is what I am looking for, like a flythrough in space at if possible 80-100 fps while still looking pretty clean with heaps of dense clouds. It's alright I am sure I will figure something out.

    I wanted to ask if I remember correctly there were some key Unity settings that I skimmed over the documentation for example GPU Instancing or something like that? Where was that setting apparently it made the scene run heaps faster.
     
  8. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    I've been doing some experiments last night. I didn't expect to get such results. Really surprised :D

     
  9. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hi, I'm testing fog volume with Tenkoku Sky
    I found the fog can not be rendered when tenkoku sky is in the scene.
    Can only see the fog volume's boundaries but no fog effect inside the box, like this:
    upload_2017-6-30_0-15-12.png
    Any ideas how to make it work?
     
  10. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Check ztest and order
    2017-06-29_20-29-21.jpg
     
    Harekelas likes this.
  11. GarretPolk

    GarretPolk

    Joined:
    May 26, 2013
    Posts:
    49
    The fog is from the EnviroSky asset. I fixed it by turning the fog into an opaque effect.
    https://forum.unity3d.com/threads/r...nd-weather-system.317986/page-11#post-3067971

    I tried downscaling script but I couldn't keep the bottom of the purple fog from flickering against the terrain. Tried all the settings. I found out that it's the new Unity Temporal Anti-aliasing, if I switch it off or use FXAA the flickering stops. The downscaling does substantially improve performance though.

    I was able to improve the performance quite a bit by reducing the Detail layer Tiling setting, adjusting scaling and rendering intensity, and turning off color management.
     
  12. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Thanks! I'll try it tonight!
    Another question, if I want to use fog volumes on an infinite terrain (procedurally generated), what should I do to avoid players run out of the fog's box? Make it follow the player or some other methods?
     
    Last edited: Jun 30, 2017
  13. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Aha, yeah, it is always about order.
    What TAA? The one from the pp stack? That one works correctly with the camera script. Maybe you had MSAA enabled?
    All of those affect performance, yes. But Color management doesn't.
    Make it big enough or change this parameter in real time (animated or via scripting)
    2017-06-30_10-01-48.jpg
     
  14. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    hmm...maybe I should try to shift my terrains and prefabs to let the player stay in a certain range of world coordinates.
    Thanks for the quick reply! :)
     
  15. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Hey, I tried to change the ZTest settings, it worked!
    But now I got a new issue:
    upload_2017-7-1_0-34-6.png
    the fog is still too bright at night time, is there any way for me to let it change with the directional light?
     
  16. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hey Miranda,

    I am working on a Xbox One game and I would like to test your asset before I buy to be sure that it works. I have an ocean in my game and I have been looking for the kind of light scattering that occurs under water where the water fog is lighter closer to the surface and darker as it gets away from it, and it seems that your asset is a good candidate. Please let me know.

    Regards,
    Carlos
     
  17. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hey how can I enable GPU instancing to improve performance, it's supposed to be a setting on the material but the fog material appears to be greyed out?
     
  18. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    As explained here, Fog Volume is not an atmosphere simulator and it won't change colors with light angle. You have to animate the parameters yourself.
    Fog Volume is used by my client, I will ask them if they have already tested it on xbox one
    That makes no sense. GPU instancing has nothing to do with this.

    Some screenshots from 3.1.10
    2017-07-01_22-20-24.jpg 2017-06-28_20-29-20.jpg 2017-06-28_0-36-55.jpg
     
    Shodan0101, radimoto, Alverik and 4 others like this.
  19. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    What do you mean it makes no sense?
    Here is a video of the GPU instancing feature.



    You are using many particles in the scene right? So it would make sense it would benefit dramatically from instancing.
     
  20. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    This is not related with Fog Volume at all
     
  21. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    This is mesh instancing, useful where the same mesh is drawn many times in a scene. Not useful for fog volume at all!
     
  22. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    What about lots of little identical clouds? :p
     
  23. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Sir. Yes, my client tested it on Xbox One

    And super hot news. It is still in the lab and delaying the next release more than expected, but holy.... volumetric shadows!

    2017-07-06_12-46-10.jpg 2017-07-06_12-42-20.jpg
     
  24. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
  25. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    601
  26. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Volumetric shadows in the Scene view is quite hot :)
    2017-07-06_16-54-37.jpg
     
    SirTwistedStorm and tapawafo like this.
  27. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    This looks great! but do you mean that it is not ready yet? Also, my game is underwater. could this be used for godrays and light scattering underwater? That would be awesome!

    Regards,
    Carlos
     
  28. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    It is still early for public release. It works fantastic but it has to be a one clic option. This would be awesome for underwater!
     
  29. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Wow, that looks seriously incredible! It's amazing how versatile this asset is. How's the performance, if I may ask?
     
  30. Radius

    Radius

    Joined:
    May 11, 2013
    Posts:
    51
    Hi I just purchased Fog Volume 3 and am having an issue, getting a constant spam in the editor of these issues.
    I have tried setting everything to one layer in your example scenes, still the same issue.
    Using Unity 5.5.0f3
    Thanks for any help or suggestions here on the fix, as it is currently unusable for me.

    DrawMesh layer has to be from in [0..31] range!
    UnityEngine.Graphics:DrawMesh(Mesh, Vector3, Quaternion, Material, Int32, Camera, Int32, MaterialPropertyBlock, Boolean, Boolean, Boolean)
    FogVolume:RenderSurrogate() (at Assets/FogVolume/Scripts/FogVolume.cs:1322)
    FogVolume:Update() (at Assets/FogVolume/Scripts/FogVolume.cs:1293)

    A game object can only be in one layer. The layer needs to be in the range [0...31]
    UnityEngine.GameObject:set_layer(Int32)
    FogVolume:MoveToLayer() (at Assets/FogVolume/Scripts/FogVolume.cs:657)
    FogVolume:Update() (at Assets/FogVolume/Scripts/FogVolume.cs:1290)
     
  31. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Well, it is scalable. We can choose resolution and skip frames. It is just a render with shader, anything else.
    Check these

    2017-07-06_22-59-41.jpg 2017-07-06_22-59-59.jpg

    @Radius. Check if you have layer slots available
     
    tapawafo likes this.
  32. Radius

    Radius

    Joined:
    May 11, 2013
    Posts:
    51
    Thanks David, I do not have any slots available, however I could move some things around, how many slots will I need to clear?
    (EDIT = 4 layers, that was quite a bit to shuffle around but it's working now, thanks)
     
    Last edited: Jul 7, 2017
  33. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Great! These four, yes
    2017-07-07_0-35-35.jpg

    And thanks for purchasing :) Cheers and have fun
     
  34. Radius

    Radius

    Joined:
    May 11, 2013
    Posts:
    51
    Will do:) having a blast already and only a few hours in, so many great options to play with, love it! Thanks again.
     
    DavidMiranda likes this.
  35. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    When you said skip frames can you explain where that setting is? Usually there would be a checkbox that says render every 2nd frame which if it is there would save a LOT of performance!
     
  36. Lasse-Loepfe

    Lasse-Loepfe

    Joined:
    Mar 28, 2014
    Posts:
    29
    Hi,
    clouds look very nice, however I get some serious performance issues in VR (10x slowdown). The Pillar scene, for instance, would take about 2ms vs 23ms to render, being VR suport enabled or disables, repectively.
    Anything I could do about that?
    Best
    Lasse
     

    Attached Files:

  37. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    I made a slider. Another thing that we can do if the project allows us to do this, is just to render once on start. One photo and boom, baked volumetric shadows.

    @Lasse-Loepfe
    Wow, the difference is huge. The provided scenes are not light enough for vr. Noise + VR don't like each other :)
    I wanted to test it but for some reason, Unity doesn't want today. Video

    Thanks for purchasing, guys!
     
    tapawafo likes this.
  38. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi David.

    I am interested with this asset but I would like to ask few things first.

    1. I understand that this works within some bound region. Which is fine, but if I attach it with the camera and move the camera around, what exactly does happen? Does the content (rendered fog) moves with camera as if there are bounded in the local space or the content seems like they exit in world space? (and creates new ones as the camera moves in about the space) I am asking this because I am guessing that for a performance reason , we don't want to have too large volume bound but then we still want to have illusion of infinite tiling of fog. If you can't understand what I mean let me know I will try to explain more.

    2. I have just seen it that it should work in XboxOne, but what about PS4 ?

    3. Performance on console is probably an issue for me so if I buy the asset and then it seems it looks too heavy for console even after fiddling with controls, can I ask for a refund?

    4. Does it work in deferred mode? Does it render as forward mode? (no matter what base render mode I am )

    5. In your video you got it down from 12ms to 5ms. What spec of hardware were you using?

    6. Is there demo package or trial that I can try first?

    Thank you!
     
  39. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Sure, lets go
    1. Textures are sampled in object space. Size won't affect performance. What compromises performance is the iteration count. More iterations, better quality, that's it.
    2. Dunno, but the PS4 compiler is quite stupid. I had to fix a shader yesterday for my client. It was:
    float3 = lerp(float1, float3, float1)

    That didn't compile. I had to do:
    float3 = lerp(float1.xxx, float3, float1)

    So I will easily get 500000 million errors like that on console :/

    3. Hard to say, because the product is highly scalable and modular. We can run the Uniform Fog type on a weak mobile at 60fps or we can wait 30 seconds to render one image like this
    pillars.jpg

    So I don't know, maybe someone from unity support should say something about the game rules.

    4. Yes, the shader runs in forward in any case, it doesn't matter.

    5. What video? The one showing the optimization slider? I use a gtx970

    6. No, sorry, but you can always play the demo I would need a programmer to build dlls or something, but Im alone :)
    If you have a computer that is equivalent in gpu power to the console, maybe this may help to get an idea of the cost. But as reference, all of the demos shown there takes around 5ms on GPU (average) Some 10 and some others 3 or less.

    2017-07-07_19-07-48.jpg

    And as said, scalable:

    2017-07-07_19-09-42.jpg
     
    Alverik likes this.
  40. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hmm very interesting. I like the idea of being able to render a still effect in the game view, even perhaps using it as a skybox/spherical cage. But what did you mean when you said to bake it once and you then get volumetric shadows? Is that some kind of lightmapping effect or something else entirely because it sounds very interesting.

    Perhaps you mean to run the code once and stop updating it?
    Also in regards to the slider you were talking about, which one was it because there's so many sliders :).
     
    Alverik likes this.
  41. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Hey!
    Yes, that's it
    It is the same concept, or similar to the reflection probes update mode. You can bake once to high quality or you can update it from time to time
    2017-07-08_4-36-23.jpg
     
    SilverStorm, tapawafo and Alverik like this.
  42. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Experiments with cheap real-time and offline supreme quality
    2017-07-08_11-23-20.jpg

    2017-07-08_11-29-06.jpg

    high quality is kinda sick
    2017-07-08_11-32-52.jpg
     
    tapawafo, Lex4art and radimoto like this.
  43. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Nice! So wait, does this mean the offline one will render 1 time in the game view and I can then go into playmode and rotate the camera around it without any impact on performance at all?
     
  44. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    When I said high quality I meant high quality clouds :) and no, they have to be computed per frame.
    For the shadowmap, yes. You bake it once. As far as you are inside of the computed area, you don't need to refresh it. Example: lets say that this is my playable area:
    2017-07-09_12-11-38.jpg

    I will place the shadow camera in position using the provided options that you can see in the inspector. The shadow camera is a sniper hidden in the mountains ready to shoot.
    To see the miniature updating while I put the sniper in place I have the real-time update enabled. But once that the sniper has a good view of the area with the resolution I want I can hit Refresh. So our shadow map is computed just ONCE but it is ready to use no matter where we are. I can walk inside the village without refreshing it.

    What if I want a full animated night-day transition?
    • In this case you have no option, you have to update. This is what happens in the profiler:
    2017-07-09_12-30-10.jpg
    You can also update manually. For example, when we get outside of an interior. You have to access to the public function called Render() and that's all.

    What If I get outside of the baked area?
    • Well, we shouldn't do that :) We may get artifacts. In this example I baked the shadows for the yellow square. But I flied far away from that area:
    2017-07-09_12-34-47.jpg

    No obvious artifacts there but it looks incorrect :)
    One more example. I baked the crane area, a very small portion of the map and we get:

    2017-07-09_12-42-53.jpg
    Okay, now a lot more farther and we see weirs stuff

    2017-07-09_12-44-53.jpg

    So the idea is to bake playable areas
     
  45. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Oh, it was easy to solve the artifact. Just take care of the edges :)
    2017-07-09_14-51-34.jpg
     
    blitzvb and Lex4art like this.
  46. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi,

    is it CPU or GPU based? An another volumetric fog asset drops my FPS from 180 to 50 (nvidia 970) when I attach the directional light to the fog. It has a heavy impact on the CPU. Is this better with your asset? Can I use your asset to hide the terrain border, like in civ5? Masking maybe with a box collider.
     
  47. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Yeah. Volumetrics are expensive by definition. It is like rendering 300 transparent overlapped planes
    Maybe like a fog of war? A programmer can easily tweak it to make that possible. I would add infinite options that people need, but Im already having serious problems with the shader keywords. I have to do something for that. Im thinking on a shader file parser or something like that to generate the shader on the fly using #defines instead of #shader_multi_compile

    btw, I have some candies here, guys. Can't wait to release it :p

    2017-07-10_23-52-17.jpg
     
    tapawafo, mkgame, Shodan0101 and 4 others like this.
  48. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Have you seen my jaw...I dropped it on the floor somewhere...wow!!! Haha ;) cant wait for the next release!!
     
    DavidMiranda likes this.
  49. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    I had nearly no FPS impact with the another volumetric fog solution without attaching the light. It is just an issue with the light. Your fog looks beautiful, but some FPS info without activating the fog and with fog would be awesome. Killing the FPS from 180 to 50 is not an option, that much FPS can be burned better.

    And yes, some kind of fog of war (non transparent, cheap in FPS, must not be affected by light), just for hiding the empty space at the edge of the terrain.
     
  50. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    38
    Hey David, I'm using 3.1.9 on unity 5.5.2f1

    I am excited to use the asset, but found that when I first added my fog-volume, my console would flood with errors.

    I added a defensive check in FindDirectionalLight() that determines whether sun is null before setting the cullingMask. Failure to do this causes other OnEnable code to fail, which meant that I had to set the sun for the fog volume, then reload my entire editor for the fog to work.

    I have lots of lights that are not Directional ( and some that are ) in the scene. I think the templight code was just grabbing a rando light.

    Hope this is useful to you.