Transparency issue for excessively large icon sets?

Hello,

Recently we ran into the issue where in battles, both in troops battle testing and encounters in-game when running actual play tests, the actors and enemies alike all had small black squares over their... well, they were just above the enemies, and for the actors, they appeared in the upper-right corners of their respective portraits.

Searching around to try to solve this one ourselves before asking a question you all probably have heard a million times by now, we saw that it was a transparency issue related to the very first icon in the icon set--that it had to be *completely* transparent, and most people posting "why are there black squares in battle?" questions on various forums and such had mucked up the transparency settings in their IconSet.png image somehow.

So we went back to ours and... no, it was fine. We're using GIMP and we confirmed to the best of our ability that everything was still transparent, that all the transparency settings seemed fine. We opened the exported IconSet.png in Windows 11's built-in Photos app and everything looked fine and transparent there. Hell, we looked at the icons in RMMZ, in things like the States or Skills database entries where one can edit the icons for things and thus pull up the list when choosing which one to use, and it even looked fine and transparent there. This only happened when doing a battle test either through the Troops menu or in-game.

So, on a whim, we tried cutting down our IconSet.png file because the version we were using was admittedly... well, rather absurd. I wanted to stitch together all our favorite packs from various artists we've amassed, so we had an overall file that was something like 12,000+ icons, in an image that weighed in at 512 x 24,692. I know that is ridiculous, which is why I was able to think "maybe it just can't handle something that ridiculous" during all our troubleshooting--we hadn't seen any other solutions to this issue mentioned anywhere besides fixing the transparency, which was fine. ^^;

Anyway, sure enough, with a test version that was cropped down to something... a little more reasonable, sure enough, the issue went away. Our current project uses an IconSet.png file that's a little over 4000+ icons (the image weighs in at 512 x 8,320.) Problem solved, so hey, lesson learned, issue over, right?

Well... since that happened, I'm just kind of curious about two things. One, why would overloading the icon set cause that transparency-issue-like black square problem, specifically? We weren't running into crashes or slowdown or anything else you'd expect from a too-large file devouring all our RAM; were it not for the squares, I'd have thought everything was working perfectly. Furthermore, the issue was behaving as though the very first icon in the set (very upper-left corner of the image) was black instead of transparent, but we fixed it by cropping all the extra size from the bottom of the set; we didn't touch the first icon at all, but it just suddenly worked now that there's less stuff beneath it. (I knew the transparency settings were fine....) What's up with that, I wonder?

And two... well, if there's a soft size limit before things start getting wonky like that, does anyone know what that limit is? I still want to go back and spiff this set up with... geez, it seems like there's always a need for more armor and weapons, more skills and statuses, just more everything. Approximately how big can we get before the black squares come back, and we have to start deciding which icons to keep and which to toss to lighten the load? 😅

Thank you so much for any advice or help you can offer!
I think the problem with the first set of dimensions is that 24,692 isn't evenly divide by 32.
Even with characters sets, if the width is off by 1 pixel, it can throw off the frames in surprising ways depending on what the dimensions of the sheet are. I think it's related to how Javascript calculates floating numbers.
My guess would be it's a texture size limit, which is system-dependent. I don't know what kind of division/batching PIXI may perform on the iconset before sending it to the GPU, though.

I believe 4096 px should be a safe maximum texture size across pretty much all systems, including mobile devices. GPU texture sizes typically (always?) follow a power-of-two sequence: 8192, 16384, etc.

Depending on your use case, you might be interested in the plugin CT_Bolt posted here:
I think the problem with the first set of dimensions is that 24,692 isn't evenly divide by 32.
Even with characters sets, if the width is off by 1 pixel, it can throw off the frames in surprising ways depending on what the dimensions of the sheet are. I think it's related to how Javascript calculates floating numbers.
You know what, I'll bet that was it. We just got greedy again and expanded the icon set to one that's now 512 x 13,312 px... which is only a little over half what that 24K+ monster was, yes, but I'm guessing it's still a size most people here would consider excessive. We did make sure that 13,312 is evenly divisible by 32, though, and maybe that's the difference. Either it just needs to be an evenly divisible size or, if there is a "once it's longer than this threshold, things start to break down" limit, it's higher than 13K, because this 13K set works perfectly.

Thank you so much for the suggestion!

My guess would be it's a texture size limit, which is system-dependent. I don't know what kind of division/batching PIXI may perform on the iconset before sending it to the GPU, though.

I believe 4096 px should be a safe maximum texture size across pretty much all systems, including mobile devices. GPU texture sizes typically (always?) follow a power-of-two sequence: 8192, 16384, etc.

Depending on your use case, you might be interested in the plugin CT_Bolt posted here:
This is an excellent suggestion, and if the problem returns, we'll definitely check it out! It seems to be resolved for now, but it's a huge relief to know there's a backup plan should the size itself prove an issue in the future after all. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/transparency-issue-for-excessively-large-icon-sets.159563/