Island with forest component


#1

Hello all,

here is a short preview of a small app that I use to test a component that I am currently designing to create forests.

http://ingels.me/~charles/videos/island_preview.mp4

Here, the trees are palm trees, homebrewed tree model.

The forest component is useable under Urho3D like any other component:

...
Node* node = scene_->CreateChild("Palm forest");
palmForest = node->CreateComponent<Forest>();
palmForest->Init(scene_, "Models/PalmTree.mdl", 200, 800);
...

Then, some parameters can be set like the inner radius, the outer radius, the spread angle and the sector. The model file (with its materials and texture) is also specified, along with the maximum number of trees to place.
Each tree is randomly vertically scaled using a scaling factor that has a default value but that can also be altered.
Finally, each tree is randomly rotated around the Y axis.

The component will try to put as much trees as possible in the area defined by the parameters (or by the default ones if no specific parameter is modified). This means that since each tree needs a space around it (another parameter that can be specified), there might be some situations where all the requested trees cannot be inserted and the component returns with the actual number of trees it has successfully put.
Another constraint is that the scene shall contain one terrain (otherwise nothing will be done). The component will land each tree on the terrain taking into account the terrain height at the tree location.

As you can see, the palm tree is not fully finished, and I plan to design other type of trees to create forests with different densities of trees.

Enjoy!


#2

Looks good. Any reason you don’t use cascaded shadow maps?


#3

Hi Bananaft,
frankly speaking, I have never used cascading shadow map, so I am not really aware to what it is and how to use it.
Anyway, I am going to have a look…
Thanks


#4

The palm trees are great! The shadows are indeed a problem. Have you ever heard of L-Systems? It’s a perfect fit for making procedural vegetation, though not too useful for palm trees, it is the basis of speed-tree.