Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Global Fog Doesn't Affect Billboard Trees

Discussion in 'Shaders' started by magique, May 29, 2017.

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,414
    Is there a solution for the GlobalFog shader not affecting billboard trees?

    upload_2017-5-29_13-11-9.png

    I've looked everywhere and cannot find a solution. I see people claiming it should work fine, but it clearly doesn't. I also verified that I don't have a custom billboard shader in my project that could be interferring.

    [EDIT]
    I'm using Unity 5.5.3f1 and the trees are just normal Unity trees.
     
    Last edited: May 30, 2017
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,177
    seems to work here (tested in 2017.1.b7)

    are those normal speedtrees?
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,414
    Sorry, I forgot to add that I'm using Unity 5.5.3f1 and the trees are just normal Unity trees, not Speedtrees.
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,177
    tried with those Nature/Tree... materials on cubes, works on 5.5.3p4.

    if you add big cube there, with new material, and use same shader as the trees, does the fog work on that?
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,414
    I don't know, but I tried on a completely different computer today in 5.53f1, 5.6, and the latest beta and all failed. I also tried in both Forward and Deferred rendering.

    [EDIT]
    This is with GlobalFog from legacy image effects. Is that what you're using?

    [EDIT 2]
    Also, are you sure your trees are billboards that seem to be working? Try setting your tree billboard distance to something very small so most trees will be billboards.
     
    Last edited: May 31, 2017
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,414
    Also, this seems to work fine with SpeedTree billboards. It just doesn't work for regular Unity tree billboards.
     
  7. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,177
    yeah, looks like with unity tree billboards it doesn't work. (i used speedtrees)

    frame debugger shows that globalfog is drawn first, then after that billboard trees,
    using shader Hidden/TerrainEngine/Billboard Tree

    and global fog script uses this attribute, https://docs.unity3d.com/ScriptReference/ImageEffectOpaque.html
    upload_2017-6-1_11-8-53.png

    *well looks like there are some possible fixes, https://forum.unity3d.com/threads/global-fog-and-transparent-shaders.123803/

    ** just modifying the billboard shader seems to work too, added cutoff, uses alphacutout,
    https://github.com/UnityCommunity/U...ders/Terrain/Trees/Unity-BillboardTree.shader
     
    Last edited: Jun 1, 2017
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,414
    I may be switching to AltTrees and their billboards seem to work fine. So hopefully I won't need to do any of the hack solutions. Thanks for all your help.
     
  9. graphicDNA

    graphicDNA

    Joined:
    Jun 26, 2017
    Posts:
    41
  10. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    262
  11. graphicDNA

    graphicDNA

    Joined:
    Jun 26, 2017
    Posts:
    41
    Hi, sorry I missed this message.

    It includes it's own shaders, and is not related at all to the terrain system. Billboards are created and rendered manually or automatically, searching for colliders to check for ground's height.

    thanks