Performance problems with many objects

Hello,

I need to visualize a lot of points in three dimensional space in jMonkeyEngine 3. One point is represented by a tetrahedron (a dome with two planes and three corners) to minimize the number of triangles per point.

That basically works but I get massive performance issues with more points. I probably need to visualize a million points or something like that but the FPS drop with more points until they hit 0 at around 250,000 points. The strange thing is that this is independent from the underlying graphics card. I tried it with an “Intel® UHD Graphics 620” and with a “Quadro RTX 6000/PCIe/SSE2”, both with the same result. It also does not make a difference if the display goes full screen or to a canvas inside a JFrame.

I would expect the Quadro to be able to render significantly more before finally giving up. I would also expect the performance to be better in full screen mode. This however is not the case. I suspect that rendering isn’t taking place on the GPU at all but on the CPU. Could that be it? If yes, how do I confirm this? If no, what else could be the cause?

Best regards
Christian

2 Likes

If each “object” is an individual Geometry then you are blasting the graphics card with a draw call for each object. You are bus limited and basically your graphics card never gets to work. Like, you can send one tiny package in a truck… but then a million tiny packages in a million trucks… it’s going to take a while.

Or you can put a bunch of tiny packages into one truck. This would be batching.

Instancing may also be an option but is no silver bullet as there would still be some per-object overhead. For tiny objects, batching may be better… but you should try both.

Beyond that there will also be the scene graph overhead. So even if you use JME’s built in batching (BatchNode) or instancing (InstanceNode) you may find that just managing all of those objects and the effectively duplicated memory is too much.

…then you must do your own batching and just update the objects in the ‘one big mesh’ directly yourself.

9 Likes

well said :smiley:

1 Like

Thank you for pointing me in the right direction, I will try batching and instancing.