- Home /
Static Batching HELP!!
Hi, Can someone please tell me why static batching seem not be working properly, I have 4 barrels and 4 boxes all share the same texture, so I thought that with the below screen shot the Draw Call should be 14 not 19 as in the picture, as the one with nothing in screen shows 12 Draw Call's.
If I put the 4 barrels on screen alone the Draw Call is 13 as I'd expect, same if I put the 4 boxes on screen alone, and 15 Draw Calls if I but the 4 barrels and 4 boxes on screen.
I'm confused ??
They all share Mobile/VertexLit shader, tried with just VertexLit same outcome.
Unity 3.5.2f2 iPhone Pro.
all objects marked as static?
material instance is the same for all objects? not just shader and texture must match
objects have same scale values?
just test:
instantiate all objects on the screen and move camera VERY far away from current position, but don't lose focus on objects - notice draw calls changes
now try don't move camera and change near clip plane of current camera (leaving object farther them near clip plane) - does it affect draw calls?
Answer by Griffo · Jul 16, 2012 at 06:34 PM
I put 4 barrels in the scene that was doing 12 Draw Calls and it went to 13, then I added 4 box's along side the 4 barrels and it went to 16.
I then tried you suggestions and the first one no change still 16 Draw Calls, the second one the Draw Calls went back down to 12.
If I put 4 barrels it goes up 1 Draw Call from 12 to 13 If I put 4 boxes it goes up 1 Draw Call from 12 to 13
Then if I put 4 barrels and 4 boxes it goes up 6 Draw Call from 12 to 18, thats with all boxes the same scale and all the barrels the same scale but 0.5 taller than the boxes, should it not go up 2 Draw Calls from 12 to 14, 1 Draw Call for the batched barrels and 1 Draw Call for the Batched boxes ?
the main issue in your case i see in z-size precision limit. for batching unity sorts all objects by length from camera, and if some objects are placed very close to each other (by z-position from camera, not in XYZ) unity can fail to sort it and batch fails. changing near clip plane changing z-size precision and changes the situation.
finally i havn't a true solution in your case, just try different combinations of camera position and clip planes - there's should be a combination where z-size will calculate correct and you got a picture you want...
O$$anonymous$$ will try different combinations .. thanks for you input, much appreciated.
Your answer
Follow this Question
Related Questions
Static batched objects disappear on OSX player 0 Answers
Creating a field of models...batching? 0 Answers
Static Batching with LOD Meshes/GameObjects & Other Questions 1 Answer
When Static Batching and building, objects checked Static do not appear 1 Answer
Static batching not working (HDRP) 0 Answers