x


Drawcalls looks weird

Hi, I found out about the draw calls calculation inside Unity and I am not sure why it's happening and it looks weird to me. Can somebody explain why do the Unity makes more draw calls when the camera is near to the object. I have got 100s of static objects inside the game level and you can see the number of draw calls in the following pictures.

Draw calls and poly count when the camera is near alt text

Draw calls and poly count when the camera is far alt text

more ▼

asked Aug 17 '11 at 06:14 AM

softready gravatar image

softready
41 8 10 11

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

Your total draw calls actually does go up, from 101 to 127. The 'batched' to the right of draw calls is the number of draw calls that Unity was able to combine into other draw calls - when three objects share the same material, Unity can do one draw call instead of three, so it has 'batched' two draw calls.

It looks like when you're far out Unity simply does a better job of batching then when you're close in. As for why that is, I'd have to look at how you define your meshes, materials, etc.

more ▼

answered Aug 17 '11 at 09:03 AM

Julien.Lynge gravatar image

Julien.Lynge
7.3k 20 25 49

so.. it looks like Unity does better batching when the camera is far away from objects?

Aug 17 '11 at 09:18 AM softready

It could be that, it could also be that in your second screenshot there are no meshes that are only half on the screen. Or, it could be that in the second screenshot there are no gameobjects offscreen sharing materials with those onscreen. I don't know how exactly unity does its batching and rendering, so your guess is as good as mine.

Aug 17 '11 at 09:38 AM Julien.Lynge

yes.. In the scene, I've got three different materials. One material is for buildings and other two for Gate and Plane model. I've no idea of what's wrong :) May be it's a bug..

Aug 17 '11 at 09:40 AM softready

I don't think that anything is wrong - Unity is simply following its algorithms to try and batch the calls as best it can. 6 vs 17 draw calls is really just noise - you only need to start worrying about draw calls when it starts getting up to 500 or 1000.

Aug 19 '11 at 04:54 AM Julien.Lynge
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x110

asked: Aug 17 '11 at 06:14 AM

Seen: 559 times

Last Updated: Aug 19 '11 at 04:54 AM