Need some tips to improve performance

Note: the shadow stuff will render the whole scene again from the perspective of the light. So any scene problems (like 8000 draw calls) will show up there again.

If those 200 little guys are animated… that’s a lot. If you detect that they are on the back side of the planet (cam direction dot product with the up vector of the little guy) then you could turn them off: disable the animation control and set cull hint to always.

If they are not animated, that will still help… but getting them down to one mesh would be best of all. Cuts it down to 1/4th of the draw calls for them.

1 Like

@oxplay2 I understand what you are explaining, but the point is that there is something weird going on. Every human seems to count as 4 objects but I am very sure there is only one mesh in this model:
Schermafdruk van 2022-11-15 15-07-45

So where do the three other objects come from?

@pspeed: I’ll try that one right away.

With all of those attachment nodes… do they have things attached to them at runtime like spears or something?

I’ve made the assumption so far that your scene only has one light. Yes?

There is a Directional Light and an Ambient Light, the latter should not impact rendering too much, am I right?

And the guys do not hold any other objects.

what postprocessors/filters do you use?

And just in case, make sure that “hardware skinning” is enabled for animated models otherwise it may highly impact performance.

In the debug console I found there are a lot of these:

nov. 15, 2022 8:46:55 P.M. com.jme3.util.ReflectionAllocator destroyDirectBuffer
SEVERE: Buffer cannot be destroyed: java.nio.DirectByteBuffer[pos=0 lim=64 cap=64]
nov. 15, 2022 8:46:55 P.M. com.jme3.util.ReflectionAllocator destroyDirectBuffer
SEVERE: Buffer cannot be destroyed: java.nio.DirectByteBuffer[pos=0 lim=64 cap=64]
nov. 15, 2022 8:46:55 P.M. com.jme3.util.ReflectionAllocator destroyDirectBuffer

Could that be a timeconsumer?

I guess that is related to this issue

Are you using lwjgl2 with a new java version (16+)?

Edit:
If so, you may switch to lwjgl3 which uses its own buffer allocator and does not use the ReflectionAllocator or if you want to keep using lwjgl2 then you can switch to PrimitiveAllocator instead and let GC clean up the buffers.

Edit2:
For switching the buffer allocator you can use these VM options:

for using the lwjgl3 buffer allocator:

'-Dcom.jme3.BufferAllocatorImplementation=com.jme3.util.LWJGLBufferAllocator$ConcurrentLWJGLBufferAllocator'

for using the primitive allocator:

'-Dcom.jme3.BufferAllocatorImplementation=com.jme3.util.PrimitiveAllocator'