Search Unity

[Unity 3] Tree Performance

Discussion in 'Editor & General Support' started by theinfomercial, Aug 12, 2010.

  1. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    Hi Bonjour etc.

    I have a problem with the performance power of the trees that are created with tree creator. My tree in question has 1800 tris and is made up of 3 branch and 2 leaf nodes. At a distance of maybe 20 feet from a single tree, the performance is minimal impact and the trees work just like they should. But when zooming up close to a tree's leaves (or it's cast shadow on the ground), there's a huge performance drop.

    Using lots of trees (aka 5) results in near unplayable framerates. Even if you view the trees from further away.

    I have a bug report sent, here's the number: 369676

    I hope this can be fixed, because trees are kinda unusable for games right now and I need to use them for my U3 tech demo. Unless, perhaps, I'm missing something? Is there a specific way to use trees rather than just placing them on the ground randomly?
     
  2. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    You could place them in the Terrain Engine.

    We're working on a scene with a bit more than 5 Tree Creator made trees and we're not seeing a performance drop like you describe.
     
  3. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    One of the big contributors to the performance drop is realtime shadows. Are your trees casting realtime shadows? If not, then there might not be as much of a performance drop.

    I put a palm tree in my scene and duplicated it a couple of times to check the performance. The palm tree models have no real performance impact, nothing like my tree creator tree. For clarification, in the scene, I get 50-60 fps at the start. When I walk over to a tree, the framerate starts to drop the closer I get to the tree. When looking at the tree, my framerate can go down to 30-40, and looking closely at the leaves can drop my framerate to below 30! With a couple of trees close together, looking at all three, my framerate goes to about 25-30 and looking closely at the leaves can drop it to below 20!!! What's going on? This is not normal.

    Looking at the trees from a far enough distance seems to not affect the performance as harshly, while up close (with very few other objects in the view frustum), the framerate takes a dive. I tested the trees by looking at them (with a framerate of less than 30), and then deleted them and my performances boosted by about double! Just from deleting 3 trees! The draw calls went from about 800 to 700 and triangles went from 1.8 mil to about 1.6 mil. So I don't get why there's a major performance loss by having those trees there as they didn't (draw call/triangle wise) add much to the load. I mean, a difference of double the framerate from 30 to 60 is quite a bit considering it didn't really reduce the draw call/triangle count.

    So what gives? Anyone else might have this problem? Is there a way to tell if it's just this particular tree, or if it's all tree creator-made trees? I really hope it's not just me because this is a little bit odd and it's a show stopper for my game.
     
  4. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Yes, we're using shadows on the trees. What happens in a fresh scene with just the trees?

    [Edit]- ok, I just looked at your tree in the bug report. You're using a lot of very large leaves which is causing a fillrate issue. If you want the performance to improve decrease the size of the leaves or use less of them.
     
  5. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    Yep that did the trick. Fill rate issue.

    I decreased the number of leaves (putting both leaf node frequnecy settings to 1) and now have very few leaves. But the performance increase isn't all that great! Maybe an increase of 5 fps from 28 when staring at the 3 trees. Still pretty bad performance.

    What performance are you guys getting with trees? How many trees in view?
     
  6. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    same here, empty terrain, simple tree (without leaves) and bad performance when camera is close of trees models.

    Case : 370563
     
  7. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    @botumys- framerate with that scene never drops below 200fps for me, and when staring directly at a tree I was getting 500fps. There is however a weird error that pops up (submeshIndex < 0 || submeshIndex >= m_Mesh->GetSubMeshCount()) so I'll put that in our bug queue.

    @ theinfomercial - we' still have a lot of optimizing to do on this scene, that doesn't necessarily have to do with trees, but we're getting an average 45fps on this scene atm with a decent pc. There's about 15 unique Tree Creator trees on this Terrain with hundreds of them placed on the Terrain.
     

    Attached Files:

  8. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    Well....damn. Congrats on making one of the best looking Unity scenes on the forums. :) Sorry to be a bother, but I gotta know what your draw call/triangle count is and the specs of the pc. I'm guessing it's pretty good.

    I've reduced the tree leaves to as low as they can go, and decreased there size a bit. My trees are now practically bald. There's a decent performance increase, but my trees look awful and the fillrate is still nibbling away at my performance, just not as much.

    What do I do? This is literally just a handful of trees that take so much performance. But at least the game runs above 30 fps now. So I'll just leave it like this for the final.
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    What do you consider decent?

    For deferred rendering, a somewhere "minimal optimum system" is in the range of a Geforce 8800 / 9600+, the denser the scene, the higher this will go.
    None notebook naturally cause the cuts on the notebook end degrade them by at least 1 naming step
     
  10. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    there is a real problem with trees here. Even I hide them, unity continue to be very slow, like something running in baground. When I made fantasy world, I used lot of trees without problems. I have a good computer, all is up to date, I have a fresh install of unity, last beta version. But it's clearly a bug or a conflict in tree process.

    Simple example: I use tree editor to create a trunc and 2 or 3 branchs. I can turn the camera around and visual feedback is fast. I use this tree in terrain editor, I paint only one and visual feedback become slow. 2 or 3 and I get 10 or 15 fps. 10 and I have difficulties to move the camera. In 2.6, I could paint 500 or 1000 trees and visual feedback never slow down.
     
  11. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    Being able to create more than three trees with some reasonably dense leaves and not have the framerate be sliced in half from 60 to 30.

    This is the only problem I have with the tree creator. But it seems AT is the only one who isn't having this problem, and his trees are denser than mine!
     
  12. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Well, let's actually put this more accurately and say that only 2 people that we know of are having this problem on their machines (you and botumys). We've never seen this issue on all the computers that have tested the Tree Creator here at UT and have not seen other bug reports or complaints popping up all over the place.
     
  13. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Maybe my problem is due to the error message (submeshIndex < 0 || submeshIndex >=m_Mesh->GetSubMeshCount())
     
  14. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    I don't know. Maybe it's my particular tree. Doesn't really matter right now since I've got a playable framerate now.

    One thing I noticed though is that when you have windy trees, and aren't looking at a tree but rather it's shadow, the shadow doesn't update with the tree wind. Obviously this was put in for performance reasons, but I was wondering if you guys could make it so that we had a "Update when offscreen" check button. This way we could have trees be updated offscreen that have large wind animations, or if their moving shadows add a lot to the scene, or if having the shadows not be updated would just look weird.

    Any chance at that? :)
     
  15. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    ok, I've made tests here.

    Problem is present only in beta 5.

    After un-installing beta 5, I tested with beta 3 and beta 4 and I have no problem with both versions (and no error message).
    I paint 500 or 1000 trees, I move the camera and framerate is perfect.(+-100 fps) (in b3 and 4)

    I install beta 5, I make same manipulations, and 5 or 6 trees slow down all the framerate. (12 fps)

    For testing purpose, I tried to open a scene made with beta 5 in beta 4 and 3, result : tree made in beta 5 is like "corrupted" and kill fps, but a new trees created in 4 or 3 are clean.

    ps: if I use .fbx trees like before, it works well.
     
  16. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Hi again, do you find why I have this error message when I use tree made in tree creator on terrain ?
     
  17. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    The error with your trees on the terrain has to do with the tree having no leaves. The terrain engine expects a mesh with 2 materials (one for bark and one for leaves) so that is why the error was coming up. This has nothing to do with performance issues though.
     
  18. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Ok thank you.

    I really don't see why I have this performance issue with beta 5 and no problem with beta 3 and 4. (if you did not see my test, please read it page 1 of this topic)

    If somebody have time, can you share to me a simple scene created with beta 5, a terrain and trees created with tree editor painted on it ?
     
  19. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Ok, it's working!
    I added leaves and now unity react correctly. No more error message and fps is normal now.
    So, if now I want to create dead trees without leaves, I still have to add leaves but hide them ?