Sprites Functionally Broken in Graphics 2.0

Hi,

I’ve been slogging through migrating from Graphics 1.0 to 2.0, and am extremely frustrated. To troubleshoot an issue surrounding sprites, I have created a test app that creates a sprite and runs an animation sequence:

[lua]_W = display.contentWidth

_H = display.contentHeight

local sequenceData = {

{

name=“idle”,

frames={1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27}

},

}

local greyBG = display.newRect(_W * .5, _H * .5, 300, 300)

greyBG:setFillColor(.5,.5,.5)

local imageSheetInfo = require(“D-Anim-Standard”)

local imageSheet = graphics.newImageSheet(“D-Anim-Standard.png”, imageSheetInfo:getSheet())

local Doggins = display.newSprite(imageSheet, sequenceData)

Doggins.x = _W * .5; Doggins.y = _H * .5

Doggins:setSequence(“idle”)

Doggins:play()[/lua]

The sprite sheet was created with the latest version of TexturePacker (3.4), using the following settings:

Trim mode: Trim

Border Padding: 2

Shape Padding: 2

Common Divisor: 4x4

Shape Outlines: Checked (red outline to help troubleshoot)

 

I’m also running the latest public release of Corona SDK (2393).

On the simulator, the sprite displays and animates, and the red outline surrounding it is always visible. On my devices, the sprite displays and animates, but the red outline sometimes disappears on the right or bottom, and the sprite is noticeably “jittery”. I’ve tried every combination of TexturePacker settings, including not using Trim mode at all; nothing works. Also, my currently-available app (under Graphics 1.0) uses TexturePacker-created sprite sheets without issue. This is not a TexturePacker problem; this is a Corona problem. I’ve also tried every Graphics 2.0 public release, and all exhibit this issue.

My first question is: why is the device output different from the simulator?

My second question is: has anyone else noticed this?

I’ve attached the test app to this post, and would love to hear if anyone got the same or different result on their simulator and devices.

As stated above, I’m extremely frustrated with this. I am nearly at the point where I will have to delay a major update to my game, an update for which I have already coordinated with Apple and other parties. It’s a critical time for my small independent studio, and Corona’s Graphics 2.0 migration is holding us back. I’ve sunk many hours into overcoming all of the problems I’ve encountered. If it weren’t for the XCode restriction and the crackdown on IDFA usage, I would happily be using build 1262, the last public Graphics 1.0 release.

Thanks,

David

I just submitted a bug report for this, but as stated above, I need to get this update out and don’t have time to wait for it to be addressed. Any workaround ideas are welcome!

David

Curious if you’re using any of TPs autoSD resizing features to get HD and SD versions of your textures.  You might be seeing the HD version on the simulator but depending on the device you might be seeing the scaled down SD version.  That might explain the red outlines disappearing on some edges.  (I’ve also noticed TP renders the red outlines under the graphics so depending on what the sprites are they might be getting covered up on certain frames.)  

If you are using autoSD did you try playing with some of the autoSD settings, such as the “accept fractional values” checkbox?  

@Stephen Lewis: I am using the AutoSD resizing feature of TexturePacker. I’m simulating a non-retina iPad, and tested on both a retina iPad and an iPhone that used the non-retina assets. Both exhibited the behavior. Also, the retina iPad simulator works fine, same as the non-retina iPad simulator.

I tried checking “accept fractional values”, and that didn’t change anything. If I change the Common Divisor value to something other than 4, the sprite jitters in the simulator and on the device, but at 4 it’s fine on the simulator. Not really sure what else I can try in TexturePacker, and considering that these sprites worked fine in Graphics 1.0, it seems very much like a change in Corona’s behavior.

Thanks for the suggestions!

For test purposes, I just built the test app under Graphics 1.0 (using 1262) and it displays correctly on device. Really stumped by this one!

Did you try setting Common divisor to 1 x 1 and trim mode to ‘none’?  There’s also 2 Corona SDK formats under ‘Data Format’ you could try either one and see if that makes a difference.  Not sure what else you could try.

