Hi Everyone,
I’m positing this in 2D because this issue is mostly related to images and sprites but it can also be a more general topic so feel free to move it if that’s relevant.
I’m working on a game that has a whole lot of 2D content which is stored as sprites on multiple texture atlasses that are automatically packed with Unity’s (awesome) sprite packer. My use case is that there are only few of those bits of content loaded at the same time but there are many of them so I care more about their overall size than their individual memory footprint. Also, the art style of these assets (sharp black edges with smooth gradients) looks like crap with iOSs PVRTC compression (even in the Best setting).
From a RAM/VRAM standpoint I could pretty well live with having this content as uncompressed 32bpp RGBA but then the downloadable size and most importantly install footprint of my app literaly explodes. this is unacceptable in my situation.
I believe this is due to the fact that Unity’s importer compresses images as buffer in formats that are readily edible to the target platform’s GPU (PVRTC, ETC, RGBA32, etc… ). So an uncompressed 1024x1024 texture adds a straight 4Mb to the app’s install footprint… this is tough.
I found a hacky way of working around that which is using png images (or jpegs where I don’t need alpha), renaming them as .bytes, loading them from ressources and decoding their content at runtime into Texture2Ds. In term of RAM usage, I believe it is stricly equivalent to using uncompressed image formats (Except for a small peak around the decoding phase). In term of quality, png is losless so it is also equivalent. the only thing that changes is that my build/install size is dwarved. It actually perform even better than the Compressed Texture mode (in term of build size), PVRTC being a less efficient block-based/fixed ratio compression scheme designed for in-place GPU decompression.
Unfortunately this method can hardly be generalized because it comes with many drawbacks: those “images” are not usable/viewable in the editor, they cannot be used as Sprites and thus cannot be packed. This make using this technique very hazardous for anything more than a fixed background. Does anyone have a way to deal with that?
Wouldn’t that be great if we could choose to keep images as png, jpegs (or even keep the original image encoding so we can optimize their size offline) as a compression setting and have Unity unpack them in-memory at runtime upon loading? That would be equivalent to working with uncompressed images in term of Memory usage but whith a much smaller build/install size.
That’s my X-Mas Letter to Unity.
Cheer