Trees, lot of trees. (phase 2)
by Claude-Alain Fournier · 02/01/2007 (6:27 am) · 21 comments
First a teaser :

I did some performance work, and I am happy to say that the result is worth the effort. I am still playing with that 100'000 trees forest to test my new fxTreeReplicator class. See my first blog on this subject 26 January plan.
I have made a few screen shots with the FRAPS Fps, so it will give you an idea about the performance.
All the photo and some videos can be found here
First obvious fps increase is when the impact of 3d trees rendering is at the lowest, previously I was only getting about 14fps while looking at the whole forest from a distance, with the changes I made today in the code I get 27fps from same spot. So that's pretty good, considering that it's with a non optimised VC++ compiler (I don't have the pro version).
When in a low density area the fps is also quite acceptable, but it decrease with the number of 3d rendered trees. I don't have much impact on this problem as the 3d trees are rendered as tsStatic object, then it's the Torque renderer who do the work, my code is only responsible for the 2d render.
All in all I think that the performance is good and will make only little improvement on that performance from now on. I will now concentrate on a few others problems :
- When looking at trees from at certain angles it's too obvious they are billboards, so I will add a way to draw billboard according to the viewing angle. So you will see canopy when looking from above.
- Add server collision with trees, this will require some extensive changes in the collision code, I don't have the trees known by the server and surely not as shape with coll box and all, so I will have to be clever on that one. I want to have mobs and npc running into these forests so that's a very important part.
Now back to work...

I did some performance work, and I am happy to say that the result is worth the effort. I am still playing with that 100'000 trees forest to test my new fxTreeReplicator class. See my first blog on this subject 26 January plan.
I have made a few screen shots with the FRAPS Fps, so it will give you an idea about the performance.
All the photo and some videos can be found here
First obvious fps increase is when the impact of 3d trees rendering is at the lowest, previously I was only getting about 14fps while looking at the whole forest from a distance, with the changes I made today in the code I get 27fps from same spot. So that's pretty good, considering that it's with a non optimised VC++ compiler (I don't have the pro version).
When in a low density area the fps is also quite acceptable, but it decrease with the number of 3d rendered trees. I don't have much impact on this problem as the 3d trees are rendered as tsStatic object, then it's the Torque renderer who do the work, my code is only responsible for the 2d render.
All in all I think that the performance is good and will make only little improvement on that performance from now on. I will now concentrate on a few others problems :
- When looking at trees from at certain angles it's too obvious they are billboards, so I will add a way to draw billboard according to the viewing angle. So you will see canopy when looking from above.
- Add server collision with trees, this will require some extensive changes in the collision code, I don't have the trees known by the server and surely not as shape with coll box and all, so I will have to be clever on that one. I want to have mobs and npc running into these forests so that's a very important part.
Now back to work...
About the author
Torque Owner Claude-Alain Fournier
Great, I can't wait to play with them.
@addiktive
As I say in my new blog, I want first to solve the collision part before I release it. Without the collision detection this ressource is basically useless for RTS/FPS.