TextureAtlas is Slow

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

Re: TextureAtlas is Slow

Postby CoDi » Wed Jul 11, 2018 7:20 am

I found that there are two major bottlenecks with (large) texture atlas pages:

- As already said, I/O speed. Shoveling all these bytes off disk needs time.
- PNG decoding is hell-a-slow too. They compress extremely well though, so it's mostly an I/O vs CPU trade-off.

How large (in pixel/page size) are your 20 atlas instances? 500 ms/instance sounds fairly high, but hard to tell w/o the numbers and your CPU/disk specs. As a comparison, here I'm loading two very large atlases in roughly 2.5 seconds - one has 6 pages of 4096x4096, the other 3 pages of 4096x1024 (*). This is on an i7 and a pretty fast SSD.

I'm currently working on reducing not only the load time, but the TexturePacker time as well. It takes about 40 seconds to pack all of this, about 4.800 sprites, on the SSD and with a hot file cache. Our artist is not happy with waiting up to a few minutes each time he has to pack them on his not-quite-so-fast workplace desktop.

(*) there are technical reasons why this is three pages, instead all of them packed into a big one.
Robotality - steamworks4j - @code_disaster - codi^r @ #libgdx
Posts: 205
Joined: Sun Nov 24, 2013 11:55 am
Location: Hamelin, Germany

Re: TextureAtlas is Slow

Postby captainflyaway » Tue Jul 17, 2018 8:30 pm

I see a different issue:
You are having 20 characters, each using its own animations and so on.
What about adding now characters or so? isnt that a lot of work (and making your game even slower?)

I dont know about spine but I think you should use positions relative to the character to create animations ingame. That way you are only loading the bodyparts and the armor - e.g. 20 sprites - position and rotate them to make an animation only requires a few numbers
Posts: 211
Joined: Mon Feb 20, 2017 7:52 am


Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest