Search Unity

SpeedTree in Unity

Discussion in 'Made With Unity' started by BHS, Apr 16, 2011.

  1. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    also don't forget to leave enough empty/negative space in your leaf texture.. this way you can make tree more rich and varied than dense repeated texture all over place..
     
  2. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    @Cupsster exactly, thats why i said that you need leaf texture with at least 512x512 resolution or even 1024 is better.
     
  3. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Oh just wanted to add one more thing you are missing from your trees are small branches. Speedtree trees have small branches placed in front of leaves, this gives some nice depth detail. Basically this branches are just textures similar to leaf texture with just plane mesh. It would be however impossible to imitate that with Unity tree builder, you can only make it by yourself in 3d app.

    Oh yes...also specular map across whole tree (custom specular, not just specular value thrown all over the model), which is missing from Unity Nature shader.
     
    Last edited: Apr 20, 2011
  4. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560


    Figured I'd give this tree creator a try for a change, using a couple of SpeedTree's textures.

    No, it's quite possible.
     
    Last edited: Apr 20, 2011
  5. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    I have made some quick setup of SpeedTree tree structure. This is custom mesh from 3ds max just to replicate how it is structured. Those middle branches between leaf and main bark are very important for whole depth feel. If you want to imitate SpeedTree V4 trees or lower, you dont need those but for anything from version 5 it is needed.

    You can use those middle branches just as second leaf texture, since it works well, but you will have to place them manualy in 3d app.


     
  6. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Frank where is that rendered from?
     
  7. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Unity 3.3

     
    Last edited: Apr 20, 2011
  8. brn

    brn

    Joined:
    Feb 8, 2011
    Posts:
    320
    Nice one frank!
     
  9. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    That looks very very good. You did good job with tree mesh itself, textures from Speedtree are also huge plus.
     
  10. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Thanks guys! Here's another (I'm having fun, not played with Unity's tree builder properly before, lol).

     
  11. Filto

    Filto

    Joined:
    Mar 15, 2009
    Posts:
    713
    Nice job frank! how about a webplayer? ;)
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ frank oz: very nice, but may be would should talk about triangle limit? let’s say between 1500 and 2500.
    and a webplayer would be very nice to evalute the overall look of the trees.

    let the game begin!
     
  13. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    What triangle limit? Oblivion has three times more trees AND grass in scene and it still run on older computers.
     
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    @frank oz yes your trees look good but you have to remember tris amounts. If I cranked up the tris amount I bet I could get a great looking tree too. Mass placing those might make you lag a lot. My tree was 1,400 tris and I could mass place them and not lag at all. I did use one set of branches off my main branches but they're short. I'll have to adjust the leaves they are kind of bunched up. I'll give it a shot when I get the chance and post my results.

    Also frank oz could you post the SpeedTree texture so I could give it a try too? I can't seem to find any. Duke made a good point start off with the actual SpeedTree textures so I know what it'll look like and try to replicate it.
     
    Last edited: Apr 20, 2011
  15. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    What makes you think the polycount is jacked up? The count is not much more than yours per tree. Plus you have to find a good medium between polycount and OTT optimization, you can't make a sphere with a three sided object.

    90% of what you're seeing in those pics are billboards. All those tiny branches - billboards, leaves - billboards. The branches just appear 3D due to their normal maps, and chaos with the human eyes need to fill in the gaps, creates more detail than there is. Also mine didn't have LOD's or distant billboards setup in those pics, so obviously a large number of them will bump the polycount (though amusingly the second one has smaller polycounts even though there's more trees in there than the first), but you'd not use them that way, you'd setup LOD's (which I felt there was no point in doing for a simple example) and drop the detail with distance while the farthest versions you'd use a cross style (+) representation, or a simple billboard depending on situation and requirement.

    Done in Unity Tree making thingy, same as you. Polycount in these are not an issue unless you're making trees for mobiles. But obviously if you drop a thousand of them into a scene -as is- without thinking of LOD's it'll kill framerate, that's just common sense.

    Try being more creative with the base trunk to get a more gnarly effect rather than the single cylinder look which only works for a few trees, large oaks and other old big trees are bulbous and uneven looking. Also make use of breaks and caps to get a more believable feel (though I noticed the leaves and billboard branches will still appear on phantom limbs in Unity's tree editor), so best to watch for that because it looks weird. Think of how a tree itself grows, it twists and curves around while sprouting other branches, even the somewhat smooth cylinder like ones are uneven. Consider using Fronds for smaller tiny branches or leaves (good for pine or palm trees ala one of the examples in SpeedTree).

    Oblivion had nice trees (hey, it's one of my favorite games!), but I'd not use them for comparison when trying to create good trees.


    @others come on guys, you know my views on webplayers. Ain't gonna happen :) Besides, there's nothing fancy in there, just used what comes with Unity (except the bark and leaf textures I'm using from SpeedTree, but those aren't anything special and certainly nothing that couldn't be replaced with a quick google images search), and a few minutes playing around. You could probably get something even better if you go on to edit the limbs by hand, these were just procedural. Or spend longer on individual trees instead of copy/pasting and rotating the same ones like I did. Or export the base mesh and use that Ivy generator to wrap Ivy around it. Add flowers and buds, hanging things, vines, grass, nests, bushes etc. etc.. Most you could do with just flat textures or simple noisy blob meshes, and let the complexity trick the eye into seeing more detail. Works for Crytek and practically every SFX studio :)
     
  16. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    I second whole post.

    Why do you worry so much about poly count. You wont be able to get near SpeedTree if you wont spend some more polys on tree. You have to know that you are limited with worse render than SpeedTree-s, or any other engine that uses it so you have to fill some spot which will give you a additional point. If you are really tring to create huge forest landscape with billboard tree distance very far then it will be problem. Otherwise if you are using some medium use of trees you shouldnt worry that much.



    Thats what i was saying before. Bottom part of tree is very important. Tweak settings with Unity tree builder as much as possible for nice result. Also i just looked at some SpeedTree trees and basically main trunk is not 8 sided cylinder but rather double of that or even more.

    I would post you SpeedTree textures, but you never know if those guys lurk here arround.
     
  17. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    very impressed with this...
     
  18. Filto

    Filto

    Joined:
    Mar 15, 2009
    Posts:
    713
    No I don't. You believe they are portal holes for cenobites? ;)
     
  19. Baardo

    Baardo

    Joined:
    May 9, 2010
    Posts:
    98
    if the image is to be believed you got this result by only using two branch nodes and a leaf node? o_O

    I can never get such complex shapes by using such few nodes. Did you use a mesh for the trunk or did you actually use the tree creator?
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    @tyrantTR exactly what I was thinking. If you tried that with speedtree the tris cout wouldve been 5,000+. I'd like to know how you did it though.

    And I've figured out another huge step to creating speedtree looking trees. It's the translucency, normals, and shinny effect on the leaves. I think I've finally gotten the speedtree look. I also am able to shade the trees so they receive and cast full shadows. I'll post the results soon.
     
  21. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    I have to create Mangrova tree for my game and i am wondering if anyone would know how could i create this long roots since all trees with builder start from trunk.
     
  22. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Absolutely 100% nothing but the tree creator. When you create your base trunk, use frequency to generate more than one trunk, the pull them in close so they almost act as a single trunk (use curves to have them spread out the higher up they get), add some crinkle and noise (again make use of the curves to control it), have AO switched on cause it helps a lot, use the flare for the base, bend it slightly, then add your actual branches, bit more randomness to them and have them start further up, then add your leaves to those as billboards, add your materials and you're done.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Here's the bush fully textured with normals, gloss, translucency, and shadow offset. Able to receive and cast full shadows as well as have a glare shinny effect like SpeedTree. Bush only has 750 tris.

    Fully textured bush:
    $Bush fully textured.jpg
    $bush fully textured 3.jpg
    $Bush fully textured 2.jpg

    Bush scene with some effects:
    $Bush fully textured with some effects.jpg
     
    Last edited: Apr 20, 2011
  24. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Aside of the oblivion "the world is polished and never gets dirty" spec overdrive they look great :)
     
  25. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Nice IK, but gloss ammount is way too high. This nature shader has some wierd control of displaying specularity, actually the problem is becouse it displays is at gloss not as pure specular, so it looks too wet. If you could somehow rewritte shader to accept specular texture and effect only specularity that would be great.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks guys. Yeah I've been trying to figure out a way to adjust the gloss but I don't think there's a way to do it. I'll keep trying though. I think some gloss is better than no gloss because it really does make a difference.
     
  27. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Actually Pinhead has a restraining order out on me for pestering him for an autograph, and for trying to chat up the bald female from the first film.

    I'm more worried about finding a family of C.H.U.D, they're attracted to webplayers.
     
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Reduced glare accomplished :)
    A little bit:
    $Accomplished Reduced Glare.jpg

    A lot:
    $Glare reduced a lot.jpg

    Better? Not enough? Some Feedback?
    I think it's a good amount
     
    Last edited: Apr 20, 2011
  29. Baardo

    Baardo

    Joined:
    May 9, 2010
    Posts:
    98
    @lk animation: It looks ok to be honest but looks aren't really bother me about it.

    As an avid Washington Hiker, I have never really seen large bushes like these in forests and plains hikes alike. Not to say such bushes don't exist but it seems to me if your trying to represent forests your going to want less of these and more pine saplings and ferns.
    Oh and I dunno if its just the image but it seems the specualrity makes a weird rim around the edge of the alpha, this could be your spec map or your shader IDK which.

    @FrankOz: Thanks for the tip, been trying to nail that gnarled look for weeks. Maybe this'll help me out.

    Offtopic: lol C.H.U.D.s
     
  30. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    IK it look much better with less gloss now, but as Tyrant said you have some wierd white edges arround leaf. Try to add more alpha cut in material inspector, or manualy adjust a bit more alpha "cutting" into leaf on color texture in PSD.

    If you could add some sort of second leaf texture on that bush it would make huge differance in realistic look.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ frank: you really did some very nice trees, some of the most beautiful i have seen in unity, but i guess the triangle count [as shown in your screenshoot: 21.000] is much to high in order to use them within a wide landscape or even dense forest:

    http://www.incrysis.com/forums/viewtopic.php?pid=418173
    Here's the reply from Crytek when the Obsidian Edge asked them some questions. You can read the full interview on www.obsidianedge.net
    [...]
    Vegetation
    Between 500 and 2500 triangles for trees –whereas the ones with 2500 should not be used in a dense forest because of the filtrate – It heavily depends on the scenery you want to create.

    by the way: adding branches as billboards might lead to floating ones, at least on your screenshoot it looks as if they would. i would rather add them as planes or even modeled geometry.

    $Bildschirmfoto 2011-04-20 um 22.25.16.png

    and sorry – i don’t know your views on webplayers. as we are talking about the look of billboarded leaves i think it is very important to look at them "in action": walking around, looking at yout trees from different directions. so the only convincing proof would be a webplayer no matter how nice and polished any screeshoots might look. unity is a game engine not a picture processor. :)

    unfortunately exporting the generated tree and finish it anín any 3d app is not an option as you cannot use the advanced tree shaders [bump, specular, tranclucency] on imported models – at least not as far as i know. that’s a petty.

    @ IK: nice effort. and it is pretty easy to influence the specularity but adjusting the gradiation/gamma of your glossmap.
    p.s.: have a look at the edges of your leave texture. but overall it looks nice.
     
    Last edited: Apr 20, 2011
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks. Yeah I saw that it was the alpha cutoff I increased it and it fixed the problem, but doing so also reduces the shadows intensity and fullness.
     
  33. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Thanks :) Not bad for a first couple of attempts with it, was quite impressed with the results it's capable of too. I'm hoping someone with more experience in it can have a go and post what they can do, see how far it can be pushed (I'm also curious what else it can be used for, besides trees).

    I mention the floating branch problem further up (also happens with the leaves), it's caused by using breaks for branches you apply the billboards to. When you break a branch in the Unity tree maker thing, it still "exists" internally, as in its spline is still there, so the billboards are still applied to the now phantom branch, thinking it still exists. It's avoidable by not using breaks on branches you'd put leaves/branches on, and you'd rarely want to use breaks on those branches anyway, since the leaves would hide them for the most part, and really broken branches are only going to be noticeable/useful on bare or dead trees anyway. So it's not a serious problem, just something to watch out for, which I didn't until after I'd done it.. then quietly hoped nobody would notice.. you bastard.. ;) haha.


    As for the polycount, as I say, I made no effort to create LOD versions, which you most certainly would want to do if you used them properly (as well as spend more than a few minutes on them). Though I suppose if you're using these trees on Unity terrain, the LOD is taken care of automatically right? I'm not sure, I don't use Unity's terrain so I don't know how it handles trees these days.

    Also I looked again to see why that first scene had such a huge count, I did have the settings on high, while the second was more reasonable. Anyway as for the trees themselves, you can drop the polycount down quite a bit and they still look ok. Though as I mention below, I'd rather have proper access to them as actual objects and run them through software made specifically for polygon reduction before I'd consider using them. BUT, that's only because I don't use Unity terrain and so the other features of these trees have to be done in external ways. It's just personal preference really.


    Personally I would want to be able to convert the trees created in Unity to regular meshes, without the overhead of the tree maker stuff still active, then I can deal with them as regular objects, create regular LOD's and optimizations, add regular billboards my own way, along with custom shaders that work with lightmapping, at least for the bark, the leaves I kinda like the shader that uses, plus I don't want the headache of lightmapping the huge number of billboards those would use. One of the reasons I prefer to do it in ZBrush from scratch, you get more control over the final object. Having these constantly in editable "tree mode" makes me uncomfortable for some reason.


    As for how it looks, well I mentioned further up how I did them, nothing special was used, and anyone can do it exactly the same, or hopefully better. You could probably grab textures to use for it on google, but as others have said, we're not allowed to post the SpeedTree ones (they're nothing special or magical tho).
     
  34. Vinícius Sanctus

    Vinícius Sanctus

    Joined:
    Dec 14, 2009
    Posts:
    282
    Save the trees! =)

    I just read the whole post and I think Ik is doing great.

    He´ve got the main property of any succeder, he just won´t give the f* up!

    I bet he´ll make his own speed tree soon enough!

    Hugs! =)
     
  35. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    @larsbertram 21k triangles for his foresnt isnt nothing, and with LODs he could be even lower.
    About your CE2 vegetation triangle limit....This was used in Crysis 1 so about few years ago, and current Crysis has pushed this further. Also you cant compare Crysis forest with 90% rest of games becouse that forest in their game is really full. I mean like plant next to plant. Not just trees, there are plenty of middle plants and ground plants so this means that if you are using only huge trees like Frank on his scene he can count 1 tree for 4 Crysis plants on 1 plant area. All i am saying that people are bothering with triangle count too much, this is only usefull if you can give some straightforward informations on table where you know how will you use your models and where. Otherwise this are just some speculations.
     
  36. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Exactly, modern HW can render in perfect framerate 10m triangel scene like nothing. Draw calls are much more important. When you have smart lod system and oclussion, it is no problem to run almost anything. I have 280k triangel ship model, with plenty of materials. And guess what? Even on ancient HW it is fluent.
     
  37. Filto

    Filto

    Joined:
    Mar 15, 2009
    Posts:
    713
    I might be wrong but isn't it the alphasorting from all the billboards that eats up performance rather than polycount. I assume that all the polys didn't go into just the treetrunk?
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ janpec: it is not 21k triangles for the forest but for each single tree. nevertheless i just made a quick test to find out, created a little forest of 40 visible mesh trees using the terrain engine and got the following results (mac book pro / nvidia geforce 9600m gt / 512 mb):

    40 mesh trees each with 1400 tris:
    393 draw calls
    262 k tris
    ~ 15.0 fps

    40 mesh trees each with 2500 tris:
    447 draw calls
    524 k tris
    ~ 9.5 fps

    i did not change anything but just the tree model and was pretty surprised that even the number of draw calls raised on using the high poly model. so to me it’s pretty clear that keeping the number of triangles per tree between 1000 – 2500 if it used in a dense forest is the way to go as the terrain engine doesn’t support LOD apart from billboards.
     
  39. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Yeh that alpha rendering takes a lot of performance. I have run test with that unity performance tool and figured that alpha rendering in my scene takes 30% of whole rendering performance, when there is some grass on screen.
     
  40. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Larsbertram, but take a look from another perspective. You lost just 6 frames with 2x triangle count on tree. So if you draw a line, graphic quality in your test wins overall optimisation problems.
     
  41. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    @Everyone yeah it's when you add effects like bump, translucency, and gloss is when your performance drops. Also if you were to have those effects of a 2500 tree the difference would probably be more noticeable.

    I really like the way Crysis does their plants and I'm going to try to do it. It's not that I can't do it, it's just hard to do efficiently.
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ filto: you might be right: doing the test again, this time using trees with mesh modeled leaves instead of billbords, ends up in this:

    40 mesh trees (leaves as mesh) each with 1400 tris:
    393 draw calls
    276 k tris
    ~ 17.5 fps

    40 mesh trees (leaves as mesh) each with 4320 tris:
    393 draw calls
    771 k tris
    ~ 15.0 fps

    number of draw calls stays the same and the loss of fps in less dramatically.
    so it is mesh trees!
     
  43. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Well its good for you that you dont give up, but i am strong with opinion that you cant fake SpeedTree quality. Workflow, speed, quallity....etc its hard to match any of those SpeedTree values for your trees.

    If you want to achive something what SpeedTree doesnt have, you should check out Unigine tree engine. They use SpeedTree, but they have their own wind effect which is applied on leaf UV space. It creates nice "living" trees.
     
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Yeah, I know what you guys mean about the tris thing it is only a factor if you're going to be adding all the textures like gloss.

    I'm going to try building a tree and not worrying about the tris amount, but just try to recreate a speed tree the best I can. I'm obviously going to be reasonable though. So far I'm up to 6,800 tris but I did increase the LOD to smooth it out.

    Here's the bare and tree branches so far:
    $BareTreeNoTrisLimit.jpg
     
  45. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Mesh is good, but tweak texture a bit. Add stronger normals, and specularity also get better resolution.
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Alright I'll do that thanks for the tip. Here's the tree so far I think it turned out pretty good. You can get a lot more of a full look with having more branches.

    Total tris count 9,104:
    $Tree9104tris.jpg
     
  47. Baardo

    Baardo

    Joined:
    May 9, 2010
    Posts:
    98
    It looks good but the tri count is a bit higher then I'd let most character models even get. (though I suppose this is the point.)

    I was looking at some of the examples that came with Speed Tree for the UDK to see how they built there trees. For the conifers it looks like they had one branch node, and then one frond node, with a bare branch texture, then they added leave nodes on-top of that which created a similar look to what you have now.
     
  48. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    I like that SpeedTree conifer very much.:D
     
  49. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
  50. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    That library is just amazing. What amazes me the most in that software is quallity increase from version 4.2 to 5. Its like totally new software. I havent seen jump like this on any other CG software yet.