Before updating to Windows 10 you may need to return your Pro license. More information here

What, exactly, in a shader, stops batching from happening?

I've seen here that batching doesn't always happen. However, I don't think it is tied to alpha blending, as given by evidence here. Is it simply a matter of not using the Geometry queue, or what?

Edit: It's not that, according to the numbers on-screen. I'm clueless, and I haven't witnessed the problem yet myself, but I certainly want to take precautions to avoid it.

more ▼

asked Jan 07, 2010 at 07:48 PM

avatar image

19.1k 212 203 317

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

2 answers: sort voted first

I explained some of the batching details in my iPhone Optimization talk at Unite 2009.

You can watch video here: http://unity3d.com/support/resources/unite-presentations/optimizing-for-unity-iphone-1.5

more ▼

answered May 24, 2010 at 01:21 PM

avatar image

361 1 3 8

I believe from watching the numbers myself over the past few months, and listening to what you said, that it has to do with inserting transparent objects with one material in between transparent objects with another material. Using the same material on as many objects as possible seems to really help out here (they're primarily flat quads).

May 25, 2010 at 01:12 PM Jessy
(comments are locked)
10|3000 characters needed characters left

Lights seem to ruin batching, even if the gameobjects use a material that doesn't use lighting. One light is ok, but if you have two or more the amount of batching is reduced fast. Luckily lights that are completely out of range don't matter. To have some useless stats:

Test scene with floor plane and 35 equal prefabs, (about half of them visible):

  • No lights: 2 draw calls, 18 batched
  • 1 light: 3 draw calls, 18 batched
  • 2 lights: 12 draw calls, 11 batched (numbers depend on light positions)
  • 3 lights: 15 draw calls, 6 batched.
more ▼

answered Jan 10, 2010 at 12:01 PM

avatar image

Jaap Kreijkamp
7.3k 46 71 114

(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



Answers and Comments



asked: Jan 07, 2010 at 07:48 PM

Seen: 3154 times

Last Updated: Jan 10, 2010 at 06:57 AM