Hello Guest

Author Topic: Optimal way for creating multiple sprites respecting z-order  (Read 4109 times)

pan_henryk

  • Newbie
  • *
  • Posts: 20
    • View Profile
Hi,

Some time ago I used static sprite batcher to optimize creation and drawing of multiple static sprites which previously had separate game objects.
Now I am looking to do it with another group of sprites, but my problem is z-order, which rules out static sprite batcher:

- we are using z-order not layers to determine drawing order
- static sprite objects drawing order can be mixed with dynamic ones (which need separate game objects).

Any tips how this could be done with 2dtoolkit? My goal is to get rid of myriad of game objects, reducing draw calls is not important here.
Each of my sprites would have scale rotation and position and possibly a collider.
Maybe sprite batcher could be hacked to do it? (separate renderers?)

Thanks in advance,

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Optimal way for creating multiple sprites respecting z-order
« Reply #1 on: May 17, 2014, 09:07:25 pm »
The static sprite batcher could be hacked for this I suppose, or you could manually split up into foreground and background static batchers. If you dont need alpha blending on the static sprites, you could use alpha test and get some nice gains there? That way you could just zsort with those.

pan_henryk

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Optimal way for creating multiple sprites respecting z-order
« Reply #2 on: May 19, 2014, 09:03:09 am »
I tried splitting batchers - that is starting new one after each time dynamic object appears in z order. Seems very promising when tested on PC, now I need to verify performance on mobile device.