iOS 9.2 Texture Stretching still a big problem (update: ActionEditor-related)

I've filed a bug (#23844584) with a link to a sample project. (I tried to attach the project to the bug, but the upload keeps failing-- it's only a ~500k zip file 😕).


This is 100% reproducible with the configuration described. Any help is appreciated, either from Apple engineers or someone who has found a work-around for this.


Here's the text of the bug:


Summary:
Please see the attached sample project. Images in both "correct" and "bad" atlases are exactly the same size, but the "bad" images are stretched when applied. This has been observed in my project with any textures applied under the following circumstances:


1. Texture image has an alpha-channel buffer surrounding non-alpha pixels

2. Texture is built from Texture Atlas within an Asset Catalog

3. TextureAtlas has "provides namespace" set to true

4. Textures are applied by an animateWithTextures SKAction created in the action editor and saved in an .sks file.


Steps to Reproduce:

1. Run App

2. Select "Good Texture Sizing" then tap screen to add correctly textured sprite

3. Select "Bad Texture Sizing" and tap screen to add incorrectly textured sprite.

4. Notice the difference.


Expected Results:

source images are identical in all respects except for solid background vs alpha background. Textures should be rendered at the same size.


Actual Results:

Textures with alpha background are "trimmed" and then non-alpha pixels are "stretched" to fit sprite size.

Version:

iOS 9.2, Xcode 7.2 Notes:

Configuration:

tested on iPhone 6s & simulators


And the sample project: http://hungrymelon.com/BadAtlas.zip.

Replies

One workaround is to set deployment target to 8.0.

Try it.


It's sad this bug is still there for 9.2.

Something as basic as texture management should not be a problem for 2D game engines.

It's strange that everyting works fine with deployment target set to 8.0.

I'm just worried that someday Apple may break that too.

Hi JShen26 & Karim,


If you are seeing this fixed by switching to 8.0 as a deployment target that is a symptom that the AssetCatalog sprite atlas is failing. When setting deployment to 8.0 the SpriteKit texture atlas tool is invoked instead of the AssetCatalog one that only supports 9.0+. If that is truly the case here we can forward the bug to the approriate team.


You can also try using a standard .atlas folder outside the catalog and then you can keep the deployment target as 9.0 or later. If with the same set of images the classic .atlas folder is 'correct' while an AssetCatalog one is 'bad' then you should consider using .atlas folders until your issue is marked as resolved.


Cheers

Thanks for the reply greven.


I can't set the deployment target to less than 9.0, because I have dependencies on 9.x technologies (Actions Editor, GameplayKit, ODR).


I can try splitting the problematic textures into an .atlas folder, but A) I lose ODR capabilities, and B) I've had trouble (read weird behaviors) before mixing old-style .atlas folders with newfangle Sprite Atlas XcAssets in the same project.

I'm sorry if I sound really frustrated—I know that you can't divulge details, and that you personally have no control over the release timeframes, but can you give me any kind of hint as to the priorities on fixing this? Surely the "official" answer can't be "don't use any of our current technologies and you'll be fine".


I know that Apple doesn't do hotfixes, but can I at least hope for a beta- or point-release to get my project unblocked? At this point, I'd be happy to do/contribute whatever I can to help in getting it resolved.

I have been having issues with this for the past 4 months, if you have an animated character rendered to a sprite then your only option is to use the old folder.atlas method. If you don't an animated jumping character never leaves the floor as its always scaled to fill the image bounds, its a real pain. I don't see how this type of thing gets missed in (internal, alpha, beta) testing, I also don't understand that once its a know issue why it takes so long to fix.

BUG: 23391232 - Submitted with sample project - 4th November 2015

Like Karim I am using 9.x features as I wanted to make the most of the latest version of SpriteKit.

Fuzzygoat, are you using the Actions Editor, or are you also seeing this with animations created in code?


One nuance that I'm seeing that makes me think this is not strictly an Atlas issue is that the same textures applied statically (ie: SKSpriteNode(texture: ...) ) are not stretched... it's only when they're animated with an SKAction... all of my animations currently have been built with the Actions Editor, but I'm considering rewriting them in code to see if that solves the problem. I'd love to know what your experiences are.

I've just updated my bug with a modified project file (http://hungrymelon.com/BadActions.zip) which illustrates that SKAction.animateWithTextures() created in code do not display this problematic behavior, even with 9.x Xcassets-based atlases with alpha channels. I'll be rewriting my application to avoid using the Actions Editor.

I'm experiencing this problem too. Using 9.2.1, Xcode Version 7.2 (7C68).


http://imgur.com/a/b2M0B


The textures all have lots of transparency around them, as the characters were drawn in layers and then exported.


I'm going to try re-exporting the textures without the transparency and see if that is a functional work-around.

I just looked at your project and noticed that if you select your pc.sks file and click on each of the [Animate with Textures] in pc-idle you can select [Resize]. After doing this both "Good Texture Sizing" and "Bad Texture Sizing" produce the same results. I used, Xcode Version 7.2 (7C68) with the iPhone 6 Simulator, not sure if this helps?


I do agree that Xcassets does not work as intended, I have swapped all projects to use the old Folder.atlas approach.