Trees, lot of trees.
by Claude-Alain Fournier · 01/26/2007 (1:18 pm) · 22 comments
My first blog ;)
What is this post all about ? Trees, lot of trees and performance.

More screenshots and video here : TreeReplicator
I am the Lead programmer for Adellion a MMORPG in the making. I don't want to discuss this project here, that's not the goal of this post, but discuss a little part of the project I am currently working on. In Adellion we have a huge island with many different terrain type and tree and vegetations. So my current goal is to be able to lay down forests, but not just a few trees, no, I want forest by the Kilometer. I waited long enough for the forest pack, it was promising and in fact made me postpone my work in that area in the hope that I would see the forest pack released one day, but I start to get impatient.
So to make a long story short, here is what I success I have so far.
You can see on Youtube a few videos I took during the development.
Last video is bad quality on Youtube, try this link : TreeReplicator
The idea is to have billboards of tree replaced by 3d models at a certain distance. Now I did not want to rewrite the whole engine so I took apart fxFoliageReplicator and fxShapeReplicator and kind of merged them. This gave some mixed results, while I was able to have 1000's of tree in a forest, the performance where not that good and the limit for number of tree was quickly attained.
Then I realised that I took it the wrong way, I was using fxShapeReplicator to create the trees and attached a billboard to each, this proved to be a bad idea, the scene renderer has to go thru 1000's of shapes at each pass. Using fxShapeReplicator I loose the ability to use quadtree system to render foliages as buffers, which is realy good for performance.
So I rewrote the whole and used fxFoliageReplicator as a base. Now I can benefit of the quadtree sorting and buffer render. One of my video show 200'000 trees over a 4km x 4km area. It's impressive to see in game. Latest video show the result with integration of 3d tree models, in the last video I show the same forest with 100'000 trees, I made new billboards as I had to change the tree I was using for testing, the pine tree and banana trees I used previously where too high in polys (~2500) the new trees are from the RST environment pack, swamp area, they are very nice looking and low in polys (~300). So in the last video you can clearly see the change from billboard to 3d model, I left a color difference so it's well visible.
For the 3d model, I use a little trick, I don't create one tree model per tree in the forest (imagine 100'000 tsStatic ;) ) but about 50 for each tree type, and store them in a pool, where I take them as needed. When not rendered a shape is taken out of the scene, and added only when required.
So it's not yet perfect, far from it, but still it's a good start. On the performance side I get around 15fps on a non optimised compile. And there are still lot of improvements for performance.
Once I have something good enough, I plan to release this as a ressource. Be aware that I work on TGEA (TSE) only so TGE users will have to port it themself.
What is this post all about ? Trees, lot of trees and performance.

