Hey guys, this is another of this “why is my game so slow” thread. I know the common techniques on how to get a better performance. However, there is one problem that’s making me crazy. I have about 3800 trees (with max 3000 polycount) in my scene, but never more than 100 that the camera can actually see. Even if I drive down a road with 3 trees the framerate differs from 50 fps to 80 fps without any trees in the scene. I don’t get it. Shouldn’t frustum culling do that for me? I disabled shadows completely but that didn’t help a bit. Only deactivating the parent game object they are in helps.
Is there any advice?
Use the terrain engine, which has more optimized trees than just having them as actual objects. Frustum culling still has to cull all the objects, which isn’t free, so the more objects you have the more time has to be spent culling them.
–Eric
Thanks for your reply, Eric. It is impossible for me to use the Unity terrain engine, because I have a terrain mesh using Terrain4Mobile and therefore can’t benefit from these optimizations.
I’ll know delete all trees and set them a bit more intelligent. For example using very low poly trees behind a row of high poly trees. This will even give it a more realistic effect I guess.
It was just confusing to that although there were no trees in the view of the camera the hole game went 20 fps slower. Because at this moment it does not have to calculate any frustum culling stuff or am I wrong? Also I want to mention that the draw calls are definitely not the problem. They are constantly below 1500, which is quite a good value for this scene. I spend a lot of hours decreasing them with atlases and stuff, so it is pretty upsetting that the trees kind of ruin that work.
Using a nested cell approach to divide the cost is a great way to use a lot of objects and cut down on things. You should cull by zone before letting unity cull other things, look at your layer masks and so on… You are using occlusion culling, right? or is this unity free?
Hi hippocoder!
Unfortunately I don’t use any Occlusion Culling at the moment, because it gives me an even worse result than before. What do you mean, “cull by zone”? When setting up the Occlusion Culling I did not use any areas in order to include the hole scene (Unity doc says: “NOTE: By default if you don’t create any occlusion areas, occlusion culling will be applied to the whole scene.”)