- Home /
Texture Doubled in size in RAM Profiler
As you can see, the texture is only 5.3 mb but at runtime is referenced twice as Material instance and material prefab and it take double of the size! It is really a lot of memory! What can I do for reduce this memory consumption? I have already compressed to 8 bits. what else? thank you!!
Answer by TheSOULDev · Sep 02, 2017 at 03:43 PM
First you have to ask yourself if you really need a 2048x2048 texture - I can see that it is not a particularly detailed one, especially if you set it to 8bit. Secondly, you should crop the black space you don't need - in your case, it is well above half the texture. Also, I'd advise you to use DXT5 compression as it looks better than ETC2, saves space, and is faster.
There was someone with something like a 13000x4000 texture who had 120MB of RAM taken per picture, and by cropping it it dropped to 5MB or something like that, so there's that.
The problem is not the compression. The problem is WHY it is doubled in memory !!
and As per your information : DXT5 didn't change at all the size. Secondly, If I cut the transparent part the background will not be squared and it will increase in size and not decrease as one could think, since Unity prefers squared textures to compress.
But this is out of the question. WHY in memory it is doubled ? I reach easily 100 mb.
DXT5 compression didn't enhanced anything. Just Crunch compression of course works, but that is another story.
When texture decompression is not supported on a device, Unity unpacks it to a 32-bit RGB, which pretty much doubles it in memory. Also, if you don't want to crop it, then you should at least resize it. The texture you have doesn't look like something that needs a higher res than 1024x1024. If you have details that are not visible on the picture, it would be way better to use smaller sprites for that. Your texture is pretty much a 3 color texture without any significant detail. You're wasting too much space and resolution for something that isn't really detailed, or at least not visibly. If those extra 5 $$anonymous$$B are a problem, then you should have already attempted to make it a 1024x1024 texture. If the quality loss is unbearable, which it shouldn't be, just apply AA to the edges. Also, if you turn mipmapping off, you can free around 2.3 $$anonymous$$B.
Excuse me, but you didn't get the point of the question. The Point is that: 1) a background is allocated in memory EVEN if is NOT in the scene and EVEN if is not under any Resources folder.
2) Disabling mipmaps just reduce a bit. The size of the file is 4 $$anonymous$$B, In memory however becomes 10$$anonymous$$B (with mipmaps) and 8.3 mb (without mip maps) so it is always doubled.
Answer by Bunny83 · Sep 02, 2017 at 05:53 PM
You generated mipmaps. They don't require the same space as the full texture but at least half the full size. Since for performance reasons textures are almost always stored with a power-of-two size, it means at least one side would be doubled.
Excuse me, but you didn't get the point of the question. The Point is that: 1) a background is allocated in memory EVEN if is NOT in the scene and EVEN if is not under any Resources folder.
2) Disabling mipmaps just reduce a bit. The size of the file is 4 $$anonymous$$B, In memory however becomes 10$$anonymous$$B (with mipmaps) and 8.3 mb (without mip maps) so it is always doubled.
Please watch the screenshot carefully.
Answer by LeleUnity · Sep 02, 2017 at 10:31 PM
I noticed this. It might be a clue. Someone can explain it ? I am using this texture on a simple quad where it is offeset giving the illusion of infinite repeated background. I notice the voice: "Material prefab" as well as "Material instance". Both I believe occupy 4mb. But WHY this happens?