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

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Ztest looks useful. Not sure I understand the different options….

    Screen Shot 2017-04-11 at 9.40.58 AM.png
     
  2. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Yes, very useful when they are in the background. I will document it better when the time comes.
     
    wetcircuit likes this.
  3. Deleted User

    Deleted User

    Guest

    Is there anway to get some kind of fly through clouds , for mobile, open gl 2.0? Android or ios?
    I am willing to sacrifice lighting, other quality settings...to fly through clouds, in my 3 flight sim games.

    Possible?

    P-
     
  4. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    volumetric rendering in opengl 2.0?
     
  5. Deleted User

    Deleted User

    Guest

    Sorry, what do I know?...That I can not have decent clouds in unity mobile.

    Boo.

    P-
     
  6. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    hehe, 2D billboards!
     
  7. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    What are the requirements for using this asset? For example: shader model?, forward or deferred or both?, DX11 only?, etc.
     
  8. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    https://docs.google.com/presentatio...RJCRUcxpALkvUpo/edit#slide=id.g20b3d7cca9_0_0

    SM 3.0 is the minimum requirement. There are limitations in the amount of "modules" you can activate in dx9. If you activate too many features you will get an error of the kind : "maximum register count exceed" or something like that. You will get that error when building too. But its okay, it compiles without any problem.
    Forward or deferred, both are okay.
     
    magique likes this.
  9. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    Thanks for the information. I'm actually fascinated by the space nebula effects in your video and would like to try this on a shmup game for the Wii U. I see it hasn't been tested on Wii U as of yet.
     
  10. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    you welcome
    volumetric nebula on WiiU? hehe... probably way too much ^_^ I searched on wikipedia and it says that its gpu is based on Radeon E6760. Now searching for a comparison table I find this: http://www.videocardbenchmark.net/gpu.php?gpu=Radeon+E6760
    If that is the wii gpu and this info is correct.... no hope :)
     
  11. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,027
    I don't think that's the equivalent of the Wii U GPU, but thanks for your frank evaluation. I assume this asset is heavyweight so in any case it's probably too much for the Wii U.
     
  12. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    well, noise is heavy, but uniform fog is super cheap. Depending what module you activate, cost will vary
     
  13. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    3.1.7 has been uploaded to the store and already available from my site.
    Change log
     
    tapawafo likes this.
  14. cfantauzzo

    cfantauzzo

    Joined:
    Apr 8, 2012
    Posts:
    75
    How well does this work in VR with forward rendering and MSAA in Unity 5.6?
     
  15. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    I just read the entire doc which explains all that and more :D - so the only question I have left is how do god rays work with geometry: goes geometry cast shadow in the fog as well as the clouds do? There is no example showing that.
     
    Last edited: Apr 19, 2017
  16. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    I am currently providing some goodies to a client, Fog Volume integration is among my tasks. The project is VR and my manager says that 3.1.7 is working great on VIVE and Oculus. We run the project in 5.6 with MSAA + hdr. User @elbows reported the same if I remember well. I have not tested myself because my vive cable is broken (waiting for a replacement for several weeks). But that's what they say. Ah, btw, they didn't have to do this It just worked flawlessly o_O
     
    tapawafo likes this.
  17. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    As explained here, nope, only Fog Volumes cast shadows. That is something for the future. Im still in polishing stage and I don't want to add more features until the current features are 100% perfect
     
  18. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    alright, planned for a version 3.x or 4?
    And what does this mean and look like "we are only allowed to cast ‘opacity shadows’ from objects placed on top of the shadow receiver volume."
     
  19. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Yeah, sounds weird, my english... :)
    It looks like this: https://twitter.com/BetaVersionOfMe/status/814910841560645633
    I should maybe remove that info because its not 100% usable. Have you seen the "Interior primitives" scene? Its using this "hack" to get shadows from a mesh.
    2017-04-19_23-06-35.jpg

    I have not paid much attention to this because I don't find it very useful. What we can do is to move any object to the FogVolumeShadowCaster layer but that object won't be correctly culled if we use the camera script.
     
  20. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    Somewhat useful... it's better than nothing and you can get cool shadow from a Death Star overhead ... If I understand what you're showing: only objects outside the volume cast shadow.
    Object casting shadow for real inside cloud will give amazing sense of god ray!
     
    Last edited: Apr 20, 2017
  21. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203

    I play the Nebula demo and think Khaaaaan!
    Do you have an sort of FogRaycast that returns fog density to a target? That'd allow ship AI to navigate a nebula.
     
  22. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    Hi, I just bought your asset. I am using it for VR using Vive. I am on Unity 5.5.0

    It wasn't clear to me from the above thread, doe the asset currently work for single pass renderings? It doesn't seem like it does. Are you currently working on a version that works for single pass rendering for vive?

    Thank you,
     
  23. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    I just bought it and it looks even better in-editor, it's like a one button LOOK AWESOME solution, love that reflection probes "see it" (although there seem to be a glitch)!
    Will experiment further with object shadows but for now have a few questions and bugs to report:

    1. fog volumes move in scene view in ortho as if they had perspective. Repro: open sunset, set scene view to ortho X, pan around, the cloud volumes move
    2. in ortho X, when we zoom out the fog volume fades away
    3. refprobes have edges at the curbe's edges
    4. refprobe luminosity and contrast don't match the volume, seem to ignore sun light
    5. What are the function's costs, from most costly to least is good enough. So far I figured that resolution > self shadowing
    6. does fog volume size impact fps if camera culls a lot of it? (meaning if I have 10x volume size and the camera shows the same amount)
    7. changing detail layer updates in game view but not in scene view
    8. in the sunset demo, the sun directional light cannot be rotated yet the rotator is disabled, solution? FIX: remove point light script I added by mistake
    9. what's the cost of realtime primitive detection?
    10. only primitive is cube, interconnection is a bit harsh, how do I smooth that out? more primitive is my current solution
    11. how expensive are primitives, point lights? -> question about sorted list of function cost
    12. is it possible to have primitive of different density? noise function?
    13. scene view don't seem to show fog depth properly
    14. when pausing, the effect disappears
    15. what's the reason, in sunset demo, for the fog volume shadowcaster?
    16. point light volume script, why does it add a sphere collider trigger?
    17. scene collision gives an accurate z-test with scene geometry but there is a shadowy border, how to fix that?
    18. view modes don't work in 5.6 apparently
    19. why is the root fog volume rotated 90, y axis aligned with world z?
    20. particles and fog don't mix well, cutout better?
    with reflection probes - How do I improve 3d object integration?
    sunset rtype.PNG
    refprobe cube edges
    reflection probe edges.PNG
    geometry blend dark edge
    blend edge.PNG
    particle and fog don't mix
    particle and fog.PNG
     
    Last edited: Apr 20, 2017
    Flurgle likes this.
  24. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    a few more goodies (version 3.17):
    1. bug: reflection probes don't render when inside a volume, only render primitives, probably also not inside the primitive :(
    2. oddity: adding primitive to a volume after having designed the look of the noise changes the look of the noise :(
    3. minor: adding primitive to a volume overrides the volume boundaries without indicating that in the inspector
    4. is the effect HDR? the refprobe doesnt seem to have much range in the bit of cloud that shows
    funky bug with refprobe : they didn't show the volume at all until I added the primitives then deactivated them.
    ref probe oddity.PNG

    tiling goes bonker when i turn on primitives
    primitive bonker the repeat.PNG
     
    Last edited: Apr 20, 2017
  25. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    Capture.JPG Capture2.JPG I took the demo scene landscape shadow and moved the camera up vertically so that the camera is a above the cloud. I want to create a sense of the player flying in between the clouds. I noticed that when the camera moves above a certain height , the top of the clouds get clipped by a line. But if I move under that height, I can see the top of the clouds just fine. Is there some kind of clipping function that is causing this when the camera is above a certain height?

    EDIT: actually i figured out it's the Horizon plane that's dictating the height threshold. But I wanted to ask, what's the purpose of this? If I wanted to fly through the clouds, above and below freely, what should I do? Should I disable this height threshold entirely so it wouldn't be clipped at a particular height?
     
    Last edited: Apr 20, 2017
  26. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    @dhuang
    That scene is not configured to fly above the clouds. Short story: there are 2 volumes, ground fog and clouds. If you want to fly to above the clouds, we have to sort the volumes. That's why I made that script. It uses the camera position and a position threshold to change the draw order. To see an example of this, check the scene "mockup" or "Scotland"
     
  27. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    @laurentlavigne
    Thanks for purchasing and taking the time to write all of that feedback. After 2 fast reads I would say that 90% of your reports are:
    · Explained in the documentation (sphere edges, particle blend, viewmodes)
    · Has a good reason to behave like that (sunset volume rotated 90, surrogate disappearing in pause...)
    · Not related with fog volume (reflection probes edges...)

    I would suggest to spend more time playing and understanding it before writing feedback. Anyways, I will take some time to reply all of them because all info is important. This will also help to improve the documentation, so I will pay more attention to these points and try to explain better.

    Thanks.
     
  28. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I've just purchased Fog Volume and first impression is: Pretty awesome.

    One quick feedback regarding the documentation: I'm trying to view this on Windows 10, with Google Chrome (57.0.2987.133), and loading each page takes a really long time and I'm getting loading errors on a lot of the pages. In the editor view, this works much better - but the asset store link and the Documentation link in the package go to the presentation view and that was really not a pleasant experience to use.

    For the actual issue I'm running into: I need to use this on the Vive, with Single Pass Stereo rendering. I found the setup instructions in the manual and that made it work - almost. There still is one issue: It seems that left and right eye are not rendered from the correct perspective, creating a rather uncomfortable effect. There seems to be a little offset, which at the given distance should not be the case. It's a bit hard to put the finger on it. It could also be due to the comparatively low resolution due to Downscale (and when going to full resolution, even on a 980 Ti, performance is unbearable). In fact, the dithering used by Downscale makes moving the head in VR feel very strange due to the dithering artifacts.

    Further testing and disabling shader keywords which resulted in improved performance so I could try more of the examples without Downscaling revealed that it's almost certainly a problem with stereo vision and dithering (or another issue with what happens when using Downscale != 0). With Downscale == 0, it looks fine in the HMD (except for the stuttering due to lower framerates, of course).

    This is on Unity 5.5.3p1. I also tried 5.6.0f3. This definitely also needs the changes described in the manual (at least when using Single Pass, which I do). You mentioned above that this may not be needed but I think then only Multi Pass will work.

    In the scene "Fast Clouds" I also noticed another issue (this was before removing any keywords in the shader): When using any other value than 0 for downscale, the blue of the Sky turns almost black, and the clouds turn fairly dark blue ... looks kind of like a color inversion (could be a color inversion). this only happens when Downscale is active (i.e. value != 0). None of the other settings in the Fog Volume Renderer seem to have an effect there (Blend Mode does change the colors a bit, but still looks color inverted).

    Deactivating the Game Object "Fog Volume [Mist]" in that scene makes it break also with Downscale = 0 (so when that object is deactivated, it always looks broken as described above).

    The main problem I see at the moment really is that with Downscale == 0, the performance even in an empty scene with nothing else going on is far from acceptable (at least running in the editor, but on a 980 Ti), but when using Downscale, the visual artifacts are too disturbing.
     
  29. CurtisMcGill

    CurtisMcGill

    Joined:
    Aug 7, 2012
    Posts:
    67
    Just picked up the package today and found a lot of errors on input axis.

    I am using oculus rift and how do I move the camera back. When I run any demo, it zooms in close to fog and hard to focus.

    With the visual artifacts, I did turn on rectangular stereo and it improved the quality.

    Your instructions are out dated and unity 5.6 users need to download legacy image effects.
     
  30. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Hi there. The behavior in this scene is 100% correct. Its totally correct that a dark object looks brighter when there is fog in front of it. Regarding Downsampling active or not, I don't see any difference or bug when switching from 0 to !=0


    About the stereo thing. Just one word, PAIN :D
    Im completely blind in this field since I sent my broken cable to the htc support office. It's been already more than 4 weeks waiting. I believe that "Fast Clouds" scene works in 5.6 in vr just because its not using the custom depth buffer, which is causing all the problems. I have not tested because as I said, I can't. But my client is running a similar setup on vive and oculus without the need of doing this
     
  31. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    ExplorationCamera.cs requires a custom Input file as described here. In case you can't do that in your project, disable my camera controller and use another of your liking.
    Well, maybe you should test FV in a clean project?
    2017-04-22_6-16-33.jpg
    Not just 5.6 users, anyone. But this is required only to run some demos, not required at all by Fog Volume itself.
     
  32. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    @laurentlavigne Part 1:
    Added to the documentation: otho perspective is not supported

    I tested both Baked and realtime and I don't see any kind of artifact:
    2017-04-22_6-41-21.jpg

    From what I see here, I don't see any mismatch
    2017-04-22_6-44-27.jpg
    Yes, resolution is definitely the most important in terms of performance. Octaves ==2 has an important impact, self shadows and directional lighting depending on the iteration amount. Lambert shading is also expensive. I didn't find it too useful and its disabled by default just to speed up shader compilation.

    Yes and no. Volume size itself doesn't mean it will be more costly. If you check the "Fast Clouds" demo you will see that the volumes size is huge and the camera far clip too. Costs comes from volume properties.
    Detail layer is drawn according to the distance from the volume pixel to the camera. You have 2 cameras, editor and scene. If the volume is close to the game view camera, you will see detail appearing. If your scene view camera is far from the volume, you won't see detail in scene view. And vice-versa.

    The directional light rotation is managed by the object Fog Volume shadow caster. Don't worry too much about this scene, there are some ad-hoc things to render fake shadows from the sun direction.
    one FindObjectOfType and list clear and add.
    Probably with the Smooth slider
    Depends on amount
    Not yet
    Scene view needs _CameraDepthTexture. Game view also for uniform fog.
    Read the red box here. In a scene where you don't use that post process you can :
    A: add my script EnableDepthInForwardCamera.cs
    B: use a deferred camera

    I use Graphics.DrawMesh to draw a surrogate, and that's how it behaves.
     
    laurentlavigne likes this.
  33. CurtisMcGill

    CurtisMcGill

    Joined:
    Aug 7, 2012
    Posts:
    67
    If you install this package on a clean install and follow your instructions, you still get this error.

    Assets/FogVolume/Demo Content/MockupManager.cs(151,5): error CS0246: The type or namespace name `UnityStandardAssets' could not be found. Are you missing an assembly reference?

    To fix it, install Legacy image effects.
     
  34. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Single pass is partially solved. This is the only issue atm https://docs.google.com/presentatio...CRUcxpALkvUpo/edit#slide=id.g20896534b5_27_14
    As soon as I get my vive cable back, I will get back to vr support.
     
    tapawafo likes this.
  35. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    I have created a replacement for each of those guys. I will upload it tomorrow and hopefully it will be live by Tuesday.
     
  36. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    OK! I tried the Single Pass again today as per your document. You are right, it works partially. When I turned on "depth" to try to do scene collision for objects that float in the clouds, I see some double vision of hollowed out areas in the cloud, which I presume is where the depth calculation issues is. But it seems like it's happening on all objects, not just objects up close.
    Really love your cloud asset, by the way.
     

    Attached Files:

  37. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Probably because of this in CommonInputs.cginc
    Code (CSharp):
    1. //#ifndef UNITY_SINGLE_PASS_STEREO
    2. //    if (unity_CameraProjection[0][2] < 0)
    3. //    {
    4. //        o.ScreenUVs.x = (o.ScreenUVs.x * 0.5f);
    5. //    }
    6. //    else if (unity_CameraProjection[0][2] > 0)
    7. //    {
    8. //        o.ScreenUVs.x = (o.ScreenUVs.x * 0.5f) + (o.ScreenUVs.w * 0.5f);
    9. //    }
    10. //#endif
    Why is it commented? Because that snippet breaks the post-process stack temporal AA. But this should do the job.
    I would like to test myself, but I can't :/ My vive cable may be lost somewhere in the middle of the atlantic ocean.
     
  38. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    Thanks, that works!
    I now have the clouds around the floating objects. However, I am getting these extreme jagged edges where the clouds meet the objects. That's when the downscale is set to 3, and with the rectangular stereo unchecked. When I change the downscale to 1, and rectangular stereo checked, I can significantly improve the jagged edge, but it also drops the framerate from 90 down to 45. Is there any way to keep nice clean edges but without sacrificing the framerate?
     

    Attached Files:

  39. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
  40. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Experimenting with density-based blur

    2017-04-23_22-21-27.jpg
     
    OCASM, No0B25, Lex4art and 2 others like this.
  41. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    Yes, the images I sent you, I was using the edge-aware upscale. It looks like I can get to 3 downsampling with rectangular stereo checked, and maintain a 90 framerate. I am using a GTX1070.
     
    U_ru_Ru likes this.
  42. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    Last edited: Apr 24, 2017
  43. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    I figured out the dark edge in depth+collision, it was due to transparency mode set to normal, scene integration requires premultiply instead. I forget that your cloud thing is in fact a post effect, you're doing screen space composition.
    View modes still don't do a thing, game view shows the lit mode only, Since it clearly works in the documentation my guess is we're looking at one of the 5.6 many new "features".

    You are definitely getting decent looking refprobes but I can see the base fog isn't showing up - refprobe seems to work only outside the volume. Seems like a bug to me, or at least a limitation that should be in the doc.
    I tried reproducing what you have in your sunset scene and I'm still getting all 6 face of the refcube the same. I attached the project settings and scene, maybe that'll help.
    reprobe edges with bake.PNG

    About the sunset scene, I noticed that the primitives are very thin, much thinner than the cloud seem to be, can you explain a little bit about that?
     

    Attached Files:

    Lex4art likes this.
  44. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    This looks moody, it'll look amazing when objects cast shadows inside a volume. You mentioned you'll be working on that, is there an ETA or have you put that on the back burner for another version beyond 3,x?
     
  45. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    In all your scenes, primites have cube colliders, are the colliders needed? They occlude lens flares.
     
  46. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    It is explained here

    As soon as the current features work perfect and vr is 100% solved, I will start adding more stuff

    They are not needed, you can remove them.
    Not really. That blend mode maybe made it less noticeable, but it doesn't affect anything else.
    I enabled scene collision with depth, edge fix and all of that. Everything behaves correctly.
    2017-04-24_9-04-10.jpg 2017-04-24_9-02-52.jpg 2017-04-24_9-04-40.jpg
    No, it is not a camera effect
    In this page you will see that the DEBUG keyword is disabled by default. I will explain this better in the view modes page.
    What do you mean?
     
  47. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Try these values
    2017-04-24_9-22-13.jpg
    Humm, interesting. Does it behave like that in the editor too?
    No, this is totally new for me, never saw that before.
     
  48. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    that effect is showing up on build and editor. It's even more obvious if I were looking down from high above the cloud.

    Also there's another issue, a kind of flikering, or flashing sometimes on some of the floating objects. You can see it in the video below, around 28-29 seconds, and 50 seconds.

    https://drive.google.com/file/d/0B2AQDFCvVYI8VHNwRTB0eWxBZ0k/view?usp=sharing
     
  49. DavidMiranda

    DavidMiranda

    Joined:
    Nov 30, 2012
    Posts:
    617
    Really hard to see what's going on.
    Check this value, maybe you set it too strong. Default is 1. Depending on the scene scale, this value may be useful.

    2017-04-24_13-26-17.jpg
     
  50. dhuang

    dhuang

    Joined:
    Jan 5, 2016
    Posts:
    40
    the values you suggested, with downscale of 5 makes the jagged edges even worse. I've found that it's only the jagged edges only disappear when the downscale is at 1.
     

    Attached Files: