I'm using IOS Basic version of unity and am trying to reduce draw calls to keep a scene nice and zippy.
I understand my version of UNITY doesn't support static batching... not exactly sure how it relates to textures / texture atlases though. All of my objects pretty much use the same basic material, different textures, and I am pretty sure I can work out how to combine them into one texture using photoshop and the like. What I can't figure out is how to use that texture on multiple objects, (is it only available programmatically?) and whether it would actually make any difference?
My game is a simple space 2d shooter, but unfortunately it's generating 18-21 draw calls, 11.5k tris, 16.2k verts, vram from 4.9-21MB and VBO total of 89 - 1.1MB
This translates to some strange jerkiness on my iPhone.
Many thanks, Mike
asked Oct 09 '10 at 09:22 PM
Draw calls aren't your problem (Under 30 is generally considered reasonable for even the oldest iOS devices.). Reduce the VRAM your textures use, via size change or more compression.
For whatever reason, GUI Textures do not batch (which is apparently less of an issue with rendering improvements in 3.0, but still true). However, without seeing your project, my assumption is that reducing draw calls isn't going to do much, if anything, for your framerate.
Personally, I do use textured meshes for my 2D elements, and Text Meshes (because they also batch, unlike GUI Text), but I mainly do it for the versatility of what can be achieved with meshes. An example of this, is, yes, moving UVs over an atlas, which, if you're changing your GUI a lot, will probably result in an improvement over using a bunch of smaller textures. While using atlases is likely to reduce draw calls, the benefit for a low draw call game like yours will most likely lie in removing the need to switch materials/textures, which, as far as I understand, is a significantly slower operation than a draw call. (Either way, it does take up cycles and should be avoided if only for battery life you save. ;-) )
If you're not switching the textures used in the GUI much, you're probably best to leave your method as is, assuming it's easy for you to deal with.
answered Oct 12 '10 at 05:15 PM
Jessy, thanks for your comment, you were 100% correct. When I went into each texture and set everything at a minimum, despite having north of 20 draw calls, the gameplay experience was fast and perfectly smooth!
I currently have my gui drawn using GUITexture, which I understand adds drawcalls-- is this a big deal? Should I make the effort to move to EZ Gui or the likes, or will I not notice too much in the way of improvement?
answered Oct 12 '10 at 11:07 AM
If you are interested in reducing draw calls via atlasing, (giving you more calls for effects, etc), what you need to do is import the models for a particular atlas into a single file, adjust the UV's to match your atlas, then export each model to a single file, one for each model- in Maya, you can use File>Export Selected to do this (this will save the new UV layout for each model). Import the new models into Unity, make a shader with the atlas texture, and apply it to your newly UV'd models.
One texture to rule them all:)
answered Oct 12 '10 at 12:59 PM