IrrEdit plugin: Random Forest
IrrEdit plugin: Random Forest
Hi,
I have uploaded a first version of my new IrrEdit 1.5 plugin yesterday: Random Forest (http://bulletbyte.de/products.php?sub=irr&show=rafo). It's 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.
This is a first version, there are still some things to come:
- add an "clear forest" option. Now it's only possible to plant the trees, but they can't be removed
- add a "forest border" so that you can see where your forest will be
I have uploaded a first version of my new IrrEdit 1.5 plugin yesterday: Random Forest (http://bulletbyte.de/products.php?sub=irr&show=rafo). It's 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.
This is a first version, there are still some things to come:
- add an "clear forest" option. Now it's only possible to plant the trees, but they can't be removed
- add a "forest border" so that you can see where your forest will be
Last edited by Brainsaw on Sat Feb 19, 2011 1:24 pm, edited 1 time in total.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Hi there,
I have just uploaded a new version with some fixes. You can now specify a scene node (by name) that will be the parent of the generated forest. Also the generation does now work, even when the plugin is used (didn't work before sometimes ). I have also added two forests to the IrrOdeCar demo of my IrrOde wrapper.
@Adler1337: Yes, you can use your own models. You just have to add them as children of another node (aka "tree template node") and specify that node in the plugin's node (referenced by name). The plugin sees all scenenodes under that template node as trees and clones them. Using a mesh instead of a heightmap does not work. I use the "getHeight" method of the heightmap to find the exact position for new trees. But it should not be too difficult to modify the code to get that value from a mesh as well.
I have just uploaded a new version with some fixes. You can now specify a scene node (by name) that will be the parent of the generated forest. Also the generation does now work, even when the plugin is used (didn't work before sometimes ). I have also added two forests to the IrrOdeCar demo of my IrrOde wrapper.
@Adler1337: Yes, you can use your own models. You just have to add them as children of another node (aka "tree template node") and specify that node in the plugin's node (referenced by name). The plugin sees all scenenodes under that template node as trees and clones them. Using a mesh instead of a heightmap does not work. I use the "getHeight" method of the heightmap to find the exact position for new trees. But it should not be too difficult to modify the code to get that value from a mesh as well.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
Couldn't you render a depth map from a top view of the entire scene and use that? It would work on every type of renderable object.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
I used raycasting for this, depthmap wouldn't work for huge terrains
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
It's all no problem. The whole code is licenced under the zlib licence, so feel free to add whatever feature you may need. The heightmap version suits my needs.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
I don't need it, i just couldn't resist the temptation to shoot down someone else's idea
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
You are right, raycasts would be better. I was thinking about how the blender snapping system used the depth map, and though that it could work like that. But you're right about the huge terrain thing.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
haha funny, I'm working on a similar thing for my GCSE coursework and Front Warrior. I'm aiming to be a bit more robust.
here is a pdf
http://frontwarrior.googlecode.com/file ... tation.pdf
here is a pdf
http://frontwarrior.googlecode.com/file ... tation.pdf
Added some functionality to the RandomForestPlugin: now it shows the border of the forest in IrrEdit. The border polygons (which are position2d internally) are now serialized as vector3df(X,0,Y) instead of vector3df(X,Y,0). This is necessary because IrrEdit doesn't seem to support editing position2d attributes. Also uploaded a new version of IrrOde where the IrrOdeCar demo reflects this change.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
I have included the Mesh Combiner (http://irrlicht.sourceforge.net/phpBB2/ ... h+combiner) from the project announcements forum to the demo application yesterday and it gives a huge performance boost (on my system: 13 FPS before, 200 FPS afterwards with 1010 trees). Just in case you want to take a look.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
tried your Mesh Combiner. man, that really gives a boost!
http://www.smashingbuzz.com/2014/06/loc ... -repeater/ Locations that Benefit from a GSM Repeater
http://www.geeksays.com/being-an-outcas ... oster/4297 Being an Outcast with a Mobile Phone Signal Booster
http://www.geeksays.com/being-an-outcas ... oster/4297 Being an Outcast with a Mobile Phone Signal Booster