- Home /
Draw Call Optimization
Hello guys.. I have a scene with 3 cubes of same material and 3 sphere with same material but other than the one of cube.. So basically I have ***
2 materials and 6 objects
**.. Both materials have same shader 'Deffuse'..one with color and other with texture*.. If I put only 3 cubes then there is only one draw call..sounds good.. :) But If I put only 3 sphere then there are 3 draw call..sounds bad.. :( Why this is Happening..? Thnx..
Are you making any changes to the materials at runtime...change the color for example? Any runtime material changes will create a new material instance for an object and therefore break batching.
Are these static or dynamic objects? How many vertices do the spheres have? There is a limit to the number of vertices that can comprise a dynamic batch, but you can read about that at http://docs.unity3d.com/Documentation/$$anonymous$$anual/DrawCallBatching.html.
Answer by dubbreak · Mar 23, 2013 at 05:28 PM
See this question: Draw calls using same material
In short: the sphere has too many vertices to batch regardless of whether they use the same material (if you are using the default sphere it has 526 verts).
If you check the Draw call batching section of the manual it states: "Batching dynamic objects has certain overhead per vertex, so batching is applied only to meshes containing less than 900 vertex attributes in total."
3 draw calls is nothing on any platform. The reason it doesn't batch is because with many vertices the batching has more overhead than another draw call. For some platforms you'll want to stay under 100 draw calls.. but it's not like you have to aim for 1 draw call.
Answer by mohammadkhatri · Mar 28, 2013 at 05:51 AM
thanks :)
Glad to help. If it solves your problem please make it as the answer (which will close the question as resolved).
Done .
can u help me with this que. ?
http://answers.unity3d.com/questions/426376/i-am-using-xcode-46-and-trying-to-deploy-my-applic.html
Answer by jmunozar · May 09, 2014 at 03:59 PM
this is one year old but theres a package in the asset store that combines the materials from similar objects into one material hence reducing drawcalls drastically.