I accidentally started a thread on this, but in the support forum. I meant for it to be here.
In tests where I am mostly displaying full meshes (not billboards), the Unity tree system appears to be slower than just using tree gameobjects. This is very interesting to me personally, as my project makes heavy use of trees.
I’m going to create a demo project, that allows comparison between the built in tree system vs just using gameobjects, so there can be hard numbers. I may end up providing an asset that packages helpful features, like billboard creation and such. Your assistance would be helpful
Using trees from prefabs:
Pros:
You get rotation.
You get individual tree colliders, instead of the tree colliders being combined with the terrain. You know exactly which tree you are interacting with.
You can use the LOD system, to have more control over tree detail. High detail trees, then lower ones.
Unity created trees can be used also.
Much easier to work with if your project modifies trees or terrain. Modifying trees has doesn’t require unity to recreate the terrain and its collider.
Supports batching for very low detail trees.
Cons:
Have to have some way to create a billboard of the tree (if you want them).
You see each individual tree instance in the hierarchy…you’d want to parent them to a “Tree” parent so they don’t clutter everything.
Creating them all doesn’t seem as fast as Unity’s (need to verify)
Non-unity trees can have shadows and bumps. But if you want wind ALSO, you will need special shaders.
Using Unity’s system:
Pros:
You don’t have to manage LODs or anything…it automatically creates the billboard, at the correct angle of view.
Built in placement/painting tools.
You don’t actually see all of the individual tree instances.
Appears to create the trees very quickly.
Cons:
No rotation. If you want a large number of trees, this looks bad or it requires you to create multiple models.
The billboards get badly tilted when the camera tilts up and down, looks pretty bad if the billboards are somewhat close.
Only two levels of detail…full mesh and billboard.
Trees and their colliders are merged with the terrain. So you need hackish code if you want to interact with the trees, and it’s not always possible to know exactly which tree you are interacting with.
If your project modifies terrain or trees, unity has to update the whole batch. This causes hitches in gameplay for somewhat complex terrains.
Other thoughts:
I’m not sure if the Unity tree system batches low detail trees, need to see if I can verify this.
I need to see if I can get a shader that allows bumping, shadows, AND wind. This works for Unity created trees, but I’m not having luck getting this on “homemade” trees.
I have a very simple script to create individual trees from the trees painted on a terrain. So you use Unity’s built in tools to place them, then run the script and there are your individual ones.
If it is slower to create the trees from prefabs than Unity’s system, I’m curious to see how much.
I need a script that can automatically create a billboard from a tree. We might even get fancy and get one that can do a tree from different angles, but that’s going to be a little more complicated. Storing different tree billboards in an atlas, which means a tradeoff for billboard quality. It might not really be worth it when billboards are pretty far off.
I don’t see how to set LOD distances in the Unity scripting guide. I would have thought you could set the distance for each LOD stage, but I’ve done some quick searching and it looks somewhat complicated and confusing to setup via scripts. If anyone could shed some light on this…
Anyway…any thoughts or suggestions, corrections are welcome.