Hello Guest

Author Topic: Reducing Drawcall rate to 1?  (Read 4916 times)

ENAY

  • Newbie
  • *
  • Posts: 17
    • View Profile
Reducing Drawcall rate to 1?
« on: June 06, 2012, 01:48:26 pm »
Is it possible?

By my understanding of Unity, creating a sprite from a single atlas once or 100 times is going to be 1 draw call.
But 5 sprites each using a different atlas, that is going to be 5 drawcalls even just from 5 sprites.

Am I wrong in this theory or does tk2d have some special optimising?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Reducing Drawcall rate to 1?
« Reply #1 on: June 06, 2012, 02:35:59 pm »
That is inevitable due to how current graphics hardware works. Different atlases = different textures, and different textures have to be drawn with different draw calls. There isn't anything you can do to optimize this.

ENAY

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Reducing Drawcall rate to 1?
« Reply #2 on: June 07, 2012, 03:15:14 am »
Yes, but I guess what I am saying is, surely it is better to have as many large atlases as possible?
For example I have several 256x256 atlases but surely if I combine them into 1 big atlas then I will only have 1 drawcall instead?

In tk2d you can choose to have multiple atlases within the same name. Now is this really truly separate atlases or is tk2d displaying them as separate but in fact they are all combined into one big atlas atlas in memory. For example is 4 separate 256x256 atlases being stored as one big 512x512?

I guess this is the questions I should have asked in my first post. Sorry about that :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Reducing Drawcall rate to 1?
« Reply #3 on: June 07, 2012, 11:58:23 am »
One 512x512 atlas is certainly going to be better than 4x256x256. But that isn't what the atlas spanning feature is for - its for convenience when you have a lot of animated sprites, for instance. Think of a scenario where you have loads of sprites for an animation, which will take say 2x1024x1024 atlases. But its for one animation, so only one of these will be visible at a time (per animated sprite).

Its a bad idea to use this for background sprites, etc. as the order in the atlases isn't guaranteed, but for the situation described above, it works reasonably well. You can obviously do better if you know which frames could possibly be drawn with others, but if you want that kind of control, simply create multiple sprite collections manually.