Skip to main content
Participant
August 14, 2011
Answered

Subpixel drawing of slow-moving sprites

  • August 14, 2011
  • 1 reply
  • 874 views

Hi.
I've been working on an iOS game with Flash for a while. Now I'm stuck with a display problem.

My game objects move very slowly and steadily and I notice pretty bad jittering/stuttering. This is GPU mode in Air 2.7, CPU mode is too slow. The cause of the jittering seems to be that Air moves my sprites (based on PNGs) only in full- and half-pixel steps, regardless of whether cacheAsBitmap/-Matrix are enabled. Is this an optimization by Adobe or can I get rid of this somehow? It's really annoying.

Thank you!

This topic has been closed for replies.
Correct answer Colin Holgate

This gave a new clue:

"Just cacheAsBitmap looks much worse as it produces full-pixel stepping."

What is your stage quality set to? Try:

stage.quality = "high";

1 reply

Colin Holgate
Inspiring
August 14, 2011

cacheasbitmap items are always drawn to the nearest pixel, that's one of the things that makes them be fast. You might try cacheasbitmapmtraix without cacheasbitmap, that could be enough so that the GPU handles them as floating point positions. Also, perhaps use a matrix that makes them be stored at higher resolution, so that the GPU has something to work with.

Are you seeing this just on old iPhone, or on iPad too? If it's also on iPhone 4, then make sure you're using High for the quality setting in publishing, because the Retina pixels are close enough together that you hopefully won't notice any stepping effect.

Also, make sure that your location math is floating point. If you're going math where the position gets rounded down, that would exaggerate the effect.

Participating Frequently
August 15, 2011

Setting a cacheAsBitmapMatrix when cacheAsBitmap is false won't do anything. Setting a cacheAsBitmapMatrix when cacheAsBitmap is true should circumvent the pixel snapping limitation of cacheAsBitmap.

Colin Holgate
Inspiring
August 15, 2011

Can you think of a reason he see stepping as the object moves?