Trouble using the Forester

Hi.
I am new to the jmonkeyengine and I still try to find out how all the cool stuff works.

I need grass on my terrain, so I try to setup the Forester plugin.

The following Code is based on Code i found here at the forum:
[java]
public void simpleInitApp() {
Forester forester = Forester.getInstance();

    Spatial scene = assetManager.loadModel("Scenes/TestScene.j3o");
    rootNode.attachChild(scene);
    
    Node n = (Node)scene;
    Terrain terrain = (Terrain)n.getChild("terrain");
    
    forester.initialize(rootNode, cam, terrain, this);
    
    GrassLoader grassLoader = forester.createGrassLoader(1026, 4, 300f, 20f);

    MapGrid grid = grassLoader.createMapGrid();

    grid.addDensityMap(assetManager.loadTexture("Textures/terrain/densityMap.jpg"), 0, 0, 0);

    Material grassMat = assetManager.loadMaterial("Materials/Grass/Grass.j3m");

    GrassLayer layer = grassLoader.addLayer(grassMat, MeshType.CROSSQUADS);

    layer.setDensityTextureData(0, Channel.Red);

    layer.setDensityMultiplier(0.5f);

    layer.setMaxHeight(2.4f);
    layer.setMinHeight(2.f);

    layer.setMaxWidth(2.4f);
    layer.setMinWidth(2.f);


    ((GPAUniform) layer.getPlantingAlgorithm()).setThreshold(0.6f);

    grassLoader.setWind(new Vector2f(1, 0));
}

[/java]

My grass material looks like this:

This is the density map:

The game does not throw any errors, but there is no grass on the terrain.

The forester plugin isn’t developed anymore and the developer disappeared so I guess you are mostly on your own with this :-/

Ok, then I will find another solution.

Theres various threads on grass etc. maybe using the forester code and what the others posted you’re able to make someting tailored to your needs :slight_smile: