Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Dealing with animated trees on open terrain? [SOLVED]

Discussion in 'Animation' started by Ahab_, Jul 29, 2020.

  1. Ahab_


    May 22, 2019

    My question is:

    How can I deal with five different kind of low poly animated trees spawned over an open terrain?

    I am working solo on my first 3D project on Unifty 2019.4.3f1 and figuring out things step by step.

    Currently I am trying to set a medium size terrain mostly full of grass and and trees here and there.

    • All is low poly. And almost all shades all not active (I do other effects with just specific shaders).

    • I use Polaris 2020 as my terrain editor. I am very satisfied with it but seems like many assets to aid in Terrain editing at the store are not compatible with it. But Vegetation Studio Pro is. Would that be a solution to deal with animated trees in a more efficient way?

    • After setting up the whole scene I am able to maintain a stable 60 FPS if I don't activate the animations of the low poly trees. Otherwise goes down until 40s at best.

    • I did not baked the lights yet even when trying the build. I guess that will compensate a bit the whole performance results, but still I want know how to deal with animations no matter what.

    • I did the animations with blender adding just a few bones to each different tree model. Nothing fancy (see my second post on this thread for more info).

    I saw a few assets at the store supposedly for being able to present thousands of animations at once and such.

    But frankly I don't know if buying one of those it's the answer or I just lack some basic knowledge when it comes to open 3D terrains that I should know.

    My only other idea would be to limit the FPS to 30. The game will be a classic turn-based battle RPG, nothing fancy that would require top notch processing. Even so, I am not fully ok with limiting the game experience of people with better computers just because my inability to do better as a maker. Should I set for this?

    Thanks for your time.
    Last edited: Jul 30, 2020
  2. StefanTomov


    Aug 21, 2019
    Hey, so is the problem your fps? The animations shouldn't be what is causing such a significant drop. You did say the trees are low poly though, so it's unlikely to be that there's too much geometry.
    How many trees do you have in the scene exactly? Three things animating should cause no issue, but if you threw 50 of them in one scene and played all their animations at the same time then maybe that's the issue. Also, how low poly are we talking here?
    A screenshot might help answer those questions
  3. Ahab_


    May 22, 2019

    These are the five different tree meshes I am using:

    There are around 1200 of them spawned on the terrain. As I pointed, if they are not animated performance doesn't suffer.

    And this is the way I just animated all of them, a few bones for a soft blending effect:

    I do realize that since my animaton is just a loop of branches bending to left and right a few times, I can just bend them once to each side and just make the animation shorter.

    Maybe I could even remove a few bones here and there. Even thought this tree with 18 bones is the one with most of them.

    I also concluded that I do not need a medium terrain for this scene so I will try to redesign it in order to fit it in a smaller terrain.

    Nevertheless I still consider that the way I handle animated props -or better said, the lack of any measure taken- it's inefficient and causes performance leaks on my build.

    Thanks for reading.

    ps. This is a build for Windows PC on unity personal edition.

    BIG UPDATE: I reduced the camera far plane to 200 and it really helped. Still frame-rate it's quite unstable at some points (when camera faces the most far populated point of the terrain). I admit that I didn't think about that until now.

    Definitely I should reduce the unnecessary big size of the terrain and all its contents; but still would like to know any tricks to deal with simple animated props in a smart way if possible.
    Last edited: Jul 30, 2020
  4. Ahab_


    May 22, 2019
    In case somebody reads this in a future, the most optimal situation I found out a while ago was: shaders.

    When opening this thread I had 0 knowledge on this, but now I can say that finding the right shader to apply to my meshes was the best soultion I could came out with.

    You have different options in the Store either for whole trees/meshes or just for foliage. In that sense, sometimes using a grass animated shader also works. You can even make you own following YT tutorials if you are a newbie on this matter as I was.

    On the other side, my experience teached me that anything animated on scene by bones is performance consuming. Be careful with adding to much of it.