Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Upgrade to Unity4 removes fog on android 2.3

Discussion in 'Android' started by miniduck, Jun 1, 2013.

  1. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    Upgraded project to Unity 4 and now fog doesn't work on my 2.3 test device. Other devices with android 4.0 > it's showing up correctly.

    Tried extracting the terrain shaders from unity 3 into the project but problems remains.

    Any ideas?
     
  2. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
  3. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Unlike the original bug report, I observe the same under Android 4.0.3 and 4.2.2 with Exp2 fog and Android "Minimum API Level" set to 2.3.1 (level 9) --- even with 17 too, though, and also with Linear fog.

    Basically, no kind of fog works on any Android version with Unity 4.2.0f4 as far as I can tell. Seems like there is no outrage --- is no one using fog anymore? Am I using outdated techniques? Is everyone still using Unity 3.5? Is everyone doing 2D scrollers these days? Or what?

    This is a big bummer! Hopefully they will push a hotfix update for this rather soonish. Pretty *substantial* bug if you ask me. Most of us need fog for sensible fading of almost-distance-culled objects. Already been 2.5 months since that bug was first reported and here I am, suffering from it... :( :(
     
    Last edited: Aug 14, 2013
  4. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,827
    Most folks dont use fog on mobile platforms.
     
  5. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Yeah probably not... but:

    - I see some slight distance fog in "Riptide 2" and some heavy fog in Subway Surfers

    - seems like it worked prior to Unity 4 (a great many folks are still on 3.5 and have never updated) so I do think it's a pretty bad bug that should really be addressed soonish..
     
  6. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,827
    Yeah there are a few games on mobile that utilize it for sure. Overall I don't think the majority do though, due to it's performance overhead. If you can afford to have a team of industry experienced pros who can implement custom fog it's doable. When I say this I mean using programmers to come up with neat much less expensive solutions like using custom shaders that work out the distance a vertex is away from the camera and then apply a fog color to the geometry.

    This is what one of the most awesome-looking Unity mobile game's developer had to say about mobile fog. Recommendation from ShadowGun creators about fog: Fog effects - avoided. Single planes that fade in and out are used to achieve cinematic fog effects without actually rendering any fog.
    This is faster because the planes are few and far between, and it means that fog doesn't have to be calculated on every pixel and in every shader.

    For the most part the vertex shader implementation would work the same and be very optimal for mobile.
     
  7. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Well you're totally right, all it takes is a custom vert shader. That's not even a lot of black magic in my case. I kind of assumed that if there's something "built-in" then probably it's the most heavily optimized, fine-tuned implementation known to the industry. But on second thought, that's actually a pretty handsome assumption on my part......
     
  8. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,827
    Well I do believe the fog Unity uses was initially built at it's core for PC and Mac builds...much like the terrain engine. They more than likely modified a few things to get it to work on mobile devices, but I don't know if it's the most optimal solution for mobile. People still have issues with the terrain engine performance on mobile platforms. I would assume (dangerous I know) that the fog implementation is similar. You did address a serious bug though for mobile deployment and hopefully it gets sorted. In the mean time I suppose it means one can come up with more optimized creative solutions to fog on mobile :).
     
  9. Aurore

    Aurore

    Head of Learn Content Production Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,105
    I can confirm that the fog issue is indeed a bug that our developers are looking at as we speak, hopefully the issue will be resolved soon.
     
  10. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    684
    You can also color a vertex based on it's distance from camera fairly quickly.
     
  11. Joel-Santos

    Joel-Santos

    Joined:
    Feb 23, 2010
    Posts:
    118
    I still use Unity 3.5, because of performance and Arm6 support, so this doesn't affect me.

    But since you guys are talking about Fog bad performance... Is that really a thing? You could always use shaders but you would have to use OpenGL ES 2 right? And would it be much better than fog?
     
  12. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,827
    Don't a majority of devices today use OpenGL ES 2? I thought OpenGL ES 3 was the new cutting edge thing?
     
  13. Joel-Santos

    Joel-Santos

    Joined:
    Feb 23, 2010
    Posts:
    118
  14. metaleap

    metaleap

    Joined:
    Oct 3, 2012
    Posts:
    589
    Since someone from Unity QA replied via email back to me enquiring about this issue, I should let this thread know about the fog status over here.

    It's really strange --- at my end the problem persisted for a whole two days, for both HTC One V and HTC One M7, for all kinds of fog, with very visibly strong near-distance fog clearly visible in Game View. Nothing helped. Fog didn't show on the phones.

    Then all of a sudden the problem was gone from one day to the next! Same project, no changes to fog settings or phones or project settings.

    As of yesterday fog is back for both Android 4.x versions and devices for me. Strange situation indeed, kind of a Heisenbug? Maybe it was the Windows restart that did it, no idea. Will let you all know if I do run into this again, which I hope I won't.

    One way or the other, in full resolution now that the fog started showing up, it also seemed to immediately eat some 10 FPS or so apparently, but oh well.. that's another oddity for another day :D
     
  15. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    264
    I have the same issue on both Xperia S and Samsung S3, but in my case the fog depends on the view angle (y) of the camera.
     
  16. miniduck

    miniduck

    Joined:
    Sep 27, 2012
    Posts:
    117
    The report has been closed - hope it's included in the next unity release
     
  17. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    264
    This hasn't been fixed yet. Any news on that?
     
unityunity