Hello! This thread is for people who want to integrate IsoSurface style grass and trees into a standard JME3 terrain. Grass will only spawn on areas where the terrain alphamap has grass (Green channel).
So far, I have the IsoSurface demo compiling on 3.1 and I am trying to isolate the grass and trees from the isosurface.
So, lets start with the grassZone. How can I spawn the grass onto Jme3 terrain?
You may have to extract a lot of code as the “Zone” stuff is all based on my open source paging library and has nothing to do with JME’s terrain. So you may have to take the ‘iterate over the mesh and find places to put grass’ part out and use it somehow another way.
The pager library was meant to deal with this multi-level paging problem. I don’t think JME’s terrain deals with it at all so you will somehow have to hook into it to load the grass when it loads the terrain. (I’ve never used it before.)
Batching. Each blade of grass is one triangle in a mesh for the zone.
In this case, the grass can’t page in until the terrain is paged in because the grass needs to know where to plot. So there is a parent-child relationship between grid zones but all grid zones are built in the background and it’s taken care of by the pager. This also allows the parent zones to be larger and stuff… so you could have 128x128 size terrain tiles with 32x32 grass tiles or whatever to allow different LOD schemes for both. The pager makes sure that the grass zones don’t try to build until the parent terrain zone has built. It also makes sure that if a parent is canceled then the children are canceled, etc…
Also note: my grass implementation resorts the grass in the zone the player is in as the player moves around. (Though that may be only in the game I was making, don’t know if I ported that back.)
Sorting the grass blades in the mesh is important for the semitransparent edges to look right. So the proper approach sorts the current zone as you walk around and sorts the neighbor zones once based on facing the current zone.