This part was the reason I started all this. It’s thanks to the work of Den Ivanov and an experiment of his: http://www.cleoag.ru/labs/flex/plant3d/. To create 3d-objects manually in papervision3D is a little bit to advanced for me, so thanks for sharing once again. I added some features and made it possible to customize it. Here is some samples:
I used 3d studio max to create the different leafs. You can adjust the leaf with various settings like width, height and bend-modifier ( credits to Bartek Drozdz, AS3mod is great!). It would be cool to create leaf manually by drawing a outline, adding vertices, triangulate and upload textures in runtime. But I have to experiment with triangulation and uv-mapping first. The rules for generating the tree is stored in a 2d-array like this:
_branchMap = [
[0, 0, 2, 2, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ]
This trunk uses 2 levels of recursive depths. One trunk and two levels of branches. Each array decide in which joint a new branch is growing while we iterate through the segments. The stored value is how many new branches there will be at that joint. The length of each array reflects how many segments there will be in that level. Oops, I got carried away with boring details… I’m not even pleased with this solution. I think I have to use a completely different approach. A L-system maybe? But there is a lot of things that I want to first, so I put it on hold for now. Still, you can get a lot of different trees by adjusting the few settings available.
There is pretty much research around, for example:
I quickly put together a standalone tool so you can try to change the settings available. Some parameters in the building process has random values (like branch-rotation), so when changing the branch and trunk settings the tree will be different every time.
- Leaf editor.
- New tree generation algorithm.
- Different tree-characteristics depending of the value of the normalmap when distributing on the mesh.
- More types of vegetation like grass, bushes.
Have you seen the previous posts about creating terrain with flash? Check them out here: http://www.inear.se/?cat=6