Nexam
April 22, 2009, 7:16am
1
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.
Nexam
April 22, 2009, 3:34pm
3
VBO's ?
It's GeometryBatchCreator class ?
I don't understand
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.
Nexam
April 22, 2009, 6:47pm
5
Yes, i have read this post too.
I'm going to try many solution this night, if i find something usefull, i tell you
Nexam
April 22, 2009, 7:15pm
6
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.
Nexam
April 23, 2009, 7:32am
8
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)
Nexam
April 23, 2009, 9:42am
9
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…
Nexam
April 23, 2009, 10:00am
10
Eureka
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.
Nexam
April 23, 2009, 12:22pm
12
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.
Nexam
April 23, 2009, 2:42pm
14
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 ?
Nexam
April 23, 2009, 9:20pm
16
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/
Nexam
April 24, 2009, 7:31am
18
Good, i don't know there is source for that
I'm going to read this, continue my vegetation manager and i will post it on the forum soon…
Nexam
April 25, 2009, 2:36pm
19
source : http://www.jmonkeyengine.com/jmeforum/index.php?topic=11022.0
i will continue later, if someone want to contribute