Random Forest Scene Node
This is a simple plugin where you define an area and some other parameters, hit a button and have a whole lot of trees planted there by random.
This is how it works:
- add a scenenode (e.g. empty scenenode) and give it a unique name
- optional: add a terrain. Make sure the terrain is in the scenegraph before the random forest scenenode. This is important because on loading the scene the terrain must already be there so that the random forest node can find it
- add a random forest node
- add template trees as children of this scenenode
- define the area you want the trees to be in
- click the "plant trees" checkbox
- defined area is split into small segments
- a random number is used to find out whether or not a tree is to be planted in every segment
- if this is true the exact tree position is determined by random
- one of the trees is picked from the template node
- the tree is planted
You can specify a terrain scenenode to be used, and all trees will get an appropriate height position. If no terrain scenenode is specified all trees are in the same height. There is also a "resize" attribute to variy the size of the trees. You specify how many percent the size may vary (i.e. if you enter "0.25" the tree size may range from 25% smaller to 25% bigger (scale 0.75 to 1.25))
There are some parameters you can specify:
- threshold: for tree generation a random number between 0 and 1000 is picked. If this number is bigger than the threshold a tree is planted
- you can specify your own seed for the random generation
If you store your scene the trees won't be stored, only the parameters used to generate the forest. I added an own random number generator to the plugin from a random tutorial on the web so that I (hopefully) get the same random number sequence on all computers and compilers (I don't want to rely on the rand() function, implementations may vary between compilers I guess). This way of saving the forest reduced the filesize of the scene file from 1.5 MB to 50 KB in a test I made. You can still have the trees serialized though, there is an option for that.
I hope this plugin will be useful to some people here.

23.05.2011 | | bulletbyte.de: "RandomForestPlugin" update |
---|---|
I have now integrated the "MeshCombiner" provided by Lonesome Ducky on the (official Irrlicht Forum which brings a huge performance boost (before: 13 FPS, after: 200 FPS). | |
22.02.2011 | | bulletbyte.de: "RandomForestPlugin" update |
Added some functionality to the RandomForestPlugin: now it shows the border of the forest in IrrEdit. Also uploaded a new version of IrrOde where the IrrOdeCar demo reflects this change. | |
19.02.2011 | | bulletbyte.de: new Plugin "RandomForest" |
I have created a new plugin for the IrrEdit scene editor: the Random Forest Plugin. You can specify an area in your scene and have it populated with trees. It's also possible to add more than one forest to a scene. I have also added two forests to the IrrOdeCar demo of my IrrOde wrapper as a demo. |