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
    Sometimes the server takes some time to update the link. Try again.
    Thanks for your detailed feedback. I see clearly what's different in those groups: Depth-Aware upsampling :)
    Group A: disabled Group B: enabled. Check if that's the problem.

    Did you suggested me to do volumetric noise? :D That was long ago! hehe. Thanks for that!

    btw, it has already been accepted :) Finally! Someone worked until late in san francisco to review this :)
    https://www.assetstore.unity3d.com/en/#!/content/81802
     
    Last edited: Mar 17, 2017
    No0B25, tapawafo, elbows and 5 others like this.
  2. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    223
    Awesome job. :)
     
  3. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    Hi, minor request. In our project, to avoid the root directory getting cluttered, we move 3rd party assets into a subdirectory. When I do this with Volume Fog, it starts logging out errors, as it seems to have some directories hard-coded. I think they were minor (something to do with themes?), but it'd be nice if it worked correctly regardless of where in the project the Volume Fog directory was loctated. :)
     
  4. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Thanks. It has cost me blood, sweat and tears, but that it has been worth every single second. It has been 5 months working 15-18 h/day
    Gotcha!
     
    MitchC, nuverian, tapawafo and 2 others like this.
  5. huodianyan

    huodianyan

    Joined:
    Apr 21, 2015
    Posts:
    16
    where is the VR showroom demo? I couldn't found it in the asset and the extension package.
    I can't optimize the showroom example to 90 fps in Vive.
    Pls help me, thx.
     
  6. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    VR Showroom is not included yet. This will be a separate package. I have to talk with VRTK author, since I used his stuff.
    Do you want me to provide you a super light version of the Showroom?
    Thanks!
     
  7. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay, this is done. You can now move the root folder wherever you want. I shall share it by email
     
  8. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I am at my day job right now and just tried 3.1.2 on a completely different sort of mac.

    The problem still existed on this machine and unfortunately disabling Edge-aware upscale didnt make any difference.

    But I just discovered that disabling Scene Collision tickbox in the renderer section of Fog Volume Gameobject seems to fix the problem!

    I dont think I can take credit for that, I was just going on about making clouds curve away over the horizon.
     
  9. huodianyan

    huodianyan

    Joined:
    Apr 21, 2015
    Posts:
    16
    I have downloaded all the demo scenes and gone through with the Showroom demo, could you pls give me the VR version without VRTK asset? and I will import it by myself.

    thx a lot.
     
  10. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Scooped it up! gonna try all the things.
     
  11. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Humm, interesting. I will check the collision part to see if I find something not of the liking of gl.
    Humm, okay, gimme some time to prepare it.
     
    elbows likes this.
  12. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Hello David,
    Can we have a windows build of your demos to check performance?
    I love volumetric effects and I have purchased some of them in the past but they are all too expensive to use for real world projects. My target is mid tier PC and PS4, so performance is there but on a budget.
     
  13. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    2017-03-17_13-13-59.jpg

    Link
     
  14. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    So I added a fog renderer component to my vr rig (Vive/SteamVR) and threw it into some demos to replace the existing camera. It kinda works in VR, the nebula demo does not seem to work and the cloud demos have weird horizon artifacting. Seems like there are some settings that don't play friendly and others work fine out of the box, maybe? Performance is pretty tanked, I'd really have to dig in to make this optimized enough to be plausible in vr.
     

    Attached Files:

  15. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    That is the camera far clip.

    Trying to run NON-VR demos in stereo? Humm.... its not that easy.
    @huodianyan
    I have uploaded the VR Showroom demo content and updated the documentation
    2017-03-17_13-44-23.jpg

    Study it before trying VR
     
  16. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    A bit more info:

    Most of the scenes that dont render for me unless I disable Scene Collision do work in the downloadable built demo - would be interesting to know whether Scene Collision was on when you built these scenes. Trying to rule out any Unity version issues!

    The 'screen is black apart from fps counter' issue that wetcircuit reported for the mac build of the demo with the Morning scene seems to be due to an issue with the Temporal AA option in the Fog Volume Renderer. If I build the scene myself with this option switched off then I dont get a black screen anymore.
     
    wetcircuit likes this.
  17. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi David

    Firstly could you please send me a code to be able to get the version from the unity assset store now that it has been released as I bought it from your own store.

    Also I think you might have a bug in how your collision layers are setup for fog volume. If you have an object with a riggedbody and then apply a fog volume to the scene it goes nuts untill you go into you change how your fog volume layers colide. I would have though as default you wouldn't want your fog volume to collide with all layers only ones related to the fog.

    This might also be what is causing issues for elbows with the black screen. It sounds to be like the camera is detecting a collison and is therefore not rendering anything to a buffer as it thinks it is inside something or perhaps the cameras minimum draw distance is set shorter on a mac by default.

    I am guessing if you change the fog volume layers to only collide as default with other fog volume layers rather than all layers that issue will be fixed.

    Thank's

    Ian
     
  18. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay, that's good info. I got the machine specs from my mate:
    He built the Mac demo with that one
    ^B1BD98ECF1A631A8300750ADFF40E793A6CC1D6C34777DBF6A^pimgpsh_fullsize_distr.jpg
     
    elbows likes this.
  19. huodianyan

    huodianyan

    Joined:
    Apr 21, 2015
    Posts:
    16
    Thx a lot, I have run the VR showroom with SteamVR 1.2.1 and VRTK 3.0.1.

    Everything is ok in the editor, but it is not ok when I build the standalone version, the cloud is not show when Downsampling is bigger than 0, and the fps is not good as in your build.

    Is there some other environment setup such as lightmap etc.?

    wish to get your help.
     
  20. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Did you do this?
    2017-03-17_16-58-51.jpg
     
  21. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    OK I have been messing around with FogVolumeFragment.cginc to learn more about the collider problem.

    After establishing that if _COLLISION is true, the value of Contact is changed to something other than 1, I went to each place that Contact is used in the file and modified them one at a time to assume 1 instead of value of contact. It only worked if I did this to all of them, so I guess the problem is with the value of Contact when collision is on, not how any part of the code uses the value of Contact.

    So then I became interested in what value Contact is being set to at different iterations of the ray step loop. Leaving all of the other functions set to ignore Contact value and use 1 instead, I started to play with the code line ' if (Contact < .01)break;'

    I changed it to if (Contact > 0.0001)break; No fog is visible

    I changed it to if (Contact > 0.0002) break; Now I get fog rendered in the middle of the gameview but depending on my aspect ratio it does not extend to the sides of the display. An example screenshot is attached.

    Hopefully this gives you some clue about the sort of values Contact is ending up as on my system when Collision is enabled!

    0point0002.png
     
  22. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    @elbows
    Humm, and you said that everything is fine when Downsampling ==0?
     
  23. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Yes. If Downsampling is set to 0 then fog is visible. And if downsampling is not 0, and scene collision is disabled, fog is visible.
     
  24. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Humm, sounds like the Depth buffer is not done. Do this: open "Landscape Shadows" and find the object RT Viewer in the hierarchy and make it visible. Play and get close to the ground. You should see 4 miniatures like this when everything goes fine:
    2017-03-17_20-48-11.jpg
     
  25. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I have to change a little bit of code to see anything in the depth minature. Because I know from testing on windows that the depth minature will be black if I disable downsampling or turn off scene collision. And if I dont turn one of those off I get nothing rendering on the mac.

    So, I took a fresh copy of FogVolumeFragment.cginc and the only change I made was to comment out the line that sets Contact to a value if collision is enabled. Now I can test the scene as requested without just getting a black depth minature. I can see the gaps in the sky clouds in the depth texture. But I cannot see any dark regions representing terrain on my mac (when I try on windows it is like your screenshot, I see dark mountains).

    Depth.png
     
  26. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    First 2 are shadow maps. We want to check the last one. Third one is opacity, which looks correct in your image. 4th is Depth, this is what we need to test. When we set Downsampling to 0, the camera script does basically nothing. Those 2 minuatures will be null (black). In this case, the volume shader is going to use _CameraDepthTexture.
    If >0 this script will render the thing offscreen and will generate a different DepthTexture for the Volume, created by Depth.shader.
    From what I see in your image my custom depth texture is not being generated. Go to that shader and make it to return 1.
    It should look like this:
    2017-03-17_22-48-35.jpg
    And btw, activating or deactivating Collision in the volumes shouldn't change the result of the miniatures
     
  27. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    If I make Depth.shader return 1 instead of linearized_depth then yes, the 4th minature shows like your image, black sky and white ground.
     
  28. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay, getting closer. And how does the viewport look? Same than mine?
     
  29. huodianyan

    huodianyan

    Joined:
    Apr 21, 2015
    Posts:
    16
    Yes, I have uncommented the two files.

    In editor it is ok, but in standalone build it is like these.
    filehelper_1489811440872_16.png filehelper_1489811446717_56.png

    I think maybe I have change some parameter with the FogVolumn behaviour.
     
  30. huodianyan

    huodianyan

    Joined:
    Apr 21, 2015
    Posts:
    16
    I think maybe the projectsetings is different, could you pls provide the projectsettings also?

    My environments is Win10 64 & Unity5.5.1.

    I have build non-VR version, it is ok when Dwonsampling is not 0, but in VR mode I can not see the cloud? but I can see the reflection and the shadow on the glass and terrain.
     
    Last edited: Mar 18, 2017
  31. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Documentation, Slide 31 has them.
     
  32. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    There's a bad prefab or something in the Demo Scenes package provided in the link in the Fog Volume 3 asset. If you import Demo Scenes after the main Fog Volume 3 asset, it makes all the scenes, including scenes like Scotland that are included in the Demo Scenes, look really dark. If you re-import Fog Volume 3 again, after importing the Demo Scenes, it makes everything the correct brightness again, including Scotland.

    Also, there's lots of low hanging optimization fruit in GetShadowMap() and OnWillRenderObject() in FogVolume.cs. Keywords being toggled and material values being set every frame, even when the values are not changing.
     
    tapawafo likes this.
  33. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,369
    -Does this work with an infinite world setup (including coordinate reset to prevent floating point errors on big position offset)?

    -It would be great if this works correctly with atmospheric scattering.
     
  34. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    No. If I start with a fresh project and the only code I change is for the depth shader to output 1, I still do not see clouds rendered in gameview if Scene Collision is switched on. Same when building the project, not just in editor.

    By the way the zip file on your website for version 3.1.3 does not seem to contain additional download links, just a small unity package, and there are fewer demo scenes in the unity package than there were with previous versions (eg the scene we have been using for this test is not there).

    I have been using various versions of Unity 5.5.2 for all this stuff (including patch releases), and I even tried beta of 5.6. Same when I tried (with obviously far more success!) on Windows. I have tried both Forward and Deferred camera rendering.
     
  35. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Humm, when you import the Demo Scenes, does it try to overwrite Scenes/Post-Processing profiles?
     
  36. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Aha. I am building for android now, because that way I have the same problem, basically: black render targets, both miniatures are black. But its very weird. I modified the miniature to output _CameraDepthTexture, generated by Unity, and I don't see anything on android, just black too.
    I don't have conclusions yet.
    My mate, rendering engineer at dice says :That's not a problem
    The file on my server is the same than what I uploaded to the store. Same content, same everything.
    Its now split in 2:
    • base package (5mb): demo scenes without art
    • Extended (350mb): demo scenes with art
    Link to extended is inside the base.
     
    Last edited: Mar 18, 2017
  37. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Yeah, those are getting overwritten.

    The graphics card itself may not care but the profiler says it's using a not insignificant amount of CPU:



    It looks like Deep Profile was making the keyword toggles look like they had more impact than they do but there's definitely a non-zero impact with all those SetFloat/Vector/Int/etc.

    Still trying to figure out why the frame pacing isn't smooth with lower downscaling, so I'm just trying to trim the fat everywhere. :)
     
  38. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    @Obsurveyor
    Are you doing something special to output that info to the profiler? (SETTERS and KEYWORDS)
     
  39. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Yeah, I'm wrapping the sections of code I'm interested in Profiling.Profiler.BeginSample and Profiling.Profiler.EndSample instead of using Deep Profile to get more targeted profiling data. Those are just the names I gave them.
     
  40. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Okay, I never used that. I've seen it somewhere but never learned about it. Definitely, a must read
     
  41. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Can we draw objects with both the camera and the object within a fog volume? The documentation seems to imply(page 28) that we can but it doesn't work for me. I'm just trying something simple where I turned off camera movement and put a cube in front of the camera in the Venus Atmosphere example but it just shows up as kind of a shadow.
     
  42. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Do you have Collision enabled?
     
  43. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Thanks, that did the trick. For some reason I was thinking Collision had to do with physics but that doesn't make a lot of sense. "Scene Intersection" may be a better name for it though.
     
  44. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Agree. I think it was named like that before
     
  45. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    As Elbows reported earlier, turning on Scene Collisions causes the fog volume to stop rendering altogether on my Mac in Unity 5.5.2.

    I have found no settings where fog volume shows while Scene Collisions is turned on.

    Screen Shot 2017-03-19 at 9.54.27 AM.png Screen Shot 2017-03-19 at 9.54.39 AM.png
     
  46. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Yes, after infinite hours of pain I have some conclusions. All the problems reported are caused by graphic card limitations. I developed this for DX11 (target level 4). Working now in lower level compatibility.
    What is driving me absolutely crazy is the Depth map. Even Unity default _CameraDepthTexture is white or null or whatever when I sample it in some shaders in dx9.
     
  47. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Since I'm on AMD GPUs I will never have dx-anything…. No harm, no foul – but should I go ahead and ask Unity for a refund? At the moment it is a lovely screen-only effect, but not useable if it doesn't interact with scene depth.
     
  48. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    dx-anything. Ok, I won't say dx, I will say target level as it refers to every platform graphics level. Please, be patient. Im putting 15 hours /day on this, I try to do my best.
     
    tapawafo and wetcircuit like this.
  49. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Not complaining. Elbows warned me… :rolleyes:

    But it's just SOOOOOO PREEEEETTTTYYYY :p

    Purple-towers.png
     
  50. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    holy.... Seriously, you guys can't imagine how happy I feel when I see your experiments :)
    btw, I think I have good news about the collision problem. Gimme some time, Im getting closer.
    Cheers
     
    elbows likes this.