OpenGL performance optimisation

Hi,

i’m new here and have not too much experience with OpenGL. I’am trying to make a 3D game with OpenGL. The scene is a beach with a lot of palm trees.
I have now about 390 palm trees (390 times the same model with differently modelMatrices), a palm tree-model have about 1200 vertices, i have shadow calculation on the terrain and the trees, there are also 20000 dust-particles random distributed on the whole terrain (random movement, rendered with instancing).

I’m now trying to optimize the performance, unfortunately i have no idea, what is ok or not. FPS is always above 70/80, i think it’s ok, the most displays have only 60 Hz. Memory usage is between 300-700 Mb, i think it is also okay with the whole textures, dudv and normal-maps and sounds, but the CPU-usage is at 30%-40% (Intel i5-3570k), when the camera looking at the palm-forest, this seems to be to much for me…i have also tried to render the forest with instancing, unfortunately without considerable difference by the CPU-usage, i’m not sure, if i do it right, i think with instancing, the CPU makes only one draw call and loads all the model-matrices in the shader, is that right? The trees have no movement, i calculate the whole 390 model-matrices only at the initialisation and not evey frame.

Can someone explain me, if the CPU-usage is to high or not, and give me eventually some tips and tricks to increase the performance/ decrease the CPU-usage?

Thanks, Atteela
P.S. sorry about my bad english!

What do you do on the CPU side ? Are your particles location/colors… calculated on the CPU ?

Having 100% on a CPU core is not bad too. Having less could indicate that you might be GPU bounded (so the CPU cannot works as fast as expected due to the GPU slowing things down).

First of all, thank you for your answer!

The particle positions will be calculated in each frame by the CPU (it calculates the new model-matrices, loads them into one vbo then makes one glDrawArraysInstanced-call).
I have made a test, if i don’t render all the particles, the CPU works farther with 30%-40%, but if i don’t render all the trees, it works only with 20-22%.
So it must be because of the trees. If i render the trees with instancing, the CPU-usage should be less, or not?

The CPU usage is fine.

This can use 100% of a CPU core:

while (1) {}

Thank you for your answer, then i can go on :slight_smile: