How do I convert a PNG with alpha to RGBA4444 for

2019-05-24 23:00发布

I have a stack of transparent PNGs that I'd like to use in a SKSpriteNode animation with SKTextures. I'd need to adjust the memory usage of SKTextures by reducing texture quality down from RGBA8888 to RGBA4444.

How would I initialize SKTexture with RGBA4444 texture format?

Edit: IOS Swift Game Development Cookbook: Simple Solutions for Game Development suggests that SKTexture would support PVRTC files as follows:

enter image description here

However, I couldn't get a SKSpriteNode to display a texture generated this way.

2条回答
地球回转人心会变
2楼-- · 2019-05-24 23:51

I just tried and in Xcode 8 the option Output Texture Atlas described here is no longer available into Build Settings.

I suspect (but I could be wrong) the control has been now moved inside Compression as you can see in the following image.

enter image description here

查看更多
欢心
3楼-- · 2019-05-25 00:01

I circumvented this by using TexturePacker to generate a texture atlas (.atlasc) file. With TexturePacker you can set adjust the compression and then access the texture atlas in your project as follows:

let atlas = SKTextureAtlas(named: "Atlas") // Atlas.atlasc in your project
let texture = atlas.textureNamed("original_texture_001.png")
查看更多
登录 后发表回答