Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity tree branches and leaves become partly invisible in a distance

Discussion in 'World Building' started by robinson_crusoe, Jul 29, 2018.

  1. robinson_crusoe

    robinson_crusoe

    Joined:
    Jul 29, 2018
    Posts:
    2
    Please, look at this screenshot:
    On a first screenshot in 1 occasion tree branches is ok, but as you can see on 2 occasion, thin branches disappears and branch crossings looks like big knot, and in a distance this effect intensifies until only very thick branches and intersections remain visible.
    I understand, that in real life for eye it is harder to see thin branch on a distance, but it is true if this branch is single. If there is many branches they looks like dark blurry web, but not disappears. This effect also appears with trees in leaves, while in real life dense tree with leaves in a distance still is a dense green ball, not a fish skeleton with remains of meat!
    Look at next screenshot:

    So, how can I make trees looks good in not so far distance (like on a figure 2 and 3 on first screenshot) without billboard?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,482
    Haven't used Unity trees in a while so my advice may or may not apply.

    But can you find the leaves and branches textures and check Mip Maps Preserve Coverage and play with the value that appears and see if that helps.
     
  3. robinson_crusoe

    robinson_crusoe

    Joined:
    Jul 29, 2018
    Posts:
    2
    Thanks, I checked MipMapsPreserveCoverage and decreased alpha cutoff in tree settings, it helps to make trees with leaves looks good in a distance. But trees without leaves became solid black in a distance, I think, that to solve this I need to write special shader.
     
  4. Joey_99

    Joey_99

    Joined:
    Mar 5, 2014
    Posts:
    11
    Hello, can you tell me how you did this? I tried doing the same thing with my leaf textures and they still become ultra pixelated at distance.

    It's becoming so frustrating that I'm thinking I might just buy SpeedTree and make the trees there
     
  5. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    942
    That's the reason some things do not get fixed as fast as they could have been :p
     
  6. Joey_99

    Joey_99

    Joined:
    Mar 5, 2014
    Posts:
    11
    So I purchased one of the ready-made speedtrees from the asset store to see if it worked better, and it dosen't. The branches still have that extremely pixellated look and start to vanish as you move outwards: (Speedtree one is on the right, other two are tree creator trees)



     
  7. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    942
    this may be of help
     
  8. Joey_99

    Joey_99

    Joined:
    Mar 5, 2014
    Posts:
    11
    Thanks, I've taken a look at that, but it still doesn't achieve the desired effect, but I'll try playing with it a bit more.

    I welcome other suggestions.
     
  9. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    942
    It should help a lot though. But it somewhat depends on what is causing your unwanted effect, geometry or textures.
    Something else you could try to minimize it, if it's texture related is disabling mipmaps on the affected textures (will probably result in other unwanted visual artefacts) and enabling/increasing multisampling if it's geometry related.
    Or lastly if nothing helps, just create a version with artificially expanded geometry and dilated textures and use that as the far-LOD (which is similar to the technique described in the video).
     
  10. Joey_99

    Joey_99

    Joined:
    Mar 5, 2014
    Posts:
    11
    It really bothers me that this seems to be the default, for all trees in the engine. I'm convinced it's something more to do with the engine itself or maybe my GPU, probably some setting I need to check/uncheck somewhere.

    I just find it hard to believe that this is just how trees in Unity are, especially ones you get off the asset store.

    But I'll look into your suggestions.
     
    Last edited: Nov 14, 2018
    fct509 likes this.
  11. Joey_99

    Joey_99

    Joined:
    Mar 5, 2014
    Posts:
    11
    So after fiddling with the branch texture and the AA the speed tree (on the right) kind of looks... alright, not as great as I would have liked but it may be the best I can achieve:

    treeimproved.PNG
    treeimproved2.PNG
    Here are the texture settings:

    textures.PNG
     
  12. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    My opinion is that the problem comes from using textures and is trigger by Mip Maps in the alpha transparency value.
    I have the same problem. And I try to balance the alpha grey texture. I have different textures for every LOD. I set up my GPU to max quality.

    A (bad?) different solution can be to make leaves using mesh instead of transparent texture. and adding a very simple super fast shader for the compensating increasing rendering time. If you m make a test and compare result let us know.
     
    Last edited: Nov 22, 2018
  13. fct509

    fct509

    Joined:
    Aug 15, 2018
    Posts:
    108
    So, this is a problem I've come across a few times over the years with Unity, and I still have no idea how to really fix it. One of the more recent things I read about was that a common trick is to do two rendering passes

    The first render pass is a bit odd. Normally, when two items are drawn on the same pixel, the one that's closer to the camera wins. For this pass, we want it to be the other way around. The pixels that are further away from the camera are going to win. And, due to the transparences, we are going to want to render the leaves and branches front to back. To top things, off, we are also going to want to set the clipping value to half of what we normally would. This cuts down on leaves being clipped away.

    Then, on the second rendering pass, we just render the leaves and branches normally. The first rendering pass is fill out the tree, and this second one is to make it look normal(ish). This is still a hack, but it helps get around the over clipping that happens when the tree leaves don't take up enough pixels.

    Now, I don't see why I couldn't write a Unity Surface shader that does this. It would take me a bit of time because I haven't written one in the last two and half years, but I could do it. My issue is, I have no idea how I would create something like this in shader graph. I've been doing a lot of HDRP development these last two months, and one of the issues is the tree leaves. They just get too sparse when they're at a distance, and being forced to use shader graph doesn't really help matters.
     
  14. ToniCaputo

    ToniCaputo

    Joined:
    Feb 23, 2020
    Posts:
    1
    I'm not sure is the same problem but i fixed it by changing the face type to "both" in the leaf material propreties.