Static objects increase drawcalls when they are outside the view?

Hello everybody!

I’m trying to implement in my game a big map. So I try to test performance with adding a lot of static object.

Here a screenshot with object only on the camera view :

There is actually 57 batch. The problem is when I duplicate all these objects, to put them far away on the right like this :

And here the screenshot with the drawcall number:

Like you can see, drawcalls are increase to 97 from 57 before… That’s mean that even if static object are not in the camera view? Or maybe when unity combine mesh together, they are not combine by distance?
So I have mesh in the camera view that are combined with mesh on the right ?

I know that I can combine myself these mesh to reach the limit of 65000 vertice in specific zone to optimize this by myself, but I would like to know if it’s normal or not ?

EDIT: Weird behaviour , If I zoom out with the camera , drawcall decrease to the good number… and If I zoom in again, they incrases… And in both case, objects on the rights are far away and not visible in the camera view
I don’t understant what happening u.u…

If someone can tell me if it’s normal or not ? I’ll really appreciate :smile: !

Have a good day !

EDIT: using unity 2021.3.9f1, URP 12+

I don’t see any but maybe it has something to do with shadows. There are 1467 shadow casters and even shadow casters outside the view will sometimes need to be rendered to the shadow map. There are two view frustums, the one of the camera and one of the light.

Just take a look at the frame debugger to see where the draw calls are coming from.

thanks for helping me @c0d3_m0nk3y
I have forbidden to say it but I test with shadow disable ! The difference with or without shadow is 4-5 draw calls.

I tried with the frame debugger and effectively, my objects are randomly batch.

there is a way for unity to do it automatically by distance ?

If it’s not the shadows, I don’t know why this would be the case, unfortunately.

You can do manual culling with the CullingGroup API.

Look at the setpass calls.
That’s the actual draw calls going out after the SRP batcher and other batching according to the frame debugger. So actually one less call.
If performance is better with more batches, it’s fine right

Thanks @c0d3_m0nk3y for the answer, I will effectivly doing it by myself if needed :slight_smile:

Hi @DevDunk , thanks for helping me !
If you are talking about my zoom-in/zoom/out weird behaviour, effectivly performance are better when more draw call are display , It’s answering at this weird problem ! thanks to you!

I will combine mesh by myself for the other part of my problem .
(I tried with a lot more objects, on a bigger map and with a good repartition, when I combine mesh in multiple part manually, I have 30 draw calls , so if someone wanna know, it’s better to doing it by self)

Thanks :smile:

1 Like