More trees: billboards vs solids

I now have the trees being served from the server to the client. I tried my billboard trees with 1000 trees on each tile… so 9000 trees loaded with the 9 tile minimal start view. It performed poorly, billboarding a 10 point triangle fan, with all the issues about view angle and shadows etc.

So I made a solid. Still triangle fan sets. I made it 5 sides because 3 is too triangular and 4 is too square. So they are 7 point triangle fans. I also use the alphamask mode instead of blending. It still performs poorly with 9000 trees, but half as poorly as billboarded. The texture could be adjusted for being wrapped around a ‘cone’ but looks and performs better than even triangle billboards.


(I know, I could get the same visual results as above with cloning… I will get to that as clearly I need to)

Looks like a nice improvement! 9000 trees - I can imagine myself playing the game and trying to cut them all with an axe. But it already makes the picture feel much better.

But when you shift the texture to make it look more random, you also shift the alpha mask. So it happens that the tree is transparent in the middle. Some of them look nice with it, but some feels just kinda wrong.

You could make the alpha channel seamless, so when it falls in a wrong position, it’ll still produce nice-enough result.

I may be wrong… However, you could use a shape like this:


6 tris, 9 vertices.

You can then randomize the (x, y) of the 4 vertices in the middle - the vertices that make the “cut”, plus the centre point where the cuts meet. And then you can shift the texture to make them all “unique”, without having to care much about the alpha.

The shadow is still your enemy, though :slight_smile:

It’s just an idea. I really appreciate your results.

Yeah, the wrongness of the tree comes from the trunk being in the middle of the texture but mapping to the ‘cone’ of the tree. I want to separate the trunk from the foliage. In low LOD … no trunk. It then it could be a line, then something more solid. I am disappointed to report that using scaled and rotated TCastleTranformReference from one model tree is slower than just using separate models, slower than using billboards. It does take a lot less memory but seems to cut fps to under half of what it was with 9000 trees.


(also I am not shifting the texture randomly with these… it is just that the trees are rotated in different directions)

I am further disappointed that even a two point line is too slow when there are 9000 of them in separate scenes. I think there are just too many tcastlescenes. My next step will be to try putting multiple trees into one tcastlescene… maybe all trees from a tile in a scene. Then I would be at 27 scenes instead of 9018.


(the two point line alone is sufficient for a low LOD tree for those far trees).

I build all the trees for a tile into 1 x3drootnode which goes into one scene. So now there are 27 scenes instead of 9018. It is faster. And takes less memory. But it is still too slow.

Shadows are the real culprit. If I turn off shadows the framerate is 10x faster.
Shadows are nice, but not that nice. I will have to try the shadows maps.