CTreeSceneNode is a tree with three levels of detail. The highest LOD is the mesh with full detail. The second LOD is another mesh with fewer polygons. The last LOD is a billboard. The leaves are displayed in the two first levels of detail.

//! Sets the meshes used by the scene node, the leaf node used and the billboard texture.//! \param highLod: The mesh to use when the tree is close to the camera. Must not be 0!//! \param midLod: The mesh to use when the camera is at mediocre distance. If 0 highLod is used instead.//! \param leafNode: The scene node displaying the leaves on the tree. If 0 no leaves will be displayed.//! \param billboardTexture: The texture to display on the billboard when the tree is very far from the camera. If 0 it will not turn into a billboard.void setup(const STreeMesh* highLOD, const STreeMesh* midLOD, video::ITexture* billboardTexture =0);

//! Generates meshes and leaves for the scene node automatically, and specifies the billboard texture.//! \param seed: The random number seed used to generate the tree.//! \param billboardTexture: The texture to display on the billboard when the tree is very far from the camera. If 0 it will not turn into a billboard.void setup(CTreeGenerator* generator, s32 seed =0, video::ITexture* billboardTexture =0);

//! Specifies where the tree should switch to medium LOD, and where it should switch to a billboard.//! \param midRange: If the camera is closer than this, it will use high LOD. If it is greater than this, but lower than farRange, it will use medium LOD.//! \param farRange: If the camera is further away than this, a billboard will be displayed instead of the tree.void setDistances(f32 midRange, f32 farRange);

After you create the treescenenode, you can call TreeSceneNode::createImposter(). It will render the tree in high detail to a texture that will be set on the billboardmaterial. This was necessary for our game, because we have multiple tree types and further randomization, so it was easier to let the game provide the billboard textures instead of us creating one for every tree.

This was a quick fix, so the code is not so clean =P It also may be the case that I got this working for our tree models only and it won't work on yours. I do some "nasty magic with numbers" and there's probably a better way. If there is, please say so ^^

I created a plugin for IrrEdit (and a scenenode) that places trees (or other objects) randomly (http://bulletbyte.de/products.php?sub=irr&show=rafo), and it should work with any scenenodes (that provide a "clone" method). Good point is that the trees are not actually stored in the scenefile (which is a huge reduction in file size) but placed by random every time the scene is loaded (using the same random algorithm and the same seed will produce the same output).

Then you can call it from an overloaded TreeSceneNode.scale() or something. Strangely, it doesn't look like the scaling is equivalent - if I scale the tree by 10, I have to scale the leaves by something like 200 to get it looking right. Not sure if that's some issue with my project or if I just don't understand the tree generator well enough yet.

Glancing through the code, it's like most stand-alone scene nodes.Here's what it looks like you have to do:1) Call the constructor2) Call void CTreeSceneNode::setup(CTreeGenerator* generator, s32 seed, video::ITexture* billboardTexture)You'll need to have created a CTreeGenerator instance. (Go check out it's constructor to see what it needs)3) Call void CTreeSceneNode::setDistances(f32 midRange, f32 farRange), passing it the values you want for when a) the tree is near enough to be full res and b) the tree is far enough to become a billboard.