Search Unity

No fog rendering.

Discussion in 'Windows' started by EvilDingo, Aug 12, 2013.

  1. EvilDingo

    EvilDingo

    Joined:
    May 7, 2011
    Posts:
    190
    I've tried all types of fog, but nothing is showing up on my Samsung WP8 device. I noticed when I changed to Windows Phone as a target, fog had been unselected. Is it supported?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Hello.

    The default fog is indeed not supported on WP8. However, if it's really necessary, you can write your own shader for it.
     
  3. EvilDingo

    EvilDingo

    Joined:
    May 7, 2011
    Posts:
    190
    Thanks for that. I'm not much of a shader programmer. My game looks good enough without it, but it definitely added atmosphere. I'll keep a look out on the Asset Store. :)
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,896
  5. EvilDingo

    EvilDingo

    Joined:
    May 7, 2011
    Posts:
    190
    Thanks Tomas. What do I attach the shader to? I thought the MainCamera, but it needs a material.
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,896
    * Create a material
    * Attach that shader to your newly created material
    * Attach material to objects which supposed to have fog

    I guess that's not what you've expected, but that's how generic fog works, every object which is affected by fog, has to have shader with fog implementation.


    The other solution would be apply fog as post effect - http://docs.unity3d.com/Documentation/Components/script-GlobalFog.html, but you'll need Pro license, because it's an image effect.
     
  7. InitoryDad

    InitoryDad

    Joined:
    Jul 3, 2012
    Posts:
    21
    Hi, Tomas. I haven't got fog effect on my lumia 720 device. I used your "MuCustomFog.shader" and "GlobalFog effect", but both of them were not effective. How to do this? Can you provide a example? Thank
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,896
    When you used "MyCustomFog.shader" , did you tweak values in Edit->Render Settings?
     
  9. InitoryDad

    InitoryDad

    Joined:
    Jul 3, 2012
    Posts:
    21
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    You forgot to check the "Fog" checkbox in the render settings.
     
  11. InitoryDad

    InitoryDad

    Joined:
    Jul 3, 2012
    Posts:
    21
    Tautydas, Can you sent me a example? Fog still not avail when I checkbox is checked. :-(
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    You're right, for some reason it doesn't work on the phone. At first I only tested it on editor.

    I'll take a look at it.
     
  13. wstumpf

    wstumpf

    Joined:
    Jan 11, 2013
    Posts:
    5
    Seems like depth textures aren't supported (even though the hardware does). Does qualcomm not expose the caps for d3d 9 or does unity just not support depth textures on wp8 yet? I'll have to keep that in mind for the time being, but do you guys expect depth texture support in a future release?
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    I'll ask our graphics guy and get back to you.
     
  15. wstumpf

    wstumpf

    Joined:
    Jan 11, 2013
    Posts:
    5
    Is there a status update?
     
  16. LeoCeballos

    LeoCeballos

    Joined:
    Mar 16, 2011
    Posts:
    25
    I would also like to know what the status is on this. And is "default fog" not going to be supported on wp8 at all, or is it something that might come later?
     
  17. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Any updates?
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Yes!

    Fix is coming in Unity 4.5. Still, not everything works (there's a bug in Adreno 225 driver that makes it not able to properly sample shadow maps and depth textures), but it should mostly work.
     
  19. LeoCeballos

    LeoCeballos

    Joined:
    Mar 16, 2011
    Posts:
    25
    Hey guys,

    So I checked and "standard" fog is still a no-go with Unity 4.5. I'm bulding a space sim and I wanted to have some missions set inside a nebula. On Android, I can get it too look fairly cool with fog and a few other effects, so its disappointing that its so difficult to get it to work on WP8. I mean, even Superman 64 had fog! (and not much else...)

    It seems like the only alternative is to add fog, manually, to the half dozen or so shaders I'm using (mostly Unity built-in mobile shaders) and then switch every material to those new custom shaders, correct? If so, this leaves me with a few questions.

    Since adding fog in the render settings is required, will this create "double fog" on devices that do support the built-in Unity fog? Does having this fog functionality in the shader affect performance in any way if fog is turned off? In other words, would I need to make separate shaders just for the fog levels and either switch them by script, or have separate "fog level" duplicate objects, so that the fog shader doesn't affect performance in other levels?

    I suppose a clever script could be written that properly switches shaders "on awake" depending on platform and if the level is a "fog level" or not if necessary. Do ALL windows phone 8 devices lack fog? And if not, and my above scenario does result in "double fog", is there a way to know if a device does so I can choose weather or not to switch shaders?
     
  20. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Is there a significant performance hit on using the global Fog image effect? Is that image effect suitable for mobile platforms?
     
  21. IPnose

    IPnose

    Joined:
    Jun 6, 2014
    Posts:
    20
    The slightest post-effect is very expensive on mobile.

    Beyond that, it's still annoying not to have a single fog solution that works on WP (even global fog image effect solution does not work on Lumia 925) ...
     
  22. Gnimmel

    Gnimmel

    Joined:
    Apr 21, 2010
    Posts:
    358
    I ran into this problem as well and noticed if you use the shader there is double fog in the editor. To get around this I removed the connection to the fog settings and added them to the shader instead. This way I know all devices, not just windows phone, will look the same because I don't have to turn on the fog settings.

    I have no idea if the shader method is slower than the built in fog though? but it seems to be working fine at the moment.
     
  23. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    It definitely should not be slower. When you enable global fog, unity injects fog code to all your shaders, however, this isn't implemented for Feature Level 9.x. So if you're writing shaders yourself, the result should be identical.
     
  24. realworld666

    realworld666

    Joined:
    Nov 2, 2012
    Posts:
    24
    Is there a way to test the feature level? How should I decide whether to implement custom fog on each device?
     
  25. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    All current Windows Phone devices are feature level 9.3.