Search Unity

Tree creator bug when using planes for leaves and causes glitching lines in leaves

Discussion in 'Editor & General Support' started by BHS, Sep 13, 2011.

  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hi,

    I was making some trees with the tree creator and when I use plane leaves (even cross and triple cross) I get this weird glitch/bug that makes the planes glimmer or reflect when viewing them at an angle. This very frustrating and looks unappealing when walking through a forest with this glitch, it also affects the billboards.

    I know this problem isn't texture or input related as I have tested it on multiple computers, new projects, and many many different textures and materials. The problem happens again and again. There is nothing I can do so I'm hopping Unity can help me out.

    It isn't too noticeable when there are just the tree leaves textures, but once I add the bark it causes the problem and it's quite noticeable. It almost looks like the tree's normals get messed up and that's why when you're viewing the planes from an angle it glimmers when it should just be invisible.

    Has anyone had this problem? I think I'm going to be switching to mesh because I think it's better for leaves, and I can't wait, but still this is driving me crazy because I don't like bugs and I like things resolved.

    I use windows vista (AMD Quad Core) and my other computer uses windows 7 (With the new I5 processor). Both have the newest version of Unity, but both have the issue.

    Here's some screenshots (Upper pic no bark, lower pic with bark and bug)
    $No Bark Bug.jpg
    $With Bark Bug.jpg
     
    Last edited: Sep 13, 2011
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Anyone?
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Great to see the community and the Unity team helping out.

    Thanks guys!

    ...
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi ik,
    first calm down! you did not describe your problem very easy to understand.
    anyway.

    adding the bark texture after having added the leave texture means that there will be less space for the leave texture afterwards because the optimized texture for the whole tree is recalculated so that the leave texture will only fill about 1/2 of the whole tree texture.
    seems that this loss in texture resolution might cause your problem.

    to get around this: increase the aniso level of the generated texture.
    then check your leave textures: might be that your alpha and the overfill on the diffuse texture aren‘t set properly –*as in some of your previous textures as fas as i remember.

    btw. i like this tree better than your billboarded ones.


    lars
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for being the only one to give me some help lars.

    Well I have tried everything literally everything my aniso level is all the way up on both the leaves and the bark. I've tried adding the bark first then the leaves and I still have the problem and vise versa.

    I've tried every possible combination of texture alphas and none work, I still have the problem. It seems that it might be the texture that the tree creator generates. Like the one that has the leaves and bark side by side.

    I know I didn't describe it very well but it's hard to do so. I mean this is a very weird problem that I have never seen before so I have no idea how to describe it. Would a webplayer help?

    And thanks, this is why it's frustrating is because this is standing in the way of development. I personally think it's a bug I've been creating trees for almost a year now and I know every setting there is to know and I can't fix it.
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi ik,

    best would be to send me your tree! sounds rather strange but anyway: i would not steel it.

    i just have setup a simple tree with only planes for the leaves – which is not my way to model them – and i could not reproduce your problem. not from any viewing angle. everything was just fine. so i still think it it due to your texture.

    the order of adding the textures or better: materials will not change the final texture --> result. but if you just have the problem when adding a seond material (in this case for the bark) it should have something to do with the finally generated "optimized texture". which of course depends on your original textures.

    just send me a link to your tree (package) and i will have a deeper look into it – and may be find a solution.
    that is all i can do from here. i don’t think that a webplayer will help, because it will just show me your problem, but not its possible sources.

    you will not ver have seen this problem before as you have mainly worked with billboards whose textures won’t be distorted at all but textures of planes and meshes will.

    so again: send me yout tree (pm with download link to the package). i hope this is ok for you. just add some crossing lines to your textures if you don’t trust me. or have a look at the tree creator tutorial and its assets.


    lars
     
    Last edited: Sep 15, 2011
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for the help lars.

    I will probably send you a tree that has this problem, but what I'm going to do is change my set up of the leaves and branches (no offence) but it took me many hours to develop a full looking tree without billboards. The problem is still there though so you'll be able to see it and see that it isn't my textures or me. I've even tested blank textures just like and all white material and the problem is still there it's just a little harder to see. I think I may have a corrupted tree creator file which is what I was afraid of.

    Thanks again I'll get a project made with one tree so you can see.
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi ik,

    i have just solved the problem and it turned out, that my first guess was right: it is all about having a good texture and tweaking its settings.

    let’s start with your original texture/texture settings:

    $01_original_texture.png

    as you can see there is one weird looking leave plane just appearing as some kind of white line.
    this plane is viewed from a very flat angle so i would think of a problem due to inaccurate texture look up.
    please note: your bark is white. as in the generated texture of the tree creator the bark’s texture appears right next to the leaves texture within the same texture atlas. it might just be the bark texture that makes the leave plane appear in white.
    so i have tested it by simply assigning a solid magenta colored texture to the bark’s material:

    $02_original_texture_test.png

    now it is clear: what you see is the bark texture.
    before fixing this problem i just improve the original leave texture a little bit:
    as you can see in the picture above you have dark outlines around all your leaves. reason for this is that you haven’t set up your color layer and alpha mask correctly. you don’t have any overfill:

    $05_alphamask.png

    see: http://unity3d.com/support/documentation/Manual/HOWTO-alphamaps.html for further details.

    reworking the leave texture in the way described above will give us much nicer edges:

    $03_optimized_texture.png

    so now it is time to get rid of the weird textured leave plane.
    simply fix this by raising the aniso level of the generated diffuse texture up to "9":

    $04_tweaked_texturesettings.png

    le voila: everything looks fine. the leaves now appear much sharper. if you have a closer look there are still some pixels where there has been the weird white line before but now they have the correct color of the leave texture.

    lars
     
    Last edited: Sep 15, 2011
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    btw:
    you have drawn your leave texture in a way that will make it impossible to get a connection between the (modeled) branch and the branches baked into the leave texture as those do not fit the leave plane’s pivot:

    $06_textureconstruct.png


    and may be you should have a deeper look into the tree creator tutorial to get more out of your trees: http://forum.unity3d.com/threads/103078-tree-creator-tutorial-%96-PUBLISHED

    lars
     
    Last edited: Sep 15, 2011
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks Lars very helpful and I'm glad you helped me solve this.

    I now know I need to use the alpha blending to get rid of the white lines, but my problem is that I don't have PS I have GIMP I'm going to be getting PS soon thought. Until then how would I do this in GIMP? Are there any pluggins for GIMP? Would a color to alpha work?

    Also about my leaves, I don't know how to rotate my textures on odd degrees, like I want rotate 30 degrees not the give 90 or 180 how can I do this?

    And yeah my leaves are like that because I didn't do much to the tree I gave you I just put them on there to show you my problem. My trees developed trees aren't like that though, but thanks for the tutorial I'll check it out.
     
    Last edited: Sep 15, 2011
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
  12. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Exactly this kind of problems is caused by non existent documentation.
     
  13. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
    Hi Ik,

    I don't have GIMP, but I have a couple of ideas that may help you get alpha blending going. First, here is a link to a page in the Unity manual FAQ about alpha textures: http://unity3d.com/support/documentation/Manual/HOWTO-alphamaps.html. It has much valuable info and a link to download a Photoshop action that generates alpha blending, called alphaUtility. I don't know if GIMP can use Photoshop actions, but in case it can't, I took a screen shot of the alpha utility action. You might be able to reproduce the steps in GIMP.

    For a second idea, here is a link to a Photoshop plugin by Flaming Pear called Solidify (part of their free plugins package) that also does alpha blending: http://www.flamingpear.com/download.html. Again, I don't know if GIMP can handle Photoshop plugins, but if not, and you get Photoshop soon, maybe you can use this.

    Zaffer