How to change texture format to RGBA4444 for Sprite Atlas created in assets.xassets

孤街浪徒 提交于 2020-01-17 03:01:29

问题


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:


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.



来源:https://stackoverflow.com/questions/39106245/how-to-change-texture-format-to-rgba4444-for-sprite-atlas-created-in-assets-xass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!