Lots of trees

Started by
28 comments, last by bsekerci 20 years, 6 months ago
Hi, I have a problem rendering trees. You can get an idea what i am trying to do from http://alpertu.virtualave.net/directx/flight8_12.jpg . There is a terrain which has about 15000 polygons. I have to render trees which have also about 15000 polygons total. Framerate is about 1! It is too slow. My card is not a good one (3D Propthet Ultra II). This terrain area is a small part. The total tree count is about 4000! My scenegraph structure is tree-like. Every object in the scenegraph has "bounding boxes" for culling. The scenegraph is created using Level of detail technique. As you can see from the tree leaves, I don''t sort polygons. I don''t use BSP or Quadtree yet. I am going to use BSP and quadtree soon. Do you think these techniques will increase my framerate much? Can you tell me how to render these trees using an efficient way? Thank you. barconan.
Advertisement
Why is the terrain 15k polys? It looks primarily flat.
Why don''t you use billboarding for the trees in the distance and only fully render the trees that are nearby.
Use billboarding for every tree you have. You should be able to give the appearance of 3D. Try mixing up the tree bitmaps a bunch.

I don''t create terrain. Terrain data comes to me in OpenFlight format. It has trees also. I can select all trees are billboard or like this (12 polygons).

Maybe I can create a copy for every tree ( actually there are five different trees, the others has translation information before rendered) for billboarding.

I''ll try this.
When you have lots of little things like these that occupy a comparatively small amount of screen space, you should really billboard them, especially the far away ones. In fact, in the distance, they should be billboarded in strips (one per terrain chunk), multiple trees to a quad. Since they are not transparent, draw front to back (per terrain chunk, don''t sort all the polys individually, because that would take forever), so Z test eliminate unecessary quads. You might want to google some grass rendering papers.
1. How are you sending the trees to the graphics API? Could be that you could benifit from caching the billboards in vRam.

2. Don''t even bother using a bsp tree for terrain. Quadtree is a much better idea.

3. Profile your app and make sure you know where the bottleneck is before trying to optimise anything.

4. If your tree models are 15k polys each, imposters would be a great idea. Render it into (say) 4 different imposters at the start of the frame at different angles, then reuse these all over the terrain. Maybe use nailboards if you need depth accuracy (although you can probably get away without).
1. I have a geometrynode in the scenegraph. This node has vertex and index buffers. Buffers are created using D3DPOOL_MANAGED. And the textures are created using same pool parameter. In this scenegraph there are 5 geometrynode for trees. Every geometry tree has 12 polygons and one texture (textures are hold in the texture table for all nodes). This geometry node renders itself using "DrawIndexedPrimitive". The all other trees are reference nodes, which refer to tree geometry nodes. As a result, There are 5x12=60 polygons on video memory, these polygons are rendered about 12000 times! using different world matrix.

2. I don''t know much about BSP and quadtree; I think I need to sort polygons. If I use Z buffer, I need to sort them front-to-back, I don''t use Z buffer back-to-front. I am thinking BSP for sorting. I am thinking quadtree for view frustum culling. Can I use quadtree for both?

3. Do you know a good tool for profiling? I downloaded sometime Vtune. But its trial license is expired before I couldn''t try.

4. What is imposter? Can you tell me a good reference?

Thank you for helping.
Barconan
Here''s a nice article on LOD that also talks about imposters.

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"
For imposters you basically render your model (like your tree) to a texture, then billboard this everywhere instead of rerendering the original object. Nice because you can use a high poly object lots of times without actually drawing it lots of times. You can also re-render the texture imposter every few frames instead of every frame to save time. Google knows much more..

However you say your trees are only 12 polys each, so maybe imposters won''t help that much.

But you do say you''re rendering with a different world matrix each time - that sounds like you''ll be doing lots of little calls to draw primative. Instead you could fill one big vertex buffer for the entire map (duplicate your trees geometry) for all the trees, and hold the indices in the quad tree leaves. Then you get nice large batches of trees at a time instead of lots of little rendering calls.

Also try sorting by texture to minimise texture thrashing (although with 5 this might not be a problem depending on the texture size). Don''t bother sorting back to front or front to back, there are more important things to sory by. If need be you can use a quad tree for a quick and efficiant front to back sort on the leaves which will be more than good enough.

This topic is closed to new replies.

Advertisement