如何在Assets.xassets中创建的Sprite Atlas将纹理格式更改为RGBA4444 [英] How to change texture format to RGBA4444 for Sprite Atlas created in assets.xassets

查看:203
本文介绍了如何在Assets.xassets中创建的Sprite Atlas将纹理格式更改为RGBA4444的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这是我的第一个应用程序,我被困在一个星期内,找不到解决方案.我为不同的角色创建了很多动画,发现我的游戏的内存使用量约为200 mb.在我对此不用担心之前,因为,与许多初学者一样,我认为压缩我的png纹理后,该大小也会减小.但是那没有发生.因此,我开始搜索我能做些什么,发现将纹理格式从默认RGBA8888更改为RGBA4444可以将内存使用量减少近一半.

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.

我找到了答案 Sprite Kit Texture图集:定义图像格式(RGBA4444,RGB565等),其中表示您可以从构建设置">输出纹理图集格式"更改输出格式.但这对我不起作用,因为我的地图集是在assets.xassets文件夹中创建的.仅当您在项目文件夹中而不是在assets.xassets文件夹中创建图集时,构建设置>输出纹理图集格式"设置才存在.

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.

所以我的下一步是在TexturePacker中手动更改纹理格式.我做到了,但是问题是,当我将这些新纹理添加回assets.xassets文件夹时,即使它们的质量也很低,但是它们仍然具有与RGBA8888格式的纹理相同的内存使用率.

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.

我已经阅读了很多资源,但是没有找到有关如果Sprite Atlas位于asset.xassets文件夹中如何更改输出纹理图集格式的任何信息.

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.

因此,现在我不知道该怎么办,我的问题是-如何将Asset.xassets文件夹中的Sprite Atlases的纹理格式更改为RGBA4444?预先感谢.

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.

推荐答案

在对SpriteKit进行测试时,我发现所有纹理都以RGBA8888(意味着32BPP)的形式加载到内存中.纹理打包可能会将数据以每个组件4位的形式存储在磁盘上,但是在运行时以每个组件8位的形式加载到内存中并不重要.如果您对减少运行时内存使用量的方法感兴趣,请查看:此SO答案有关内存的信息SpriteKit的还原着色器.

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.

这篇关于如何在Assets.xassets中创建的Sprite Atlas将纹理格式更改为RGBA4444的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