- Home /
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.
Answer by ReJ · May 24, 2010 at 01:21 PM
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
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).
Answer by Jaap Kreijkamp · Jan 10, 2010 at 12:01 PM
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.
Your answer
Follow this Question
Related Questions
Toon Shader for the iPhone 1 Answer
Why do Zwrite, Ztest, and Colormask simplifications not optimize shader performance? 3 Answers
What shader blending modes don't work on iOS? 1 Answer
Is there a way to visually show the order in which geometry was rendered in your scene. 1 Answer
Simple UI Circle breaks batching 0 Answers