Best performance: SharedNode, SharedMesh, Billboard & Imposter

I’m looking to manage vegetation: Tree, Grass, Plants…

As far as possible, as fast as possible… something like that:





Question for grass:

  • It's faster to make grass with billboard or make grass with 3 cross quad and SharedMesh ?



    Question for tree:
  • Can i use SharedMesh (or SharedNode) with imposter node ? or create a "SharedImposterNode" ?

    In order to load only one model of tree and duplicate it with several ImposterNode link to it…



    Thanks for responses and sorry for my poor english.



    Nex.

There was a challenge in this topic some years ago, maybe you can get some inspiration from it:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=3362.0


- It's faster to make grass with billboard or make grass with 3 cross quad and SharedMesh ?

I'm pretty sure that billboarded grass would be terrible slow. Better to batch the grass in VBO's (in reasonable sizes) and maybe perform some animation on it on the GPU.

VBO's ?

It's GeometryBatchCreator class ?



I don't understand :slight_smile:



GeometryBatchCreator can merge several trimesh (as i understand).

So i think a method like this:


  • Determine group of vegetation and create several big mesh with GeometryBatchCreator
  • SharedMesh / SharedNode to duplicate them as lot as possible
  • bank (with HashMap) TextureState, Blendstate, Mesh & others to create minimal new objet
  • Translate vegetation unused (out of view) and not delete them and create news
  • Decrease vegetation density with distance to save fps




There is an example of high speed grass and tree billboarding here http://www.jmonkeyengine.com/jmeforum/index.php?topic=4623.0 using VBOs based off a GPU Gems 2 article.  I would love to see how to do this too, but the problem is it seems, that only the shader code is given, without any java code so I can’t seem to figure out how to use it.

Yes, i have read this post too.

I'm going to try many solution this night, if i find something usefull, i tell you :slight_smile:

Test with billboard:



Average 60 to 80 fps for 200 meter line of view of grass.



Could you post the code you used to do this?  It would really help me out a lot.  Thanks in advance.  :wink:

this code is (over) linked to many class of my program…

So hard to extract… but



I’m working on a new version, clearner than the old, i post it as soon as possible (when it working :p)

Test with SharedMesh / SharedNode:



elements are simply quad, no texture or light on

Average 40fps with 1024 elements

Average 20fps with 2048 elements





A little more fast than billboard…

Eureka :slight_smile:



After many test.

It is very more performant to display few objet of lot of Triangle than lot of objet of few triangle.

lock meshs seems to save few fps (like 2-5 fps)



For example with torus (manage with SharedMesh) test:

2048 Objets (medDefinition), average 100k tri = 25 fps

1024 Objets (Hi Def), average 200k tri = 55/60 fps

It is very more performant to display few objet of lot of Triangle than lot of objet of few triangle.


Yes, that's why you should use the GeometryBatchCreator to batch your geometry. But not to large batches, you still want to cull some of them. Remember that it's the drawcalls and stateswitches that cost, the actual number of triangles is not so important.

Can i use SharedMesh with geometry batch ?



Something like this:



TriMesh mesh;

myBatchGeometryCreator.commit(mesh);

SharedMesh shared = new SharedMesh(mesh);



Others question… In order to make LOD, can i use DiscreteLodNode with SharedNode ?



I think override onDraw(Renderer r) to get distance between cam and vegetation to know if i must draw it or not

TriMesh mesh;
myBatchGeometryCreator.commit(mesh);
SharedMesh shared = new SharedMesh(mesh);


I have not done exactly that. But I see no reason why it should not work.

DiscreteLodNode with SharedNode


That I have done before successfully, I think without any changes in JME.

Here is a good news !



some test this night…



A last little question: What's VBO exactly ? Useful if i use GeometryBatchCreator ? This is for lock vertice and more ?

after some test:



amazing performance: http://www.kevinboulanger.net/grass.html

Absolutely amazing, would be interesting if implemented in Jme.  It seems SnyIt made a good grass and tree rendering scene from the link I posted earlier.

SomethingNew said:


There is an example of high speed grass and tree billboarding here http://www.jmonkeyengine.com/jmeforum/index.php?topic=4623.0 using VBOs based off a GPU Gems 2 article.



There is a sample he created as well as some geometry instancing code that he put on his website here: http://snylt.nonsen.se/jme/

Good, i don't know there is source for that :slight_smile:

I'm going to read this, continue my vegetation manager and i will post it on the forum soon…

source : http://www.jmonkeyengine.com/jmeforum/index.php?topic=11022.0

i will continue later, if someone want to contribute :slight_smile: