Need help with Grass utility

Hi friends
I watched a video about adding grass in JME3.0 RC2 . here is the link

sorry for low quality of image.

I do not see that option in JME 3.0 and 3.1
Can you help . Thanks a lot.
Also I found other tools like SimArboreal-Editor and Forester.
Can anybody create a small 10 min video of how to use them in my project ?(I did not find documentation for them in wiki) .
I will really appreciate you .

Unfortunately there is no grass in 3.0 or 3.1. If I remember correctly, Forester’s documentation is slim to none and caused constant crashing with 0 functionality for me. Your best bet is to look around on the internet for how to create your own foliage system and write one from scratch. I’ve written a very very basic one, but it’s outdated and not well optimized. It’s not a hard feature to write, and if you’re proficient with GLSL, adding wind and other effects is also very straightforward with the vertex shader. Here’s a basic rundown on how I did mine.

  1. Create a template mesh (a bunch of randomly scaled and rotated quads with random offset) and batch it into 1 mesh.
  2. Assign a grass texture with an alpha channel (such as this: With the texture applied, your final template mesh will look something like this:
  3. For every place you want grass (on a grid based on the size of the template mesh), attach the mesh. With 3.1 you may also be able to use instancing if your card supports it, but in 3.0, I used batching.

And here’s a much more indepth explanation on the same implementation done in CryEngine:

1 Like

Instancing is bad for grass. Performance-wise this is somewhere between separate objects and one batched mesh… but closer to the several objects side. Instancing only makes sense when you have larger objects. (like trees)

To use SimArboreal-Editor with JME… you run the editor. Create a tree… and then save the .j3o.

Then load the j3o in the scene editor. Place it where you want.

Repeat as needed.

There isn’t any scene editor integration and no automatic tree placement from the scene editor.

Though for an example of using SimArboreal trees and a my own grass implementation, you can look at the source code for the IsoSurface-Demo.

(Latest code is really on github: GitHub - Simsilica/IsoSurfaceDemo: Technology demo of the IsoSurface terrain library.)

Note: it currently only works with JME 3.0 unless you make some tweaks.

And here is what it looks like running:


Ah, well you learn something new every day! Batching was definitely a huge performance improvement when I wrote my own grass system last year. I just figured instancing would work well too, but I guess I don’t understand instancing as well as I thought.

Instancing is one draw call to the driver… but the driver itself still has to setup each object and render it one at a time. So yes, you do gain a lot of performance in something like JME because you lose the impact of JME’s per-object costs.

But it’s small in comparison to batching… and for grass where you can get away with three or four vertexes per object, batching is an easy win.

By doing this can I also have the wind animation of tree ? For trees wind animation do you use skeleton ?

When I import the tree in jme which I made in TreeEdtior it says : error opening .j3o.
I put all textures in Texture folder.
Also when I try to link it to my scene it gives Error:

You also have to put the arboreal-assets.jar file in your project libraries.

1 Like

Oh… it is fantastic . thanks Paul .
It also imported wind animation. can you explain about how does this animation work?
because I do not see any bone in tree.
I am sorry if my question seams stupid . (I am a novice).

Edit: Is it vertex animation ?

Hi Ali!

I’m pretty sure, that there are no bones needed. I think he did it with shaders. I just downloaded the source, but when you look into “assets/MatDefs”, there are a lot of *.vert and *.frag files. I think the reason for using shaders instead of bones is the much higher performance.

1 Like

I have another question…
Can I replace leaves texture with my own texture in SimArboreal-Editor for windows version ? If Yes can you say how?

Take a look at “SimArboreal-master\assets\Textures”. In this folder you should see an file called “leaf-atlas.png”. I would swear that this is the location you may change the the leaf-texture. But keep in mind, I’m no expert in this, I just looked around in the source code.

EDIT: Forget it! Sorry, I wasn’t in the SimAboreal-Editor-file anymore. But I’ll take a look at it and give feedback, if I will be able to :wink:

EDIT 2: As far as I undestand at this moment, SimAboreal-Editor is using the “SimAboreal”-Library, which contains the above mentioned atlas-file. I’m currently not at home, so I can’t “install” both of them… maybe this evening. I think the editor uses the file from the library. If so, you could replace it with an alternative texture and check out how it works.

EDIT 3: Read the next posting! Paul should be the best person to answer this question :wink:

1 Like

There is no official way to replace the leaves in the editor… but you can provide your own atlas texture to the material or I believe you can include your own (with the same name) in your own assets directory and it will override the one from the jar.

You might take a look at this thread for grass. There even is a plugin.

1 Like

Thanks @mathiasj.
I have a request from dear core developers of JME.
Please document such cool things like GrassBanana and and IsoSurface and so many others in Wiki.
So it will make it easier for beginners to learn them and save a lot of time. Thanks

Just in case you get stuck with GrassyBanana, here a link with a working example at the end of the page: Thread
You just need to create a terrain with the build-in terrain-creator and link to it within the script.

1 Like

Thanks dear @Tankwart . You helped me a lot.

To be honest. I wouldn’t be able to help you in this thread, without getting the informations from
stomrage (the author of the plugin). So maybe you should thank him more than me :wink:

Yes of course . Thanks a lot dear @stomrage .