Hi
I’m looking at converting some hand crafted opengl to jme. I’ve written an AC3D converter with correct normals (the one referenced on here doesn’t seem to work on my ac3d models, and I already have my parser from my previous loaders). I convert them to jme binary and the use that to load them into the scene. I also dump out the XML version so I can see what the converter is up to.
I load 2 different models into a node, and then create SharedNode’s so that I can have 100 instances of each model at various points in my scene.
The opengl version with 4x sampling in 800x600 32bit runs at about 38fps when all objects are visible. I was expecting a slight performance decrease with a scenegraph, but that is due to sorting and frustrum culling etc, so it should be gained back under other circumstances.
Under jme I get 19fps. This is a performance difference that is much more than I expected, so I’m working on the fact that I am doing something wrong in my scene. Are there any performance tips that I should consider?
In trying to do the comparison, the models are the same, so resizing of textures etc is not an option, nore is changing the sample rate as that has to match to be a fair comparison.
I’ve got a zip that contains the source and models.
Thanks
Endolf
I ran TestScene, with a full view my FPS was ~45. I then called LockMeshes on the source Nodes:
fighter01ModelNode.lockMeshes();
barrel01ModelNode.lockMeshes();
and lockBounds on the SharedNodes you create, before attaching them
tempNode.lockBounds();
FPS is now ~180. Escp. due to the displaylists (lockMeshes).
Of course, that's not a fair comparison, if your original code did not use any displaylists.
So I disabled lockMeshes and instead used RenderQueue sorting:
tempNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
FPS went up a bit to ~55.
Did you use any optimizations in your raw OpenGL code? (display lists, VBO, etc)
Hi
Thanks for the responce. I did use display lists in my GL code. I'll give the lock meshes and lock bounds a try.
Thank you again.
Endolf
Brilliant
37fps
thats more like it.
Thank you again
Endolf
Did some profiling, things you can do to reduce CPU usage a bit (but perhaps you're limited by the videocard now, due to the FSAA).
There are many objects, with a deep Node hierachy. Lot's of time is spend traversing it and recalculating coordinates. For static object you can do more locking (lockTransforms) so these won't be recalcuted (and also included in the displaylist). You can set a CullMode for each node/mesh. Currently for every object, it looks at the parent, which then looks at the parent, etc. because the default is CULL_INHERIT. Typically you'll want to use CULL_DYNAMIC anyway.