Why FPS is twice lower while objects're moving together?

I had a weird result when tried to spawn 7000 entities (you can see it on the images below).
This was the order of actions:

  1. 7000 entities are spawn from code at the same position.
  2. Then, the objects’re going to the random point (all together with the same speed to the one (the same) point).
  3. Then, every object generates his own unique target point - and start moving to it separatelly.

So, the question is:

Why FPS is twice lower while the objects’re moving together to the same point (which looks like it’s the only one object)?

9057289--1252060--1.PNG
9057289--1252063--2.PNG

Do the objects have colliders?
Did you check the profiler?

No colliders, just usual components like LocalToWorld and moving aspect.
Profiler shows only big Gfx.WaitForPresentOnGfxThread difference (30 ms vs 7 ms).

9057400--1252093--3.PNG

What are the differences in the hierarchy of the inspector?
Is vsync enabled? Maybe it just slightly tips to the next vsync tier, making it seem like a huge difference

Seems like a GPU issue, as there is significant overdraw caused by a large number of overlapping objects.

1 Like

Overdrawing the same object 7000 times, vs. drawing the object 7000 times in a different location, does not explain why the FPS is tanked. I’m curious about this one.

The render thread clearly is higher. Overdraw can be more expensive than drawing next to eachother.
Did you try in a build?
Drawing instanced from the CPU might be worth trying to improve performance as well

I don’t get it - on a technical level, why should drawing the object in the same spot be slower than drawing the object next to each other? It’s doing the same z-tests, the same geometry, etc. In forward mode, it would be doing the same number of lit pixels. In deferred, again, all the same number of lit pixels.

Do you have a solid explanation in terms of buffers/tests and GPU architecture?

It’s one thing to say that it is slower because they are drawn in the same spot (which we can infer from the results and conditions), but quite another to explain why. I’m genuinely curious to learn the answer.

I work a lot with mobile, and tiled GPUs can be very picky on certain depth optimizations. When stuff overlaps it will often run the pixel shader for that pixel multiple times (where everything side by side would be once per pixel).
I am not fully sure how this translates to regular GPUs however, but I think this can also make sure the same pixel shader is ran multiple times which might break some optimizations. (or some optimizations being broken in general because of it?)
This is purely speculation however
You could try the rendering debugger and frame debugger to test out some stuff and see how that changes your performance.

Oh this is not my issue (I’m not the OP), I’m just butting in because the problem is annoying me :slight_smile:

1 Like