- Home /
Trying to reduce draw calls but...?
Hi. Since I don't have much time I am trying to mess less with modelling or optimization. But it seems like I miss something because when I import a model and add it to scene, my drawcalls grow huge. So I looked up so called mesh combining and other stuff. Although I couldn't combine meshes in Unity, I combined them in modelling engine and it seems to work well. Now the problem is I have a pretty complex object. When I drag this object in an empty scene, it has 12 drawcalls (Since it has 12 materials makes sense). For each new instance of it, drawcalls increase by 7 (isn't that weird?). But when I put this object in my actual scene, drawcalls increase by 36 for each new instance. I disabled casting and receiving shadows, why should it do this. Also why doesn't batching work? They are all the same object. Here is a screenshot of the object. I got it from 3d Warehouse for educational purposes.
Did you mark it as static??
If you didn't mark it as static, it won't batch. $$anonymous$$eep in $$anonymous$$d that even after you mark them as static, they will show higher draw calls in the stats window before pressing play
Highpockets, it should still dynamically batch, provided it fits certain criteria and the moon is in the right phase.
Sir$$anonymous$$urt, what shaders do you use for your 12 materials and how many lights are in your scene?
I find it far fetched that all those leaves are under the 900 limit
Shaders are Diffuse. $$anonymous$$y scene has 4 lights. Also I was wondering why static batching doesn't work and I just noticed it requires Unity Pro.
Answer by AlkisFortuneFish · Feb 08, 2014 at 11:23 AM
Yes, even if it casts no shadows, in forward rendering one pass is made to render one pixel light, vertex lights and spherical harmonics lights and then an additional pass for every extra pixel light.
If the model has more than 65k verts I would forget about dynamic batching.
If you atlas the textures and use the same material, you should be able to merge most of the tree geometry, so that your model takes fewer than 12 drawing calls per light.
You should also consider exactly what you said, putting the tree in another layer and setting the lights' culling masks accordingly.
Answer by KurtGokhan · Feb 08, 2014 at 11:29 AM
Thanks for all help. Here is the steps I took to reduce some draw calls. - When exporting from modelling engine, I was exporting standalone edges so I unchecked it (silly me) and vert count is now 47k and material count is 8. - I changed shader to Vertex-lit, dragged the shininess to the end. I have almost same look as diffuse shader. - Draw call count is 8 now. For every new instance draw call increases by 5. I guess 3 of the materials have right vertex count to batch.
You should turn that to answer.
Your answer
Follow this Question
Related Questions
Understanding draw calls 0 Answers
Batching problem. (objects with shared material are not being batched) 2 Answers
Is texture atlasing useless when you are constantly changing materials? 2 Answers
Is it possible to utilize iphone dynamic batching with "traditional" animated sprite techniques? 1 Answer
Dynamic batching of animated models 0 Answers