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

Height Fog for Post Processing Stack 2

Discussion in 'Assets and Asset Store' started by BOXOPHOBIC, Jun 10, 2019.

  1. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Unity - Facebook.png

    Simple yet beautiful height fog with directional light and animated noise support. Height fog will provide a volumetric like effect while using a lower computation power! Built with AMPLIFY SHADER EDITOR, all shaders can be modified with ease to your needs.


    Reduced PRICE while in BETA! Support the development by ordering today!
    Please note that while in BETA, some features might change or might not work as expected. Standard RP and LWRP are supported, VR is NOT yet supported! Tested on Windows and Android. For any issues, please let me know on this thread!

    POST PROCESSING STACK 2 required for Height Fog to work!





    The assets used in the presentation videos:
    WINTER ENVIRONMENT by ANGRY MESH
    ADVANCED DYNAMIC SHADERS by BOXOPHOBIC
    POLYVERSE DYNAMIC PROPS by BOXOPHOBIC

    COMPATIBILITY

    POST PROCESSING STACK 2 support!
    AMPLIFY SHADER EDITOR support!
    STANDARD RP support!
    LIGHTWEIGHT RP support!

    CORE FEATURES

    • Easy to set up
    • Distance based fog
    • Height based fog
    • Directional based fog
    • 3D animated Noise support
    • Forward and Deferred support
    • Scene view visibility support
    • Basic demo scene included

    LIMITATIONS

    • SM2 devices are not supported
    • HDRP is not supported
    • VR is not yet supported
    • Orthographic camera is not yet supported
    • This is not a true volumetric fog solution
    • Transparent objects can cause issues when the skybox is visible through them
    • Temporal Anti-Aliasing will cause flickering on object edges with Height Fog enables
     
    Last edited: Jul 9, 2019
    Mauri likes this.
  2. wechat_os_Qy0whXIYPp6VVKwlKjPDDiu78

    wechat_os_Qy0whXIYPp6VVKwlKjPDDiu78

    Joined:
    Jul 11, 2018
    Posts:
    1
    Can you provide the heightFog Shader write by hlsl? I don't used amplify shader editor. sorry,english is not my native language.
     
  3. Wintermute-

    Wintermute-

    Joined:
    Sep 5, 2017
    Posts:
    56
    Hello,
    I read that VR is not supported yet. Is this the case for both double and single pass? I am currently using double pass and deferred, I know most VR projects tend to use single pass, so just wanted to check.
     
  4. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    Really interested in buying this, it looks absolutely stunning! I need the fog height to always be where the camera is so the fog is visible everywhere the player goes, is there/can you add support for this?
     
  5. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    Hi, this looks great, really impressive.
    Working on a Switch game, do you know if it will work?
    And what are "SM2 devices"?
     
  6. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Just bought and added to a project in a minute. This is amazing for what it is !

    Really happy with the purchase, Cheers !
     
  7. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hi there. The development with continue with Amplify Shader Editor, however, the shader can be opened and edited by hand like a regular shader. The only problem is that it will be a bit harder to read since ASE uses a lot of internal names for variables.
     
  8. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hello. I will start testing the different VR headsets tomorrow and get back to you. Technically, it should work without problems, but I prefer to test it to be 100% sure.
     
    Wintermute- likes this.
  9. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Thank you! I'm not sure if I understand. In your game, should the fog height be linked to the camera Y position in world space?
     
  10. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hello. Switch should work without problems, it is quite a high end device. SM2 stands for shader model 2:
    https://en.wikipedia.org/wiki/Unified_shader_model

    SM2 is used in super low end devices and it is quite limited, so I decided to not offer support for it.
    Nice games btw :)
     
    Last edited: Jul 9, 2019
  11. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Thank you! I'm glad that you like it!
     
  12. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    Yes exactly!
     
  13. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    @Wintermute- VR is quite messed up, I already sent a message to Amplify's developers. Regarding the TAA, apparently, the depth is causing some issues with TAA enabled, not the fog effect itself, and I'm not sure if it is a unity bug or not. I'll investigate a bit more.
     
    P_Jong likes this.
  14. rostik1975

    rostik1975

    Joined:
    May 14, 2015
    Posts:
    44
    Is it compatible with LuxWater? LuxWater uses unity standard fog setup from Lighting panel and is compatible with PostProcessing Stack Linear/Exp fog.
    Thank you.
     
    Last edited: Jul 28, 2019
  15. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hi! Fog on Lux Water is unity's built-in fog. Height Fog is not working like that, it is working as a post-processing effect. I assume that Lux Water is using transparency, so there could be some visual artifacts:


    Just send me an email at boxophobic@gmail.com and I'll send you the build to test it out.
     
  16. unicoea

    unicoea

    Joined:
    Feb 18, 2013
    Posts:
    60
    Hi!
    I just meet a error:
    " The type or namespace name `PostProcessEditor' could not be found"
    I am using Unity2018.4.0 LTS, and Gaia_v1.9.5.1
    Is unity2018 is too new or old for it?

    Kind regards,
    unicoea
     
  17. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Open the package manager from the editor and install the Post-Processing package.
    This tool relies on it so you must have this downloaded into the project !
    You will also have to follow the procedure of adding post processing volume and layer to scene and camera.

    EDIT : you can follow up with this tutorial from around 0:50 minutes forward
    Note that the fog effect is added similar to other effect but be sure to click on "BOXOPHOBIC" tab in order to find the effect !
     
  18. Danistmein

    Danistmein

    Joined:
    Nov 15, 2018
    Posts:
    82
    Hi, BOXOPHOBIC

    This Fog is very beautiful. is it as efficient as the unity processing fog?, Because the most point I considered now is the performance.

    Regards
     
  19. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    @Vagabond_ Thanks for the tutorial. Please note that the support for Post Processing Stack 2 will be dropped. It is just easier to handle the post-processing without it, plus it is more performant without doing the full-screen blit that unity is using when doing the post-processing.
     
  20. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    For anybody having the following issue:

    "Assets/BOXOPHOBIC/Height Fog/Core/Editor/HeightFogEditor.cs(12,2): error CS0246: The type or namespace name `PostProcessEditor' could not be found. Are you missing an assembly reference?"

    The issue could be caused because you had PostProcessing Stack installed previously and unity saves a PP stack keyword in the player preferences. If you don't have PP Stack installed anymore and the keyword is detected, the script will throw this error.
    To fix the issue, just delete HeightFog.cs from the Scripts folder and HeightFogEditor.cs from the Editor folder. These two scripts will be deprecated in the next update anyway, I just left them there for people who used them previously.
    Sorry for the inconvenience!
     
  21. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    @wechat_os_Qy0_X1ITy6VrZHYPJFd58JGlA Thank you! I'm glad that you like it!

    If you are using forward rendering, it is not. Unity is performing the fog per shader and it is cheaper than my approach. I'm using the depth buffer to calculate the fog and shader is more expensive with noise enabled.

    If you are using deferred rendering, the fog calculation is similar to unity's because ethe depth buffer is used anyway, but it is a bit more expensive because of the height and noise calculation.
     
  22. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    58
    I tested it with the Oculus Rift, and I agree its not working. It looks like a known Unity bug with the use of the depth texture used in LWRP VR, and Single pass forward rendering. I've seen this problem with a lot of LWRP Unity asset developers. When I reported this bug I got directed to a bug already reported. It was just the two of us back in January squawking about it. But I've been experiencing it from LWRP 2.0 when I first started to use the new render pipeline. As of today looks like 37 have up voted it. But I still see no mention by Unity to address this issue effecting VR developers using LWRP. Anyone here care to upvote it, please do add your vote to issue ID 1123069.

    https://issuetracker.unity3d.com/is...enedepth-doesnt-work-in-single-pass-rendering

    So in the editor game view things look great with Height Fog Post Processing! Can't wait to see Unity fix this issue. Then we will have fantastic fog in LWRP VR single pass forward rendering projects.
     
  23. WalkerStudio

    WalkerStudio

    Joined:
    Feb 27, 2014
    Posts:
    5
    Is the fog system can't work on the LWRP pipeline?may be i will use the pipeline in the fulture.i think it's better to support the new pipeline!
     
  24. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hello. LWRP is already supported.
     
  25. ChimeraIT

    ChimeraIT

    Joined:
    May 9, 2014
    Posts:
    25
    Hello there! First of all compliments for this great-looking and performant fog.
    Unfortunately, I'm currently experiencing an issue where I have stripe artifacts on the fog. This is only happening on Android, it occured on a Sony Xperia XZ1 compact and a Google Pixel 2 XL. It didn't happen on a iPhone X or 6s.
    Beneath the fog is Unity terrain. I used a custom LWRP shader and the default LWRP terrain shader, both with the same result.
    But it also shows up on meshes placed on that terrain.
    The artifacts appear at a certain distance, and disappear when zooming in closely. The stripes get broader when tilting the camera to a top-down view and get narrower, when i tilt back to a flat angle.
    I also included a screenshot where you can see the artifacts.

    It would be interesting if you could reproduce this visual behavior or to hear if somebody else is experiencing this.
     

    Attached Files:

  26. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Please contact me via email (boxophobic@gmail.com) and I'll send you the latest package. I reworked the LWRP shaders. On my Android tests, everything worked with LWRP, except VR.
     
  27. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    Just picked up this asset and am having an odd issue. The demo scene seems to work fine but the moment I try and add HeightFogGlobal to my scene it doesn't actually work. The sphere is rendered and I can see the inside of the sphere respond to changes in settings, but there is no actual fog. I can adjust the start/stop of the height fog and it also appears to be always on, or always off. Any ideas? Using Unity 2018.4.11f1 on MacOS METAL.
     
  28. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hi. Could you open the demo scene to check if there is working?
     
  29. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    As I mentioned the demo scene works fine. I even copied the demo scene's HeightFogGlobal over to my scene and it did not work. My scene has nothing special in it but some terrain and a few models.
     
  30. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Check the size of the Height Fog Global object, it should be the size of the camera far plane - 1. Also, make sure the camera tag is set to MainCamera. Maybe the camera is not found and the Height Fog Global sphere mesh is really small somewhere in the scene. If the camera is not found, a message should appear in Console when you press play.
    upload_2019-10-22_10-11-3.png
     
  31. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    Camera is tagged as MainCamera and the size of the object is as you describe. Am I missing a step?
    1. Create new game object
    2. Add height fog global script
    In doing that I get the following:
    wherein the background responds to Fog Intensity, Skybox Height/fill, and directional sliders. There is just zero fill between the camera and the surface of the sphere mesh.

    sigh - I figured it out. The Fog Height End parameter was well below my terrain hence it was not showing. Once I raised that value then things started looking a lot better.
     
    Last edited: Oct 22, 2019
  32. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    :D I'm glad that is working :)
     
  33. yonson_chappers

    yonson_chappers

    Joined:
    Feb 6, 2017
    Posts:
    33
    Hello, just downloaded and installed but the tutorial video doesn't mathc up to the asset - there is fog but it doesn't cover over the cube assets, also I'm using VR and it isn't working as described - e.g. its not possible to define the directional light, the 'noise' values do nothing, and the height fog override just matches the setting of the main asset. I'm using 2019.2 could you let me know what I need to do to get the asset to work like in the video? thanks
     
  34. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hello. Is this the video you were following?


    Could you test if the demo scene is working? I tested the vr on oculus go, google cardboard and windows hmd, and all worked properly.
     
  35. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Hope it works with Xbox One, PS4, Xbox Project Scarlett and PS5 lol
     
  36. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    There's no point to supporting that, what's crucial is URP support on Mobile, Switch, Mid-Range PC, specifically on URP.

    No one is developing for old-gen console anymore using new technologies and codebases, if you are developing for next-gen platforms you would be using HDRP.

    This asset should remain solely focused on URP.
     
  37. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Forgive my ignorance. Do you mean URP does not support Xbox One and PS4?
     
  38. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    I'm not speaking from Unity's perspective or this asset creator's perspective.

    The point was that anyone who is making a game NOW, and is using the newest SRPs, would not be targeting the current last-gen consoles.

    URP/HDRP are just barely production ready, and if you are using them in early production, your title is likely to release in a year at the earliest - at which point the next-gen will be out. And if you are targeting next-gen consoles, you will be using HDRP.
     
  39. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    @Rich_A No. I’m using Unity built-in rendering (Forward Rendering). But I tend to release on PC only for now. But let’s just say later on I want to port the title to PS4 and Xbox One. Is it like.. possible? (Used to port some games to android too)
     
    Last edited: Nov 27, 2019
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BOXOPHOBIC Can you add the ability to reference the directional scene light so that the directional color property will automatically get updated based on the color of the sun light?

    [EDIT]
    I wrote a quick script to synchronize them, but it would be nice to have it built-in.

    [EDIT 2]
    I also had to make 2 functions public in HeightFogGlobal.cs in order to refresh the color. So, a built-in way of doing this would be preferable.
     
    Last edited: Jan 7, 2020
  41. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    102
    Hi, I'm trying to use this on 2019.3 with URP in VR (oculus rift s). I can see the fog in Viewport but not in VR HMD, is it compatible with this setup?
     
  42. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    is this package supposed to work with URP post process stack?
     
  43. MADUXX_INC

    MADUXX_INC

    Joined:
    Apr 8, 2015
    Posts:
    5
    @BOXOPHOBIC does SM2 devices include WebGL? This is what we need for our project.
     
  44. ShockpointGames

    ShockpointGames

    Joined:
    Jul 19, 2018
    Posts:
    26
    Not sure if you’re aware, but we’re having issues with the fog not showing in the game view with URP 7.2.1.
     
  45. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    I opened a Unity bug for this one, the URP lead programmer will look into it soon
     
  46. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Wow it seems that I missed a few messages. Sorry about that! I can add it. Some more features are planned, but right now I'm focusing one of my other asset which is in BETA, and there is a lot of work I need to do there. I can give an ETA for now.
     
  47. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hi. I uploaded another build a few days ago, in URP 7.18 it's working. I will also test in 7.21, what is bothering me I that with each URP version the depth is sampled differently. I will get back with more details. If anyone has a repro step, please let me know.
     
  48. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Hi. SM2 devices are not supported.
     
  49. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    I need to double check my case again. It may be working now. After I talked with the Unity devs, there is a chance that some settings were not correctly set up on my side. I'll test it asap, maybe tomorrow.
     
  50. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    506
    Thanks! the enabled HDR option seems to cause issues. I fixed it for 7.21, but it is not working for 7.18, and I can't find a formula that works in both cases :|