Jump to content

Sprite Batching order pixi v4


damager
 Share

Recommended Posts

Hi all, I'm wondering, is there a way to manually select texture atlases order to batch (if I have more than device supports). Previously I worked on Phaser CE(based on PIXI renderer) and there was an option to choose an array of textures that I can batch firstly. Now I'm not sure is there a created way to do this. Thank you for your time)

Link to comment
Share on other sites

pixi order is just tree order. If you want better management - use https://github.com/pixijs/pixi-layers/ , however, its not about atlases, its about layers ( shadows, characters, hpbars).

Pixi v5 renderer differs from v2 significantly, so I can't exactly explain logic with atlases. It uses multi-texturing , so cases like "A B A B A B A B" are solved with MAX_TEXTURES=2 , and its usually 16. I really cant compare it to ordering based on atlases.

P.S. v5 is a bit different from v4, but v4 also has multitexturing.

Edited by ivan.popelyshev
Link to comment
Share on other sites

Thank you for the quick response! If I have a lot of draw calls, then I should reduce the count of textures? Or just better manage the order they are drawing? In my case, I have a "P" and "O" textures instead of "A" or "B" that cause a lot of draw calls and they just do not fit in the 8/16 textures limit.

Edited by damager
Link to comment
Share on other sites

You can use something like gstatsjs to count drawcalls. Just disable SpectorJS if you use it, they dont like each other. https://github.com/eXponenta/gstatsjs/

Basically, its overriding "gl.drawElements".

If you have less than 30 drawcalls on mobile or less than 100 on pc then its fine and they dont affect your app much. Some people make it down to 20/50.

Look for other bottlenecks if your number is low, no point in optimizing 10 drawcalls :)

Edited by ivan.popelyshev
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...