@Stephen Lewis: Yup, I tried the “none” Trim mode, to no avail. I thought for sure it would work. The other image sheet format is for the older Sprite API, and wouldn’t work for the current one. Thanks again for the help though! I hope there’s just something I’m missing.

Hi David,

In my experience, and as Stephen is suggesting, the settings in TP can significantly effect the outcome, especially the trim settings. Can you post (or send to me) one of your image sheets that is causing issues, so I can test it locally in TP and see if I can get it to generate the proper frames? If you need to send this privately (for protection of your image assets) then please send it to brent (at) coronalabs (dot) com.

Thanks,

Brent

@Brent: Thanks for the help! Just sent the assets to you.

Hi David,

Thanks for the assets. I did some testing and confirmed that there is some bug between G1.0 and G2.0 in this respect (just the slightest “jitter” caused by a very very small stretch or compress of some frames. I’m checking into this further, but I’m not sure how high of a priority I can get from engineering. I know it’s not ideal, but if you are extremely close to getting your game up to G2.0 and this is a hold-up, could you just use all frames the same size? Or, if that results in image sheets that are too large for texture memory, could you divide it into two and make the animation sequence utilize both sheets?

Thanks,

Brent

Hi Brent,

Thanks a lot for looking into this! Nice to know that it’s an actual issue, and not something on my end. Regarding using all frames the same size, I thought about that and tested it, and ran into the same jitter problem, which was really surprising to me. Also, it would probably become a texture memory issue (I unfortunately use some really big image sheets, 4096x4096 for retina iPad). But thanks for the idea!

I decided to go ahead and try submitting my game’s update built with build 1262 (the last Graphics 1.0 build), and miraculously, it was approved! No XCode problem, and checking the I used IDFA for app installs seemed to do the trick on that front. I’m super relieved, but would of course love for the sprite issue to still be resolved.

Thanks again for your help!

  • David

Updating our app to GFX2.0 and running into the same problem.  +1 for a fix asap.

@dvboren: I haven’t tried it yet (I was able to get my game approved using Graphics 1.0), but according to Corona the problem is shader precision. If you force it to “highp”, it’s supposed to clear it up: http://docs.coronalabs.com/guide/basics/configSettings/#shader-precision

I’d love to know if it works for you! Good luck!
 

  • David

David,

You rock! Thank you!  The highp setting fixed the issue on both my app and the Doggins test app you attached above.  One note for others that run into this – it works for the latest public build (2393a) but not for the previous public build (2189a).

Thanks again,

Dave

@dvboren: That’s great news! Hopefully my next submitted update can be using Graphics 2.0. Thanks for the info! 

I just submitted a bug report for this, but as stated above, I need to get this update out and don’t have time to wait for it to be addressed. Any workaround ideas are welcome!

David

Curious if you’re using any of TPs autoSD resizing features to get HD and SD versions of your textures.  You might be seeing the HD version on the simulator but depending on the device you might be seeing the scaled down SD version.  That might explain the red outlines disappearing on some edges.  (I’ve also noticed TP renders the red outlines under the graphics so depending on what the sprites are they might be getting covered up on certain frames.)  

If you are using autoSD did you try playing with some of the autoSD settings, such as the “accept fractional values” checkbox?  

@Stephen Lewis: I am using the AutoSD resizing feature of TexturePacker. I’m simulating a non-retina iPad, and tested on both a retina iPad and an iPhone that used the non-retina assets. Both exhibited the behavior. Also, the retina iPad simulator works fine, same as the non-retina iPad simulator.

I tried checking “accept fractional values”, and that didn’t change anything. If I change the Common Divisor value to something other than 4, the sprite jitters in the simulator and on the device, but at 4 it’s fine on the simulator. Not really sure what else I can try in TexturePacker, and considering that these sprites worked fine in Graphics 1.0, it seems very much like a change in Corona’s behavior.

Thanks for the suggestions!

For test purposes, I just built the test app under Graphics 1.0 (using 1262) and it displays correctly on device. Really stumped by this one!

Did you try setting Common divisor to 1 x 1 and trim mode to ‘none’?  There’s also 2 Corona SDK formats under ‘Data Format’ you could try either one and see if that makes a difference.  Not sure what else you could try.