Here you will learn how to use the grass system. You need to read the grassloader part to get it running, the rest is optional.
The demo project contains an example named SimpleGrassTest.java. That class has a method named setupForester(). It is well commented, and can be used as a primer on how to set up a simple grass system. The basic approach is this:
1) Create a Forester object, and initialize it.
2) Use it to create a grass-loader.
3) Use the grassloader to create a map-provider.
4) Use the grassloader to create one grass-layer for each type of grass.
5) Tweak everything until it fits your app.
6) Make sure you call forester.update() each frame.
There will be some basic information and tips here on how to make a vegetation system more efficient and/or better looking. I will also link to more in-depth jME tutorials on each subject, where there are any.
Grass and foliage often use alpha textures. Alpha textures are partially (or fully) transparent. A standard alpha texture contains the RGB channels, but also an additional alpha channel where the transparency values are stored.
There is a tutorial on how to work with alpha textures and transparency here: http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_material
Materials have something called additional renderstate options. They can be found in the material editor. When rendering grass, you usually want to look at these settings:
FaceCull: When using fixed quads it should be set to "Off". This means both sides of the quads will be rendered. When using billboarded grass, you can cull the back side, because it never faces the camera.
Blending mode: With grass you'd normally be using Alpha. The AlphaTestFallof option should also be changed, but the value you put there depends a lot on the texture. It may be worth experimenting with.
DepthWrite/DepthCheck: Both of those should normally be checked.
ColorWrite: This should always be on.
Alpha to coverage is a method used to smooth out the edges of grass and such. In jME you enable it through the rendermanager, or renderer:
renderer.setAlphaToCoverage(true);
Alpha to coverage works through multi-sampling, so it has an effect on performance. Also it may not be supported on older graphics-cards.
http://en.wikipedia.org/wiki/Alpha_to_coverage
— androlo 2011/12/07 01:48