1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Colorful Fog: A Fog effect with more coloring options

Discussion in 'Assets and Asset Store' started by grahnzz, Aug 29, 2015.

  1. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    [​IMG]

    Colorful Fog
    is a global fog effect that provides more artistic freedom. Colorful Fog supports a wide arrange of coloring options to enable the right atmosphere in your scene.

    Features:
    • Distance based fog
    • Height based fog
    • Coloring modes: single, simple gradient, gradient, texture gradient, cube-map
    • Fog modes: exp, exp2, linear
    • SM2 Compatible (Mobile)

    Assets included:
    • Colorful Fog
    • A simple low poly example scene


    If you have any questions feel free to ask them here and i will respond as soon as i can!

    >> Asset store link <<
     
    Last edited: Sep 14, 2015
    Manny Calavera likes this.
  2. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    776
    Looks very nice indeed, how is it on mobile devices? Is it an image effect? Is there a webplayer demo so can see it in action?
     
    Last edited: Aug 30, 2015
  3. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    I haven't tested it on mobile until just recently and it does NOT work. But I'm trying to figure out whats wrong and i will come back to you as soon as i know.

    And yes its an image effect. I will set up a webplayer demo for you as soon as i have solved this mobile issue
     
    theANMATOR2b likes this.
  4. FreakForFreedom

    FreakForFreedom

    Joined:
    Jan 22, 2013
    Posts:
    148
    It's really pretty! Is it possible to exclude certain objects from it?
     
  5. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Unfortunately no, but i can look into how that could be done. Right now I'm working on mobile support(It's almost ready). After that i thought about adding support for blending with procedural sky-boxes and other dynamic background elements.

    But nothing set in stone, maybe i should start a poll to see what the people want?
     
    Last edited: Sep 3, 2015
    Leoo likes this.
  6. Lucelas

    Lucelas

    Joined:
    Mar 1, 2015
    Posts:
    1
    Looks amazing on desktop, any progress on mobile compatibility? I bought this specifically for a mobile project and it doesn't seem to be working.

    Thanks
     
  7. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Thank you! Yes mobile will be ready soon, i just need to take one extra look at the code and do some testing to make sure there's no bugs in there. Then there's the asset store review process, so best case scenario its in your hands on Monday/Tuesday.

    I'm sorry for the hassle, i thought SM 2.0 was the only requirement for mobile. I should have done testing on an actual device. Well well... lesson learned.
     
  8. -Singularity-

    -Singularity-

    Joined:
    Jul 27, 2014
    Posts:
    105
    Looks very good! Can anyone report on performance?
     
  9. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    It's pretty much the same performance hit as the Global Fog effect provided by UT on platforms that support depth texture by default. If depth texture isn't provided by Unity Colorful Fog has to generate its own via rendering the scene with a depth shader. This could become a large performance hit on IOS/Android if there's many objects to be drawn.

    I have this demo which you can test, it ran smoothly on my Samsung galaxy core(sm-g350).
     
  10. -Singularity-

    -Singularity-

    Joined:
    Jul 27, 2014
    Posts:
    105
    Thanks for the quick response - I'm interested in desktop but already have several full screen effects in place so I'm always keen to make sure each one is as efficient as possible.

    If it's in line with the standard UT effect that's fine.

    I assume it works well on both forward and deferred?
     
  11. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    No problem. I haven't tested rendering paths in a build. But in editor all of them works, except for legacy deferred when targeting mobile.
     
  12. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi,

    This looks like a very useful asset for a steam greenlit game I'm almost finished with. I reply heavily on fog and your asset looks be good to control it, can I ask if I can control fog colour based on height with your asset and fog density based on height? My game uses a script that lessens fog density as the player goes higher, can I do the same with your asset or continue to use my script like this if I use your asset?
    Cheers
     
  13. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    I'm glad you like the effect. And yes both density and color is controllable via script.

    Also, I would love to see the game you are working on!
     
  14. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    That is great news, I'll give it some more consideration, I think it will be very useful.
    Video of my game: , I call it All Fall Down, set in a future distant world you dodge falling debris and try to go up to neighbouring planet to figure out why this happens, put a stop to it, of course there are lots of puzzles/levels on the way up, bosses etc.. the video is not a proper advert just a video to review of progress..
     
    grahnzz likes this.
  15. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    I just submitted an update that fixes mobile support and supplies two more coloring modes: gradient and gradient texture. The update will hopefully be reviewed soon. If you want the update before it goes live: send me a mail with your invoice number to support@johangrahn.se
     
  16. jkacza

    jkacza

    Joined:
    Sep 8, 2015
    Posts:
    1
    I'm working on a 2D game, using sprites for background e others assets, does work Colorful Fog in this case? Sorry bad english =S.
     
  17. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    It depends if you are using an orthographic projection or not. The fog only works with perspective.
     
  18. faunaface

    faunaface

    Joined:
    Feb 24, 2014
    Posts:
    3
    I see that you have a new update. Do you have a fix in the latest update to have it work on mobile devices?
     
  19. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    That's right, it should work on mobile now. I also added two more coloring options and did some minor performance improvements.
     
  20. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    173
    Hello there. Is your fog working on Deferred Rendering or only on Forward?
     
  21. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    It works with all rendering paths!
     
  22. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Thought i should give you guys some insight into what I'm working on.



    This is a new coloring mode that accepts a texture that's applied in screen-space. So what I'm doing here is rendering the sky with a separate camera, blurring the texture with an image effect and then passing it to the fog shader.
     
    Leoo likes this.
  23. robertRSG

    robertRSG

    Joined:
    May 5, 2015
    Posts:
    3
    I have problem with black screen on some Android devices.

    Logical error (on every frame):
    Code (CSharp):
    1. E/Unity   ( 8246): Trying to access pass 6, but material 'Hidden/JG/ColorfulFog' subshader (0) has only 1 valid passes.
    2. E/Unity   ( 8246):
    3. E/Unity   ( 8246): (Filename:  Line: 458)
    4. E/Unity   ( 8246):
    Maybe someone else is experiencing this issue and resolved it?
    How can i check in game if shader is working and disable it?

    I have a mobile game ready to release but it is not working well on all android devices.
     
  24. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Add this snippet to Colorfulfog.cs, hopefully it will detect if the device can run the effect or not.

    Code (CSharp):
    1.  
    2.   void OnEnable()
    3.   {
    4.       if (!fogShader.isSupported || !customDepthShader.isSupported)
    5.       {
    6.           Debug.LogError("Colorful fog cannot run on this hardware, disabling component");
    7.           this.enabled = false;
    8.       }
    9.  
    10.       if (GetFogMaterial().passCount < 12)
    11.       {
    12.            Debug.LogError("Colorful fogs compiled passes are less than specified in shader, disabling component");
    13.            this.enabled = false;
    14.       }
    15.   }
    16.  
     
  25. TheBenji

    TheBenji

    Joined:
    Dec 18, 2012
    Posts:
    1
    Heya,

    I just bought your asset but get a weird effect on Android.
    Here a screenshot, left in-editor and right Android phone: [​IMG]

    So it seems to work fine on like 1/3 of the screen.
    Any ideas what is happening here?

    Just tested it on the android I have here which is admittedly not the most powerful (Moto G 1st or 2nd gen, not sure).
     
  26. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    I'm not sure. Do you have "generate depth texture" checked? If not: check it and do a rebuild. If that's not the case: add the snippet i posted above and see if it disables the effect, in that case the device cannot run the effect.

    If nothing of what i wrote above works: send me an email with the scene and i will see what i can do
     
  27. robertRSG

    robertRSG

    Joined:
    May 5, 2015
    Posts:
    3

    Thank You,
    It partially resolved the issue. On andorid devices that can't run Colorfulfog i am enabling standard unity fog.
    But standard unity fog is not so beautiful as Colorfulfog.
     
  28. tombombadil1988

    tombombadil1988

    Joined:
    Feb 21, 2015
    Posts:
    20
    Hey, I don't quite understand why the fog won't work with an orthographic camera? I am working on a 3D project with RTS type camera
     
  29. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Actually it kinda works but you need to turn up the fog density alot / or use a small camera frustum
     
  30. Why485

    Why485

    Joined:
    Jun 30, 2013
    Posts:
    6
    I've tried applying this and when it works, it looks great, but I'm having a problem with transparencies. I'm hoping I just missed something obvious, but nothing springs to mind.

    [​IMG]

    Pictured is the default Unity ParticleSystem, but this seems to apply to anything transparent.

    Both any particles and the trail renderer do this same thing when drawn. It's a deal breaker for me for an otherwise great asset. I'm running 5.3.0f at the moment. Is there any way around this?

    Edit:
    Looks like I did miss something obvious. I unchecked "Generate Depth Texture" and now everything is working correctly!
     
    Last edited: Jan 5, 2016
  31. Excelerator

    Excelerator

    Joined:
    Nov 14, 2013
    Posts:
    20
    I'm having the same problem with transparent materials.
     
  32. Tsuole

    Tsuole

    Joined:
    Feb 5, 2016
    Posts:
    8
    Hi guys, I love this fog works wonderfully but I am also having a problem with (I think) transparencies

    I am using several Stencil Shaders in my scene, but the fog causes them to appear in places they should be masked over in slight transparencies. Is anyone else having this problem?
     
    Last edited: Feb 19, 2016
  33. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    890
    I had a chance to buy and play with this today while integrating it for a customer of mine who wanted to know compatibility with Zone Controller. It worked great. I was very pleased with the overall quality of the effect and how dynamic it can be.
    Here is a video demo I did for it:
     
    Arganth likes this.
  34. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    241
    just this made me buy it :D
    (colorful fog i mean, zone controller first day buyer here :D)
     
    JohnRossitter likes this.
  35. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    890
    Its a great combination!
     
  36. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    241
    any change that this (at 1:35)-like effects will ever be possible with this asset:



    so maaaaannnyyy people asked in chat for this
     
  37. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    If you mean the steamy effect coming from the roof, no thats not what Colorful fog is for. That is most likely a particle effect.
     
  38. bakelite

    bakelite

    Joined:
    Jan 13, 2016
    Posts:
    2
    Any ideas on how to sync the fog colors to the skybox, like a gradient which blends from the sky color to the horizon color?
     
  39. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Yeah, the trick is to use a very similiar cubemap for both the skybox and fog. Or if you want a perfect blend, put a plane/quad at the end your camera frustum. That way the background/sky will get colored by the fog.
     
    Last edited: Mar 21, 2016
  40. makazu

    makazu

    Joined:
    Jan 2, 2014
    Posts:
    2
    Does this asset work with an orthographic camera?
     
  41. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Yeah it works, but it's a little trickier to config.
    orthofog.png
     
  42. ac21217

    ac21217

    Joined:
    Mar 1, 2013
    Posts:
    2
    I'm having some issues out of the box with strange lines showing up. They seem like billboard planes moving forward or backward when I move the camera. Screen Shot 2016-03-30 at 10.14.39 AM.png Screen Shot 2016-03-30 at 10.15.03 AM.png
    Do you recognize this issue or has anyone else experienced it?
     
  43. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    That's weird, never seen that issue. What version of Unity are you experiencing this with?
     
  44. ac21217

    ac21217

    Joined:
    Mar 1, 2013
    Posts:
    2
    5.3.3f1

    The problem comes and goes randomly. I haven't seen it in a bit, so I'm guessing it's something buggy with my project. I wouldn't worry about it, I was just wondering if you had seen it before.
     
  45. syaped

    syaped

    Joined:
    May 22, 2010
    Posts:
    18
    Hey, would this work in Unity 4.6.2f1? Or made to work with is simply enough? @grahnzz
     
  46. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    I haven't tried it. But a wild guess would be: yes. Altough if i recall correctly 4.6 requires unity pro to use image effects which colorful fog is. If you have 4.6 and unity pro i would happily give you a free copy to try if it works :)
     
  47. syaped

    syaped

    Joined:
    May 22, 2010
    Posts:
    18
    I do have Pro and would love to try it out! Sent you a message...
     
  48. aurel_unity

    aurel_unity

    Joined:
    Jun 21, 2015
    Posts:
    18
    Hi @grahnzz, thanks for making such a great asset! I really like how you can get subtle and beatiful effects with Colorful Fog. I'm really pleased with my pruchase : )

    Quick question : we'de like to change the gradient colors at runtime, with 3 presets. Is there a way to do this by script, or would you have any advice to achieve this ? I don't know where to start.

    Thanks a lot for your time!
     
  49. grahnzz

    grahnzz

    Joined:
    May 7, 2013
    Posts:
    45
    Thank you for the kind words aurel, means alot to me.
    Yes, you can edit the coloring through any of the variables below.
    Code (csharp):
    1. //setting a single color,  
    2. //make sure coloring mode is ColoringMode.Solid or this wont have any effect.
    3. colorfulFog.solidColor = Color.grey;
    4. //setting simple gradient colors,
    5. //make sure coloring mode is ColoringMode.SimpleGradient or this wont have any effect.
    6. colorfulFog.skyColor = Color.white;
    7. colorfulFog.equatorColor = Color.black;
    8. colorfulFog.groundColor = Color.white;
    9. //setting cubemap,  
    10. //make sure coloring mode is ColoringMode.Cube or this wont have any effect.  
    11. colorfulFog.fogCube = someCubemap;
    12. //setting gradient,  
    13. //make sure coloring mode is ColoringMode.Gradient or this wont have any effect.
    14. colorfulFog.gradient = someGradient;  
    15. colorfulFog.ApplyGradientChanges();
    16. //setting gradientTexture,  
    17. //make sure coloring mode is ColoringMode.GradientTexture or this wont have any effect.  
    18. colorfulFog.gradientTexture = someTexture;
    If you want i can write an example for you?
    /Johan
     
  50. syaped

    syaped

    Joined:
    May 22, 2010
    Posts:
    18
    Can anyone comment on performance on mobile? Iphone 5s and 6s specifically.