Inadequate performance displaying thousands geometry objects

Hi, I am using JMonkey to display interactive datasets in 3d. Using box geometries and adding them to the root note, I max out at about 5k (2k being the last comfortable point). At this point, as soon as I start moving the camera around, framerate drops from 20fps to 0. The debug screen has from 0 to 5000 objects (depending on where camera faces), 53k triangles, and 106k vertices. Everything else is pretty low as I share the same basic material between all boxes. The profiler points at most time being spent drawing inside org.lwjgl.opengl.GL12. ngldrawrangeelementsbo method. The “freeze” continues even when camera is facing away and there are no points to display. My data points do not need to move, and they look pretty basic with just the standard lighting material and no texture. The only time they get interacted with is if they are selected and user requests more information about them.

I understand that debugging every single option could take forever and wouldn’t ask the group for that kind of commitment. I just wanted to know if I was using the right technology and if anyone else has been able to render that many geometries with JMonkey/lwjgl/OpenGL.

In case it is any help, the source code is on Github:

I’m using iMac with ATI Radeon HD 5750 1024 MB.

Thanks in advance for any suggestions or comments.

This is covered often on the forum. What you are looking for is “batching”.

@pspeed said: This is covered often on the forum. What you are looking for is "batching".

I did try it, based on this article (https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:statsview) but I found user could not select a data point after batching. The entire batch of boxes would just come up as “batch[1]” instead of “box 12987” that the mouse was pointing at.

@pslusarz said: I did try it, based on this article (https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:statsview) but I found user could not select a data point after batching. The entire batch of boxes would just come up as "batch[1]" instead of "box 12987" that the mouse was pointing at.

Yes, picking becomes more difficult as you will have to manage that yourself. But that’s the tradeoff.

Every object has overhead. Updating, culling, depth sorting, draw dispatch, etc… That per object cost (especially draw dispatch) really adds up. A modern GPU can churn through many millions of triangles but will have problems with even a few thousand separate objects.

For picking, you will get the location and then you can check back through your data points to see which one was hit.

2 Likes

I think I can manage that. Thanks for pointing me in the right direction.

If you use a BatchNode, picking will return “batch[1]” and “box12987”, so you could use this.
Also if you’re trying to make a box world I suggest using the cube framework available here http://hub.jmonkeyengine.org/forum/topic/cubes-a-block-world-framework/

1 Like

That made the difference. With BatchNode I have no performance problems anymore. Cube framework looks excellent, too. When I get my thoughts together, I’d like to update the performance section on the wiki. Thanks again.

1 Like