"Efficient" forest path?

Hi,

What happens to trees that are not visible for the camera? Do they still consume resources?

I’m planning a terrain that involves a path through a dense forest - dense enough, so you will have to stay on that path - but I’m not sure how to do this efficiently.

My current idea is to have some trees on the sides of the path and then just a plane with a forest texture in the background, but I really wouldn’t want to slow down the game because of the trees that are not even visible.

Can the player reach those far trees?

Yes = use LOD replacements for distance (though you should be doing that already)

No = use fakes, billboards etc.

Create the terrain in such a way to limit where the player can go, and don’t model or texture anything that the player can’t see.

Thanks again,

I just read the docs on the trees, they seem to be rather smart by default after all.

The idea is that the player would not be allowed to step off the path and the far away trees would just be for background. I want to find balance between detail and performance - the planned path is pretty long, but on the other hand the player sees only a small bit at a time (it’s not straight either, so the player really doesn’t see too many trees simultaneously).

I guess a sort of tunnel-like setup would work - billboards being the walls and the path the floor. Ceiling could be omitted though, I’d rather use a skybox for the sky.

Since the player can never get too close to them, then faking it will give best results all round and allow you to make the closer stuff a little more detailed. Your distant trees and detail can be just billboards, no normal maps etc. The rule of thumb is, the further away something is, the better it can look using fewer resources.

To improve things further, look into occlusion culling (there’s an awesome script available elsewhere on this forum that does this wonderfully) if you’re not using Unity 3. Make use of that to hide area’s your player can no longer see. You mentioned a winding path and seeing things only sometimes, so that could probably work well. Doing that, using LOD’s and faking backgrounds with simple geometry, will really free up resources and let you go pretty crazy with the close up stuff.

Thanks for the tips,

I must see that script, I thought that occlusion culling was only for Unity iPhone.

Found it
http://forum.unity3d.com/viewtopic.php?t=55686&highlight=occlusion+culling

Thanks a lot for the link!

If you use Unity’s built-in terrain and terrain trees, there should be no problem. I regularily use thousands of trees in my maps without any trouble, and my forests are sometimes so dense you barely can make your way through them.

It’s a matter of fine-tuning the terrain settings such as number of mesh trees, distances, etc. so you find the right balance between visuals and performance.

Thanks for the reply,

I definitely start with the built-in trees. If it works, then I will consider building some of my own, as the built-in ones don’t really have the kind of trees I need. But for testing, they will do great.