- Home /
Does using "half res" in the quality settings reduce texture RAM usage?
I'm looking into ways to make my game work better on older mobile devices (both iOS and Android). We have lots of textures for 2D graphics and they're definitely the biggest memory consumers.
One thing that I keep seeing pop up over and over is that if I enable mipmaps on those textures, I can just change the quality settings on game load to use full, half, quarter, or eighth res textures. While this does seem to affect the visual quality on the device, in the profiler the textures are still using the same amount of RAM. For instance I have a 2048 square texture at 16 bit with mipmaps enabled, which is 10.7MB. The memory consumption for this texture is ALWAYS 10.7MB, regardless of the quality settings.
I've heard conflicting reports about whether or not all the mipmap levels of the texture are actually loaded into RAM. Some say they are, some say they're not. So.... which is it? When I reduce the texture quality, are the top-level mipmaps actually being discarded from RAM and the profiler fails to report that? Or is it just that the top-level mipmaps aren't sent to the GPU, but the textures still consume the full amount of memory? I would love to hear an official word on this because I can't seem to find any.
EDIT: I've profiled the actual memory usage on Android and it seems that it really DOES reduce memory usage. In which case the Unity profiler is... maybe not lying but perhaps just missing out on an important aspect of the memory usage. I'm using 4.1.5f1 though the 4.2 changelog doesn't mention anything about this. Perhaps then this should be chalked up as a profiler bug.
Answer by Joyrider · Aug 05, 2013 at 11:34 PM
Hmm, I'm guessing you're using Unity's QualitySettings, but doing so, and thus using mipmaps for 2D graphics, tend to take up more memory (about 33%). Mipmaps are a rendering pipeline optimization to increase rendering speed and reduce aliasing artifacts, not a memory optimization. So using mipmaps and getting to choose which one to display will just affect rendering speed, not reduce memory usage. Mipmaps is only about GPU bandwidth. As such when using mipmaps you check to see which of the mipmaps to send to the GPU (only 1 level per texture), if the object moves and takes up less screenspace, you'll just change the mip that is sent to the GPU for rendering accordingly.
The only way of reducing the memory footprint would either be to reduce all textures before build and make an old-phone-specific version of your game or to have 2 sets of textures (which means a bigger app), with the lower resolution as default, and do some texture swapping at runtime to get the higher resolution ones on more recent phones.
Don't know if anyone has another suggestion, but that is all I can come up with at the top of my head.
I must've edited it while you were typing your reply, sorry! I've read many places that the QualitySettings.masterTextureLimit DOES impact texture loading as well, as it will only load mip levels from that level down (so 0 is full res, 1 is half res etc), and my memory profiling seems to confirm that.
hmm, never used masterTextureLimit :) I'll try it out when I have a moment
In the editor, that setting is exposed in Edit > Project Settings > Quality, then choosing the "texture quality" (full res = 0, half res = 1 etc.)
Your answer
Follow this Question
Related Questions
The quality on mobile device is very low 2 Answers
Memory Managmenet 1 Answer
GUI Texture Fade in/out (Android) 1 Answer
GUI Texture Resolution 0 Answers