Search Unity

tree creator tutorial – PUBLISHED

Discussion in 'Community Learning & Teaching' started by larsbertram1, Sep 3, 2011.

  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Hey lars,

    Okay I did an experiment and I wanted to see if Unity's tree textures (from the big tree included with the tree creator) had the same problem. And what I figured, it did. I did what you said and I managed to cover up or blend the lines but they're still there. I think this is a problem is deeper than just textures. I think it's a bug and Unity needs to get on it.

    I've decided I'm going with mesh because I can go around this problem by not having visible angles of the planes. I'll have a warped plane which will make it impossible for people to see Unity's flaws ;).

    Soon I'll be able to release my new pack which I'm excited for now that this problem isn't in the way.
    Here's a little look at my new trees what do you think?
    $NewRealTreesDemo.jpg
     
    Last edited: Sep 16, 2011
  2. Zaffer

    Zaffer

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

    Thank you so much for making your Tree Creator tutorial. You have answered many, many questions I had about tree creator. Your trees are very beautiful and realistic looking.

    I have been using Tree Creator for about 6 months now, creating several varieties of trees and bushes. Because I did not understand how to use the growth parameters (thanks so much for explaining them), I took a different approach and did most of my modeling manually, right from the start. (This is very time consuming. Thanks to you, I will be able to get started much more quickly now.)

    Also, I did not understand how to get leaf groups to "attach" at a certain point by using the mesh option, so I went with a "radial" approach to leaf design. Here is my birch leaf as an example (based on a leaf group from AsileFX Leaves Collection). I found that this radial design looked best using the billboard option. Billboard seemed to make the tree look much fuller than any plane option, and I liked the look. Here are screen shots of two of my finished trees, a birch and a maple. http://bitsong.com/forPosting/Unity/birch_maple.html

    Along the way I ran into several problems. The biggest problem was scale. I had made the trees a little too big for the landscape, so I used the tree height and width sliders in the Terrain Inspector to make them smaller when I added them to the terrain. They looked OK until I discovered Vertex Lit mode. Then they looked terrible. (Please see my posthttp://forum.unity3d.com/threads/92963-tree-vertex-lit-problem-forest-fire! if you are interested.)

    At that point, I decided to remake all my trees and bushes (18 total) to the correct scale so I would not have to use the height and width sliders in the Terrain Inspector. I have just finished remaking them. After reading your tutorial, I am wondering if I should start again with my trees, making all the leaves as meshes instead of billboard. However, I do like the way they look as billboard (and the thought of remaking them all a 3rd time is, I admit, a bit discouraging). Can you tell me, is there any compelling reason not to use billboard as far as performance? Does billboard make for a much bigger performance hit than mesh? Thanks.

    Zaffer
     
  3. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Ik nice trees you got there.
     
  4. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
    Thanks Janpec!
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @Zaffer:
    i have not spend much time on creating trees using billboarded leaves, but as far as i know you will get some problems using them within the terrain engine because their billboarded version will be cropped in a rather strange way –*which is a rather strange sentence i have to admit. but janpec and some others users reported about a bug in the terrain engine.
    second: i really do not like the look of those trees.
    but as you are asking especially about the performance of billboarded leaves – i really don’t know. the triangle count should be rather low. overdraw in the mid range… they should be pretty cheap to render. but i am not sure about this.

    as far as the problem about scale in vertex lit mode is concerned: i have not noticed this before but you are right. i have filed a bug report.

    and: many thanks for your kind words!

    lars
     
    Last edited: Sep 18, 2011
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ ik:
    very nice trees. i am glad that you are going with mesh modeled trees right now.
    i like them much better than the billboarded ones, but it is pretty difficult to judge them just from a picture. a webplayer would be nice.

    lars
     
    Last edited: Sep 18, 2011
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ik:

    rotating using gimp: maybe you want to have a look at this:
    http://docs.gimp.org/en/gimp-tools-transform.html

    it is not a problem with the original textures but with the aniso level of the generated diffuse map. just raise it up to "9" then neither unity's tree texture nor yours will show the artifacts.
    and no: it is not a bug. it is just the way it is. read here to get a deeper understanding:
    http://en.wikipedia.org/wiki/Anisotropic_filtering


    lars.
     
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Actually it was a bug, but only to my Unity 3d engine. I uninstalled it on my laptop, which had the exact same Unity file as my desktop, and installed the exe file from the download section of Unity's downloading page. After installing the new file the problem was gone, for the most part like you said. The aniso levels were all the way up to 9 and the problem was still on my desktop; that was with both my textures and Unity's textures.

    And thanks for the GIMP rotation help I ended up figuring it out. It's a very handy tool.
     
  9. Zaffer

    Zaffer

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

    Thanks for the info. I did notice that the triangle count on my billboard trees is quite low, which is an advantage; however, I did notice the problem with cropping with distance with my billboard trees. Maybe that is a reason to try mesh trees. Thanks.

    Zaffer
     
  10. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
    Hi IK and Janpec,

    I agree with Janpec, IK -- nice looking trees. Sorry I took Janpec's compliment to you as my own. I am going to try some mesh leaves.

    Zaffer
     
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    @zaffer thanks no problem, it's cool. If you want take a look at my tree packs they all use billboards and they look great. Oblivion used billboarded trees and their forests look amazing.
     
  12. Zaffer

    Zaffer

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

    I did take a look at your tree packs; they are great! I particularly liked the cypress oak forest. I also looked at a preview of Oblivion and I think those billboard trees are, as you say, awesome. Thanks for letting me know.

    For my own project, I am working on making a landscape that is reminiscent of the Wisconsin countryside near where I live -- high summer, grass, flowers, trees, a path in the woods. Here is a still image of some of my trees -- a maple in the foreground, a couple of birches, red maple, oak tree and some bushes:

    I think that in my case, for the look I am after, billboarding helps by making the trees look full and lush.

    Zaffer

    P.S. I posted some ideas about how you might be able to get alpha blending going in GIMP on your thread: http://forum.unity3d.com/threads/104255-Tree-creator-bug-when-using-planes-for-leaves-and-causes-glitching-lines-in-leaves?p=693102#post693102 Hope it helps. Keep up the good work!
     
  13. Zaffer

    Zaffer

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

    Thanks for filing the bug report. However, I am not sure it is a bug. I think it's just the way vertex lit works. Hope it is something Unity can fix. In the meantime, I am making all my trees strictly to scale.

    I have noticed that my billboard trees do tend to "square off" in the distance. I am working on different techniques to deal with this. I think there is room for both approaches to making leaves. I am going to go on with my billboard trees for now and at the same time, explore mesh trees. Thanks again for your tutorial.

    Zaffer
     
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @zaffer: looks nice so far. maybe a little bit flat but this is due to vertex lit i guess.
    do you mind to publish a webplayer because this is the only possibility to judge the appearenace of any tree – especially billboarded ones?

    lars
     
  15. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Hm i think that this is scale related issue. If you rescale tree too much in terrain tree dialog this problem appears.
     
  16. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
    Hi Lars and Janpec,

    Thanks Lars; here is a link to my scene in the Unity webplayer. I hope you enjoy your stroll in my version of the Wisconsin countryside http://bitsong.com/Unity/Summer_Day/WebPlayer/WebPlayer.html

    As for the "flatness" you mention, it is not because of vertex lit. I am not using that. I have specified "forward" in my Project/Player settings. I was only worried about vertex lit because this is what older machines with older graphics cards use when running Unity web player. I did a survey among some friends with older machines and found that many computers more than 5 years old ran my scene in vertex lit even though I had specified "forward". This is because the older graphics cards can't handle "forward" lighting. I think the flatness you mention might be due to the fact that there are no shadows. I do not yet own Unity Pro, but I am saving up my pennies and hoping it goes on sale soon! Then I will have shadows and other wonderful things!

    Hi Janpec, Thanks for the tip. I did lots of experimenting and found the thing that influences this problem the most is Billboard Start in the Tree and Detail Objects section of the Gear tab of the Terrain Inspector. The higher I make this setting, the farther the distance I can go before the nicely rounded trees pop into cube shape. However, I don't know how this setting affects performance -- probably slow things down to have a high setting. I am hoping that if I ever am able to get Unity Pro the profiler will tell me about things like this.

    Zaffer
     
  17. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
    Hi Lars and Janpec,

    Thanks Lars; here is a link to my scene in the Unity webplayer. I hope you enjoy your stroll in my version of the Wisconsin countryside http://bitsong.com/Unity/Summer_Day/WebPlayer/WebPlayer.html

    As for the "flatness" you mention, it is not because of vertex lit. I am not using that. I have specified "forward" in my Project/Player settings. I was only worried about vertex lit because this is what older machines with older graphics cards use when running Unity web player. I did a survey among some friends with older machines and found that many computers more than 5 years old ran my scene in vertex lit even though I had specified "forward". This is because the older graphics cards can't handle "forward" lighting. I think the flatness you mention might be due to the fact that there are no shadows. I do not yet own Unity Pro, but I am saving up my pennies and hoping it goes on sale soon! Then I will have shadows and other wonderful things!

    Hi Janpec, Thanks for the tip. I did lots of experimenting and found the thing that influences this problem the most is Billboard Start in the Tree and Detail Objects section of the Gear tab of the Terrain Inspector. The higher I make this setting, the farther the distance I can go before the nicely rounded trees pop into cube shape. However, I don't know how this setting affects performance -- probably slow things down to have a high setting. I am hoping that if I ever am able to get Unity Pro the profiler will tell me about things like this.

    Zaffer
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    of course raising the billboard start affects the performance as the number of mesh trees will raise the number of draw calls (each 3 – 6 draw calls), triangles and cost you a lot of fillrate whereas all billboarded trees are drawn within just one drawcall.
    i have reproduced your problem with cube shaped billboards and it seems that unity is unable to calculate correctly sized bounding billboards. the higher the difference between leaves’ outer shape and branches’ outer shape the more often you will get this problem. i have tried to get around this adding some invisible large branches but without any success. so try to keep the leaves tight to the branches…
    it is a bug i would say…

    lars
     
  19. Zaffer

    Zaffer

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

    Thanks for experimenting with this problem for me and thanks for the tips about the outer shape of the leaves. I have been experimenting with mesh leaves and other things I learned from your tutorial. Keep up the good work!

    Zaffer
     
  20. fredborg

    fredborg

    Joined:
    Sep 22, 2011
    Posts:
    4
    Great tutorial, nice to see someone using the tree creator :)
     
  21. Zaffer

    Zaffer

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

    I very much like the look of this tree. Could you please explain what you meant by "using tree creator in order to create leaf group textures" and explain how you did it? Thanks.

    Zaffer
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @zaffer: this is about how to create the leave texture: instead of using photos of leaves combining them using photoshop to a full branch i have tried to just use a picture of a single leave and then model the whole branch within the tree creator. so:
    - get your basic textures (leave: diffuse, normal, gloss / branch: diffuse, normal) into unity
    - model your branch using the tree creator (number of polys does not count)
    - take a screenshoot (or export the branch to your 3d app --> render it)
    - rework the the screenshot/rendering so it is a valid alpha mask and bring it back to unity

    have a look at the tree creator tutorial files at the asset store to find out more.


    lars
     
  23. Zaffer

    Zaffer

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

    It took me awhile, but I finally got it! You used Unity to create a branch which you then used for your sycamore tree -- ingenious! I had thought the branch itself was a young tree, a sapling. Thanks.

    Zaffer
     
  24. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ zaffer:
    http://forum.unity3d.com/threads/105887-Texture-issue
    -> the trees do not look as if they were created using the tree creator: just 2 flat planes for each tree. it might have something to do with the mipmapping of the texture or the shader – i do not know.

    http://forum.unity3d.com/threads/105...texture-alphas
    there is no way to get soft alphas in unity > 2.6 especially not when using deferred rendering mode. the only way to soften edges is to use a post precessing image effect (pro only).

    lars
     
  26. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    I have problem with color shift when switching from billboad to mesh. Billboard is much lighter. Is it possible to solve it?
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @Demostenes: as far as i know: it is not possible to solve it: the bright appearance of the billboards is caused by translucency (baked into the billboard texture) and missing shadows (not baked). it is pretty annoying but i don’t know any way to make the transition smoother... so file a bug or feature request!

    lars
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  29. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    I compared tree creator billboards to standard mesh trees and there are billboards OK. That mean this is bug only in tree creator shader. It shouldnt be problem to fix it....anybody tried?
     
  30. AlexMarch

    AlexMarch

    Joined:
    Oct 25, 2011
    Posts:
    2
    how to adjust the texture?

     
  31. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Seems like someone has SpeedTree tree on left side of screenshot:D
     
  32. AlexMarch

    AlexMarch

    Joined:
    Oct 25, 2011
    Posts:
    2
  33. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    This is a great tutorial, thanks for sharing it.
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi artician,

    thanks a lot lot. at last something going on in this thread. do you have any pictures of your efforts you want to share? do not hesitate to post them here. i guess, everybody would love to see some pictures of what you can do with the tree creator and – of course – where its limits are.

    lars
     
  35. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Just a question. How do you create the leaves group texture from that twig?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    just maximise your preview window and take a screenshoot from the twig.
    the solid grey in the background should make it easy to create a alpha mask.
    after having created a layer just containing the branch and the leaves (no grey but transparent pixels), double it and use some filter to extend the branch and leave – arghh – pixels/texture whatever. anyway – just have a look at: http://unity3d.com/support/documentation/Manual/HOWTO-alphamaps.html

    lars
     
  37. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Wonderful tutorial! I have been looking for something like this! Great work! Thanks for sharing!
     
  38. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    Hey Lars,

    I may post some things when I have them working. I am importing my own trees from 3dsmax, and am running into that black-texture problem. (Not using lightmaps, using the nature shaders). No idea whats up with it!
     
  39. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    The nature shader working only with trees from Unity's tree creator as far as I know. Not with imported models. But I might be wrong.
     
  40. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    It seems to work with some of my imported trees, but not others. It looks great when it works. I'll probably make a big noise thread about the issues in Support when I have time this holiday. If anyone else here has suggestions though, I welcome them!

    Happy holidays.
     
  41. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    It seems to work with some of my imported trees, but not others. It looks great when it works. I'll probably make a big noise thread about the issues in Support when I have time this holiday. If anyone else here has suggestions though, I welcome them!

    Happy holidays.
     
  42. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106

    There are two shader groups. One group for tree creator, second for trees made somewhere else. In that case you need to have exacly two materials on the tree, one for bark, second for leaves.
     
  43. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Thanks for this great tutorial,
    Here's the result by following your guideline.

     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @botumys: very nice work!
     
  45. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Thanks to you for this tutorial ;)
     
  46. bhall27

    bhall27

    Joined:
    Feb 21, 2012
    Posts:
    9
    Is it normal for a tree you make to lose its material when you modify a setting on it? I've been making a few trees, applying a material, then I goto adjust something in the mesh and it loses the material assigned.

    Thanks,
    Brian
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    no, that is not the usual behavior… although i have encountered several problems with the tree creator and unity 3.5…
    may be you should file a bug?

    lars
     
  48. bhall27

    bhall27

    Joined:
    Feb 21, 2012
    Posts:
    9

    will do thanks!
     
  49. nofosu1

    nofosu1

    Joined:
    Jan 13, 2011
    Posts:
    73
    This was very useful. Thanks!

    Excellent work!
     
    Last edited: Feb 21, 2012
  50. ant001

    ant001

    Joined:
    Dec 15, 2010
    Posts:
    116
    @janpec,

    i'd be interested on any links you have regarding this.