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

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Got it, thanks for reply!! :)
     
  2. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Supper happy today. Finally I can say this:
    2017-06-10_21-49-47.jpg
    I switched to a different method, as the previous one was giving me too much headache. Instead of packing both eyes in the same texture, I use 2 now. Didn't find enough examples of the first one to learn from. But for the second method there are some official samples from htc that made this a lot easier to understand.

    The other happy new is that SteamVR is not needed now. I found built-in replacements for all the stuff I needed. So uncommenting code is not part of the process now :)

    Here are my 4 textures:
    2017-06-10_21-50-45.jpg
    3.1.9 will be submitted next monday.

    Yai!
     
    Lex4art, punk, radimoto and 1 other person like this.
  3. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Amazing!

    Does this mean volumes in the scene in VR is now supported? If I read what you said earlier correctly, in VR FV3's functionality was limited to the skybox/background clouds only? (no depth)

    So does this new update enable that?

    (Sorry if I misunderstood. o_O)

    Either way, great work!
     
  4. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    I probably described that scenery as the most safe, but depth was always enabled (optionally) And causing issues here and there too :) In that situation we avoid all the limitations with transparencies and we can optimize a lot. When we have clouds colliding with the scenery and we are close to the clouds, we need to do way too many things to make it behave and look correct. Depth, upscale, high iteration levels... that's too much for vr. The VR showroom is an example of costly setup. IT IS ABSOLUTELY CRAZY :) It has:
    • 2 cloud layers
    • volume shadows
    • 2 realtime reflection probes for glass!!!!
    • stereo depth '-_-
    • edge aware upscale
    That setup is crazy for VR :)
    When we load the other scene we can see that it runs super smooth.
    2017-06-11_11-33-58.jpg
    I did what I recommended. FV is used here to render background clouds. This way we avoid the task of computing depth and perform depth-aware upscale and all of that sh**. Then, a uniform fog volume is used for the lower heights.
    2017-06-11_11-37-26.jpg
    I will refresh all the packages soon.

    btw, edge-aware upscale is not yet applied to the right eye. But honestly, I think that I have to try to do something better for that part. Im not happy with it; edges are still too jaggy.

    This time the problems described in slides 41 and 42 are gone :)
    Lets see it:
    2017-06-11_11-12-36.jpg
    2017-06-11_10-54-10.jpg
    Lets play now:
     
    bgrz likes this.
  5. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Thanks for such a detailed response! :) Definitely understandable that clouds colliding with environment would require too many resources for VR.

    I can't wait to test the new demo - from the screenshot, it looks great. :)

    A couple last questions: just to confirm, your height fog doesn't have any issues with VR, unlike the existing Unity global fog?

    And finally, is it possible to use cloud shadows with this setup?

    Thanks,
    Matt
     
  6. br90218

    br90218

    Joined:
    May 25, 2016
    Posts:
    4
    Help! I have a really serious issue regarding to ztest:
    upload_2017-6-12_12-49-37.png

    As you can see, the tracks and the towers are not being blocked by the clouds, but the player's model is...
    How can I fix this?
     
  7. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Humm... Do you see the elbows? They are in front of the fog. Some objects are in front and some others behind, so I think that this has something to do with objects or materials.
    I would try in first instance to reset the renderer draw order with this script and check the material queue:
    2017-06-12_9-41-38.jpg

    Also, copy some of those meshes to the scene "Fast clouds" and check what happens.
     
  8. BinaryLegend

    BinaryLegend

    Joined:
    Aug 10, 2015
    Posts:
    21
    I am currently having troubles with building my project with FogVolume. I have a single simple scene that builds in about 5 minutes without FogVolume enabled. However, when I enable FogVolume it has so far taken 3+ hours and showing no sign of stopping with UnityShaderCompiler maxing out all the cores on my CPU. I have already gone through FogVolume.shader and commented out over half of the shader_features as I wasn't using them. Is there anything else I can do to speed up build time with FogVolume?
     
  9. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Seems like 3.1.9 is working 100% correct in vr.
    About features, everything remains the same; shadows work in vr too. Check the VR Showroom demo.
    2017-06-12_10-59-59.jpg
     
    tapawafo likes this.
  10. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Humm, Im aware of the problem of having such amount of shader variants. When I modify the shader, it takes longer because the shader variants has to be compiled again.
    There are some things we can do:
    1. #pragma only_renderers your target
    2. Replace #pragma shader_feature and #pragma shader_feature with #define
     
  11. BinaryLegend

    BinaryLegend

    Joined:
    Aug 10, 2015
    Posts:
    21
    How would I use 1? I'd place that pragma in the first Pass in FogVolume.shader with my "target" being Windows 64-bit? What's the syntax like for that?
    So for 2, I'd replace for example #pragma shader_feature _FOG_GRADIENT with #define _FOG_GRADIENT?

    I also forgot to ask, how do I get access the the Unity Store version? I was one of the first to buy Fog Volume 3 from your shop, but I forget to check back there to see if there's been an update, so it'd be easier for me if I could just check my assets directly in Unity.

    EDIT: I figured out how to only target my platform, it was just using #pragma only_renderers d3d11 for me
     
    Last edited: Jun 12, 2017
  12. BinaryLegend

    BinaryLegend

    Joined:
    Aug 10, 2015
    Posts:
    21
    I tried this, and got really strange results.
    The first image is with #define instead of #pragma shader_feature, the other without, and how I expect it to look

     
  13. BinaryLegend

    BinaryLegend

    Joined:
    Aug 10, 2015
    Posts:
    21
    Well, setting the #pragma only_renderers d3d11 and setting all single choice multi_compiles to #define (read in another thread that they are equivalent), and letting it build once for 30 minutes, I am now able to get builds out in 3-4 minutes. However, I still don't see my clouds in the build, that I can see in editor, so I am obviously missing something.
    I've set Hidden/FogVolume, Hidden/FogVolumeBloom, and Hidden/FogVolumeDensityFilter to be "Always Included" in my Graphics Settings. Is there anything else I'm missing?

    EDIT: I added the rest of the scripts form the FogVolume/Resources folder, but that didn't solve my problem either.
    I figured something was wrong with my set up, as it might be a special case. I'm working with VR, so I have my VR player controller with its centerEyeCamera, but I also want a third person view to render to the screen, I call this observerCamera. I set a Fog Volume Renderer on both of these cameras, hoping it would render to both. It does, but only in the editor.
    I tried removing my ObserverCamera, if it did anything weird with FogVolume. Now I can't see the clouds with my VR camera. I've traced it to the Culling Mask of my VR camera being set to NOT include "FogVolume" and "FogVolumeShadowCaster", AND setting "FogVolumeSurrogate" despite me not wanting this. Pausing and then setting them back I can see the clouds. Restarting resets the values to cull the clouds once more. How do I stop this behaviour?
     
    Last edited: Jun 12, 2017
  14. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    I noticed that the Fog Volume ignores Unity gradient lighting. Is this by design? What benefits does this provide over the expected result of the Unity gradient horizon color affecting the clouds?
     
  15. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    It was not taken into account. FV uses its own settings
     
  16. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Are there any benefits to that. A assume most users will be using Unity lighting when using the Unity editor.
     
  17. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    In that case, what should I do if ambient lighting is not based on a gradient? If ambient lighting comes from a cubemap? If ambient light is a color would the FV gradient be flat too? Thus ...advantages, independency and flexibility.
     
  18. BinaryLegend

    BinaryLegend

    Joined:
    Aug 10, 2015
    Posts:
    21
    Please David, what do I have to do to get clouds to render in a build? It works perfectly in the editor!
     
  19. RomBinDaHouse

    RomBinDaHouse

    Joined:
    Mar 18, 2015
    Posts:
    13
    Yeah, RenderSettings.ambientProbe for general case will be cool!
     
    StaffanEk likes this.
  20. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,201
    Can this also be used for volumetric clouds that you can fly through? If so, is there any comparisons with TrueSky which is what I'm currently using?

    Thanks.
     
  21. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Hi,

    small question: Has anyone tested this with GearVR?
     
  22. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Have you played the demo? There are some scenes that may help you to compare.
    About TrueSky, nope, I don't have it.
     
  23. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Hi David,

    Amazing asset!! So happy atm, thank you so much and for all the hard work with recent updates and feedback.

    Quick question: Im looking into purchasing Next-Gen Soft-Shadows and was wondering will it work with your asset?

    Best,

    Jacques
     
  24. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Thanks. Yes, it works perfectly. I used it here
    27-06-2017 12.02.05 x2.jpg

    I love that asset so much. Highly recommended :)
     
    Shodan0101 likes this.
  25. jimburn

    jimburn

    Joined:
    Apr 1, 2017
    Posts:
    64
    Hi David,

    I see that you are giving FPS rates in your videos. But what setup you are using in your video? Please tell me your video card and CPU so that I can scale with mine and determinate how many frame it will hit my game before I buy.
     
  26. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Awesome!!! ;D Thank you so much! The scene looks great!
     
    DavidMiranda likes this.
  27. DCrosby

    DCrosby

    Joined:
    Jan 13, 2013
    Posts:
    86
    I see you're using Transparent Shaders with the car, do they work because the fog is behind them ? I also saw you had Play Way working. Which as I understand it does some different things from Aquas, can you post some setting or examples on how to do water with some ground fog ? This is what I'm struggling with right now, as no amout of tweaking on the water, or fog seem to make it work properly.
     
    Shodan0101 likes this.
  28. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Sure
    2017-06-27_21-13-36.jpg
     
    jimburn likes this.
  29. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Yes. Do you know why playwater works correctly? Because it writes depth, which is what FV needs to collide and fade. Years ago I made water but I wrote it as an opaque shader, so it received shadows, write depth...
    AQUAS is just a transparent shader and does not perform such things. What you have to do is to change the drawing priority depending on your position. If you want to combine FV with aquas, you have to change the order of those elements.
    if(Camera.transform.position.y>WaterLevel)
    AquasRenderer.RenderingOrder (or something similar)=-1
    FogVolume.Order=0
    else
    AquasRenderer.RenderingOrder (or something similar)=0
    FogVolume.Order=-1

    Something like that. That's what I do to sort Fog Volumes.

    Same concept in the scene mock-up
    2017-06-27_21-23-38.jpg

    Exactly
    The glass is rendered on top. If we turn the fog opacity to the max we can see that
    2017-06-27_21-30-52.jpg

    But, since the Fog was originally quite transparent, you won't notice that. All we have to do is to sort it manually
    2017-06-27_21-33-29.jpg

    You can see some of those scripts in the elements of the glass box in the showroom scene.

    btw, I've been doing some changes in the screen/image effect module today.
    off:
    2017-06-27_21-35-45.jpg

    on:
    2017-06-27_21-35-34.jpg

    Looks more similar to what we can see here
    I will make some test with bright elements to see what happens there :p
     
    Lex4art likes this.
  30. GarretPolk

    GarretPolk

    Joined:
    May 26, 2013
    Posts:
    49
    The demo scripts are referencing missing input names :

     
  31. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    It is explained here
     
    Last edited: Jun 28, 2017
  32. GarretPolk

    GarretPolk

    Joined:
    May 26, 2013
    Posts:
    49
    Thanks David. I found the link to the input asset in the docs. I'd rather see the standard input names being used since these are just small demos. It would have saved me some time.

    By the way, your link in the above comment just links back to my comment.
     
  33. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Do you know how to do that? I didn't find the right trigger name, which is what I needed.
    facepalm :)
     
  34. GarretPolk

    GarretPolk

    Joined:
    May 26, 2013
    Posts:
    49
    "Mouse X" and "Mouse Y" are defaults in a new project.
     
  35. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Just bought this during the sale yesterday. It's lagging my editor big time even if I disable the render in scene setting. My guess is it's got a huge memory leak since no other asset has lagged my scene but it can lag during run time.

    Regardless I am getting 2-6 fps on max setting for some of the scenes and am having issues optimizing it to 200fps which is my target goal. How can I do this without it looking like trash?
     
  36. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Hmmm 200fps for scene with volumetric stuff? Sounds unreal from start, even on low settings - such high fps on non-cheap scene is hard to achieve even without volumetrics at all ...
     
  37. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    The 200 fps is for this plugin without any other assets in the scene like characters, physics and so on. I have been able to achieve this with all the plugins I own so far. Many of them including ones like HX Volumetric lighting started at 40 fps in the demo scenes but with some tweaking and disabling of unnecessary components gave me well past the 200 mark without noticeable quality loss.

    So far this plugin doesn't seem to be affected by any of Unity's internal settings like disabling shadows or lights and out of the box it lags the editor bad. So something must be going on. I mean I had higher performance in Sonic Ether's Real Time Global Illumination lol.

    At the end of the day these are a bunch of clouds lol and it's clearly bugging out because it's rendering in the scene view even though I have that setting disabled.
     
    Last edited: Jun 28, 2017
  38. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I'm using Unity 5.5.0b5 and I get this error when I import the asset.
    What's the fix for this?

     
  39. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Saying its just a bunch of clouds is irrelevant to the graphics power that volumetric raymarching demands. Yes there are ways to play with resolution etc to get reasonable performance but this stuff is not a cheap effect at all.

    I've been away from Unity and this asset for a few months so I am a bit rusty in terms of editor performance with this asset but I dont remember bad editor performance - if I find anything that might help you in the coming days I will let you know.

    When discussing performance it is better to talk about ms not fps, and also to discuss it in the context of your hardware - what is the cpu & gpu of your machine?
     
  40. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Eureka I found the right settings!.
    The render in scene button is still bugged but after tweaking it further I am getting about 30 (Density 3) and 50 (Density 5) fps on average.

    I am sure there's more little bits and pieces to go through to get it past 100....I am doing these tests in the Venus Atmosphere demo and it looks darn amazing. Just gotta keep digging....

    I need to know however if this plugin is more CPU or GPU oriented?
    My Cpu is an I7 but my GPU is from 2013.

    I have to congratulate the author this tech is absolutely remarkable!
    Venus Space.png

    Image: Fly through of the Venus Atmosphere.
     
    Last edited: Jun 28, 2017
  41. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Well, not exactly bugged. It just updates when Game view is active. I have solved that 5 minutes ago.
    Some scenes are super expensive, and others are super cheap. Have you seen the "Fast clouds" one?
    2017-06-28_20-59-44.jpg
    Here is the scene attached, I worked on it today.
    GPU is the key. I work with a gtx970

    Thanks!
     

    Attached Files:

  42. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Do you have stereo enabled and a non stereo camera running? That case would cause that problem
     
  43. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I'm not sure where to check for stereo option but these errors come default when I open the sample scenes in the asset. Also the scene gives pink material errors and the scripts don't seem to work.

     
  44. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Here:
    2017-06-28_21-21-54.jpg
    2017-06-28_21-20-51.jpg

    Everything will compile once we get rid of that problem
     
  45. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I have those settings though. Also wouldn't that mean I can't use this asset with VR ?

     
  46. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    In some cases we can make it quite cheap.
    2017-06-28_21-26-15.jpg
    Here is the exe
     
    Lex4art likes this.
  47. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    VR is fully supported, don't worry for that. But there is something weird in your project related with VR. Try something to discard Fog Volume as the source of the problem. Delete it and install this. I bet it will point you to the same error.
     
  48. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Yep. TemporalReprojection.cs and VelocityBuffer.cs gives errors in that temporal-master project too.
     
  49. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay, that's good. At least for me and Playdead :)
    _camera.stereoActiveEye is native, its not coming from any script, but from UnityEngine.VR I think. It should be there, in the API. For some reason, your project cant find or load it. Really strange. I work on a relatively old version, 5.5.0f2. Are you using an older one?
     
  50. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I'm using 5.5.0b5 on my work laptop. But I have Unity2017 installed somewhere else, I can try on that if its compatible.