More screenshots and video here : TreeReplicator
I am the Lead programmer for Adellion a MMORPG in the making. I don't want to discuss this project here, that's not the goal of this post, but discuss a little part of the project I am currently working on. In Adellion we have a huge island with many different terrain type and tree and vegetations. So my current goal is to be able to lay down forests, but not just a few trees, no, I want forest by the Kilometer. I waited long enough for the forest pack, it was promising and in fact made me postpone my work in that area in the hope that I would see the forest pack released one day, but I start to get impatient.
So to make a long story short, here is what I success I have so far.
You can see on Youtube a few videos I took during the development.
Last video is bad quality on Youtube, try this link : TreeReplicator
The idea is to have billboards of tree replaced by 3d models at a certain distance. Now I did not want to rewrite the whole engine so I took apart fxFoliageReplicator and fxShapeReplicator and kind of merged them. This gave some mixed results, while I was able to have 1000's of tree in a forest, the performance where not that good and the limit for number of tree was quickly attained.
Then I realised that I took it the wrong way, I was using fxShapeReplicator to create the trees and attached a billboard to each, this proved to be a bad idea, the scene renderer has to go thru 1000's of shapes at each pass. Using fxShapeReplicator I loose the ability to use quadtree system to render foliages as buffers, which is realy good for performance.
So I rewrote the whole and used fxFoliageReplicator as a base. Now I can benefit of the quadtree sorting and buffer render. One of my video show 200'000 trees over a 4km x 4km area. It's impressive to see in game. Latest video show the result with integration of 3d tree models, in the last video I show the same forest with 100'000 trees, I made new billboards as I had to change the tree I was using for testing, the pine tree and banana trees I used previously where too high in polys (~2500) the new trees are from the RST environment pack, swamp area, they are very nice looking and low in polys (~300). So in the last video you can clearly see the change from billboard to 3d model, I left a color difference so it's well visible.
For the 3d model, I use a little trick, I don't create one tree model per tree in the forest (imagine 100'000 tsStatic ;) ) but about 50 for each tree type, and store them in a pool, where I take them as needed. When not rendered a shape is taken out of the scene, and added only when required.
So it's not yet perfect, far from it, but still it's a good start. On the performance side I get around 15fps on a non optimised compile. And there are still lot of improvements for performance.
Once I have something good enough, I plan to release this as a ressource. Be aware that I work on TGEA (TSE) only so TGE users will have to port it themself.
About the author
#2
01/26/2007 (1:38 pm)
Nice work. Will this make it into the engine for others to use please?
#3
01/26/2007 (1:57 pm)
wow, that's a true forest! I think it looks even better than Far Cry's trees.
#4
01/26/2007 (2:01 pm)
Amazing! Good job!
#5
And Those swamp tress were among my first experiments in TGE, they could be more efficient and look better. Not to mention, I didn't create LOD for them, which would help with the transition to billboards.
Very cool stuff.
01/26/2007 (2:07 pm)
SWEET! My Swamp trees! That looked pretty damn cool. And Those swamp tress were among my first experiments in TGE, they could be more efficient and look better. Not to mention, I didn't create LOD for them, which would help with the transition to billboards.
Very cool stuff.
#6
01/26/2007 (2:43 pm)
Simply amazing work!
#7
In the video, the leaves almost look like they are shimmering. Is that because of the models shifting between LODs, an effect in TGEA, or (most likely) is it the poor codec with Flash video objects?
Still, that was a very great watch. Thanks for sharing!
01/26/2007 (3:04 pm)
Wow, very amazing video.In the video, the leaves almost look like they are shimmering. Is that because of the models shifting between LODs, an effect in TGEA, or (most likely) is it the poor codec with Flash video objects?
Still, that was a very great watch. Thanks for sharing!
#8
01/26/2007 (7:01 pm)
How is the performance if you enable collision? I see in update 3 that you walked straight through several trees.
#9
01/26/2007 (7:38 pm)
videos suck. sorry. i can't see anything. Youtube quality is really bad. Do you maybe have some AVI's or somethig so i can see what's going on :)
#10
01/26/2007 (11:45 pm)
I'd love to see an AVI of this... Its hard to see the trees...
#11
@Todd : your stuff is pretty good, that's why I brough it ;) the trees where easy to port to TGEA (just the material definition to create). There are some problem with the translucent textures for the foliage, that's what cause the shimmering Clint talk about, but that's probably a TGEA issues or export of the dts with mesh sorting.
@Jonathan, there are no collision at the moment, that's on the todo list. As it is the trees are created on the client side so server does not know about them. Client side collision will have to be added.
@Ramen, Tom, I added some screen-shot, and the AVI on photobucket is of better quality than youtube one.
01/27/2007 (12:35 am)
@Andy : I plan to release that as a ressource once it's good enough.@Todd : your stuff is pretty good, that's why I brough it ;) the trees where easy to port to TGEA (just the material definition to create). There are some problem with the translucent textures for the foliage, that's what cause the shimmering Clint talk about, but that's probably a TGEA issues or export of the dts with mesh sorting.
@Jonathan, there are no collision at the moment, that's on the todo list. As it is the trees are created on the client side so server does not know about them. Client side collision will have to be added.
@Ramen, Tom, I added some screen-shot, and the AVI on photobucket is of better quality than youtube one.
#12
However, if you know the general angle of a given games camera view (like RTS camera, or FPS, etc.), then it is easy to address the sorting.
01/27/2007 (12:58 am)
Yup, TGE has some challenges when it comes to getting a mesh with alpha to sort correctly from all viewing angles.However, if you know the general angle of a given games camera view (like RTS camera, or FPS, etc.), then it is easy to address the sorting.
#13
01/27/2007 (5:01 am)
You're working on an MMO, you say? If the server doesn't know about the trees, how will mobs avoid colliding with them?
#14
Solution will probably involve separate server for mobs, AI server is separated from gameserver, and could handle the collisions for mobs. A* is on the list so integrating tree position for the generation of the A* nodes is not an issue.
But for the moment I concentrate on the render part. I like to do the salamis method, one slice after the other, but without taking my eyes away from the remaining salamis.
01/27/2007 (6:24 am)
@Jason, you are correct. It's on the todo list as well (quite a big one). We will need to find a solution for this. Solution will probably involve separate server for mobs, AI server is separated from gameserver, and could handle the collisions for mobs. A* is on the list so integrating tree position for the generation of the A* nodes is not an issue.
But for the moment I concentrate on the render part. I like to do the salamis method, one slice after the other, but without taking my eyes away from the remaining salamis.
#15
i think that i u made like 3-4 LOD's this would improve both the visual quality and the framerate :)
this is really awesome, i mean, 100'000 trees 0.o
keep up the good work :D
01/27/2007 (7:31 am)
so actually, the trees dont have any LOD's????i think that i u made like 3-4 LOD's this would improve both the visual quality and the framerate :)
this is really awesome, i mean, 100'000 trees 0.o
keep up the good work :D
#16
We could have LOD with billboard as last lod also, this is normally supported by Torque, but then you would have 100'000 shapes in the scene and this will simply be too much to handle. The solution I am trying to put in place render the billboard separately from the shapes, and only shapes close to you are actually handled by the renderer, this way I have 100'000 tree forest with less than 100 trees actually created as 3d shapes, I simply move them where you look.
01/27/2007 (9:35 am)
@Florian, no these tree does not have LOD (see Todd Pickens for complaints ;) ) , but should they have, it's handled by the tsStatic class.We could have LOD with billboard as last lod also, this is normally supported by Torque, but then you would have 100'000 shapes in the scene and this will simply be too much to handle. The solution I am trying to put in place render the billboard separately from the shapes, and only shapes close to you are actually handled by the renderer, this way I have 100'000 tree forest with less than 100 trees actually created as 3d shapes, I simply move them where you look.
#17
I spoke with Lightwave Dave during production of my last content pack regarding a smooth fade from one LOD level to the next, he seemed to think that it was a pretty simple change, but was way too busy at the time.
If we could get that working, it would be a great benefit, and really help the transition of LOD's
01/27/2007 (9:52 am)
I will take a look at the source for those tress and see what is involved in getting a least one level of LOD made. I will put it on my "To Do" list for this coming week. Was planning this anyway, for a future update, but may not be able to fully tackle it just yet.I spoke with Lightwave Dave during production of my last content pack regarding a smooth fade from one LOD level to the next, he seemed to think that it was a pretty simple change, but was way too busy at the time.
If we could get that working, it would be a great benefit, and really help the transition of LOD's
#18
The video's look awesome though - it definatly gives the game a more "full" and complete feel to it. Very well done!
01/27/2007 (10:14 am)
How does this work with the trees created on the client side for an MMORPG as you mentioned you were making? Would the tree's be in different locations for each client then as they're rendered on the fly? If so how do you plan on working around multiple players following each other around dodging tree's that the others don't see? (Is this also exploitable in that case?)The video's look awesome though - it definatly gives the game a more "full" and complete feel to it. Very well done!
#19
The game Dungeon Siege did something I had never seen done before. They had very dense forest that really added to the atmosphere and sense of immersion in the game. This would normally be a nightmare for a lot of reasons, camera view, collision, and pathing, etc.
However, they did something that may sound crazy, but played beautifully. None of the trees had collision. Additionally, as the player approached a tree, it was faded away. I know it sounds strange, but the result was that the density of the forest never became a game play hurdle, it simply felt right, even if our logical brain thought otherwise. In fact, when I started playing the game, it was quite a while before may game developer brain kicked in and started analyzing what was going on.
Their system was not perfect, but worked about 95% of the time. If the object around the player are faded to invisible (alphaed out, whatever you want to call it) then there is never anything between the player and the camera, and there is never anything obstructing the immediate path of the player. You very rarely found yourself having to rotate the camera to see an enemy or objective.
Anyway, if you have access to it, checkout Dungeon Siege sometime, playing it will give a better demonstration that I can illustrate here.
01/27/2007 (10:37 am)
Hey guys, am and artist, the non tech sort, but I do a lot of design work. Thought I would offer the following.The game Dungeon Siege did something I had never seen done before. They had very dense forest that really added to the atmosphere and sense of immersion in the game. This would normally be a nightmare for a lot of reasons, camera view, collision, and pathing, etc.
However, they did something that may sound crazy, but played beautifully. None of the trees had collision. Additionally, as the player approached a tree, it was faded away. I know it sounds strange, but the result was that the density of the forest never became a game play hurdle, it simply felt right, even if our logical brain thought otherwise. In fact, when I started playing the game, it was quite a while before may game developer brain kicked in and started analyzing what was going on.
Their system was not perfect, but worked about 95% of the time. If the object around the player are faded to invisible (alphaed out, whatever you want to call it) then there is never anything between the player and the camera, and there is never anything obstructing the immediate path of the player. You very rarely found yourself having to rotate the camera to see an enemy or objective.
Anyway, if you have access to it, checkout Dungeon Siege sometime, playing it will give a better demonstration that I can illustrate here.
#20
01/27/2007 (1:00 pm)
I actually like that idea a lot, Todd. Don't have any immediate application for it, but I can see it being quite useful. 
Torque Owner Chris Byars
Ion Productions