How to change texture format to RGBA4444 for Sprit

2019-09-10 21:17发布

So this is my first app and I am stuck and for almost a week I can't find a solution. I've created a lot of animations for different characters and found out that my game' memory usage is about 200 mb. Before I didn't worry about this because, as many beginners I thought that after I'll compress my png textures this size will decrease also. But that didn't happen. So I started to search what I can do about it and found out that changing the texture format from default RGBA8888 to RGBA4444 can reduce memory usage almost by half.

I found an answer Sprite Kit Texture Atlas: Define Image Format (RGBA4444, RGB565, …) where it says that you can change the output format from the Build Settings > Output Texture Atlas Format. But that doesn't work for me, because my Atlases are created in the assets.xassets folder. "Build Settings > Output Texture Atlas Format" settings are there only when you create an atlas in the project folder and not in the assets.xassets folder.

So my next step was to change the textures format manually in the TexturePacker. And I did that, but the problem is when I've add these new textures back to assets.xassets folder, even their quality is low, but they still have the same memory usage as textures with RGBA8888 format.

I've read a lot of resources but didn't find any information about how to change the Output Texture Atlas Format if Sprite Atlas is in the assets.xassets folder.

So at this point I don't know what to do, and my question is - How can I change the texture format to RGBA4444 for my Sprite Atlases in assets.xassets folder? Thanks in advance.

1条回答
劳资没心,怎么记你
2楼-- · 2019-09-10 21:56

In my testing with SpriteKit, I found that all textures were being loaded into memory as RGBA8888 (meaning 32BPP). The texture packing might store the data on disk as 4 bits per component, but that will not matter at runtime when loaded into memory at 8 bits per component. If you are interested in a way to reduce runtime memory usage, have a look at: this SO answer for info about a memory reduction shader for SpriteKit.

查看更多
登录 后发表回答