The best way of adding vegetation to the terrain?

Hello again, monkeys. I know, I asked my question not that clearly. To be honest, I did not really know what I really wanted :grin: I was struggling with several problems. Sorry for that!

Anyway, in order to make my vegetation I did the following.

  1. To get the single TerrainQuads I use this method of the TerrainQuad class:

     getAllTerrainPatches(holder);
    
  2. After that I went through all of the terrain quads and generated the vegetation (palms in this case). I created one node per quad and added to palm trees to that node in order to have serveral chunks and not one big geometry. I created a seperate control for that:

     @Override
     public void setSpatial(Spatial spatial) {
         if (spatial == null) {
             return;
         }
         
         for (Spatial s : ((Node) spatial).getChildren()) {
    
             if (s instanceof TerrainQuad) {
    
                 this.rootTerrainQuad = (TerrainQuad) s; // root terrain quad                
                 ArrayList<TerrainQuad> subTerrains = getTerrainQuads(rootTerrainQuad);
    
                 for (TerrainQuad quad : subTerrains) {
                     if (quad == null) {
                         continue; // should never be the case !!!
                     }
                     
                     int counter = 0;
                     
                     Node treeNode = new Node("TreeNode#" + quad.getQuadrant());
                     
                     int size = (int) (quad.getPatchSize() * 2); 
                     
                     for (int x = -size; x < size; x++) {
                         for (int y = -size; y < size; y++) {
                             
                             float value = fractalSum.value(x, 0, y);
                             float x1 = quad.getWorldTranslation().x;
                             float y1 = quad.getWorldTranslation().z;
                             float terrainHeight = rootTerrainQuad.getHeight(new Vector2f(x + x1, y + y1));
                             
                             if (counter < 500 && value < -0.6f && terrainHeight < treeLimit) {
                                 Spatial treeClone = treeModel.clone();
                                 Vector3f location = new Vector3f(x, terrainHeight, y);
                                 location.addLocal(quad.getWorldTranslation());
                                 treeClone.setLocalTranslation(location);
                                 treeNode.attachChild(treeClone);
                                 counter++;
                             }
                         }
                     }                    
                     GeometryBatchFactory.optimize(treeNode);
                     ((Node)spatial).attachChild(treeNode);
                 }
             }
         }
     }
    

With GeometryBatchFactory.optimize(treeNode); I optimized the node.
Then I attached this node to the node where the terrain is attached to.

My scene graph looks as follows:

The scene looks like this:

Sorry again for my bad post in the beginning!