So...Unity's terrain handling of trees...slower than just using prefabs?

For few days now, I’ve been testing/investigating something. I’m working on a project with large, outdoor scenes. And what I’ve found is…
Warning: I don’t have numbers to post yet, this is just from comparing FPS between using Unity trees and the prefabs.

I can’t get trees just placed as gameobjects on a terrain to perform worse than if I use the built in terrain system for trees. This surprises me…but maybe it shouldn’t. I guess Unity doesn’t necessarily have some magic faster tree drawing algorithm, just because they are in the terrain.

My scenes generally don’t use billboarded trees for quite some distance. The only benefits I can think of to use the tree system is when you need billboards up close, or you don’t want to see those tree gameobjects in the Hierarchy. Yes, you can paint with the tree system…but a very quick script can easily replace those with the original prefabs.

Honestly…I think having tree prefabs with different levels of LODs would work great, but I need to do more testing to see what kind of performance I can get. What would be pretty neat is to get LOD level that you can use to display a billboard of the tree.

The nice things about not using the terrain system for trees are,
You can have rotation…sure helps for a more varied forest.
You can use trees created by Unity just fine.
Trees are separated from the terrain and its collider.
You can use LODs…instead of just full mesh, then billboard.
It can batch lower detail trees in the distance.

I’m going to see about putting a demo that lets you compare the two. Anyone have any thoughts on this? I’d love to see any input or suggestions…and especially any thoughts on a billboard shader or material. I could probably attach a script to the lowest LOD, but I’d rather not unless I have to.

Thats quite interesting. I would have thought the billboards would have been faster. Ive found a lot of things about the Unity terrain system dont perform as well as expected. I guess its more of a general system designed to work on the majority of devices.

With your example projects how large is the draw distance? how many trees? whats the tree billboard distance setting?

You would expect using tree prefabs would increase the number of vertex operations on the GPU but if the fragment stage is the bottle neck then you wouldnt see a difference in performance between prefabs and billboards. This maybe the case in a simple project and its only when more objects like enemy’s, rocks, etc are added the the difference starts to show up.

Im not so surprised actually after thinking a bit on it. As you said Unity terrain system is no magic, the major benefit don’t come with the higher performance, but rather with the simplicity of getting billboards generated automatically and also some automated variation in color/size without having to do more than just add your trees to the terrain. If you make your own LOD system you are just making the same system again but with the drawback that you have to make it all yourself, but with the benefit of more control and customization. Just making a quick system with Unitys LOD groups and billboards should give pretty much the same performance i guess. Would be nice to see some hard numbers though, both on fps and drawcalls.

I’m going to continue this thread in the scripting forum, I actually didn’t mean to post it here.