difficult problem - high scaled images wobble left/right/up/down

local testImage = display.newImage( "testimage.jpg", true ) testImage.xScale, testImage.yScale = 12,12 --centres on screen-- testImage.x = 160 testImage.y = 283 local function frames() testImage.xScale = testImage.xScale\*.998 --resets image scale-- if testImage.xScale \< 1 then testImage.xScale = 12 end testImage.yScale = testImage.xScale end Runtime:addEventListener( "enterFrame", frames )

My new game involves having images (1024 x 1024) being scaled up quite a lot and then slowly zooming out. The code above is a very striped down part of the code which demonstrates the problem I am having. Choose an image that has some good contrast/detail near the middle so you can witness it jump about. It is worse while at a high scale and gets better as it shrinks.

NOTE: problem is only noticeable on the iPhone device itself

I have tried many things to circumnavigate this issue:

  • increased image file dimensions so I don’t need to scale so much (in case it’s due to the large scales, but it appears to happen independent of scales and is more dependant on contentWidth).

  • decreased image dimensions

  • set anchor points to 0,0 and scaled from my own “anchor” points by manually manipulating image.x & image.y values

  • changed frame rates

  • rounding values

  • using my own scale variable and shrinking it, then matching the image.xScale,yScale to that

  • display.setDefault( “magTextureFilter”, “nearest”), which I was hoping would help as I thought the jumping might have been something to do with pixels trying to filter and round to the proper place

The only small bit of success I had was setting anchor points to 0,0 and leaving the image.x,image.y completely still (effectively zooming out from the top left corner only). This is not appropriate for my game as I need to be zoomed in on certain points of the picture.

I’m beginning to think this might be a fundamental problem with how images are rendered, but I refuse to give up! Any guidance would be much appreciated 

I figured images just are not meant to be scaled that much.

Anyway i found a hack solution in the form of a “class” where I generate a display group and pass it the focusX,focusY position. Doing some quick zooms, screen captures and layering this group with the original image + a kind of pyramid of captures all perfectly lined up I have stopped any wobble. i.e the top image at focus may be a screen capture of the original image at scale 5. So in reality it is a representation of scale 5 but corona sees it as scale 1. 

I will share this class file once I make it more user friendly. Plan is to allow user to pass an array of scale values. eg. passing it {2,5,10} will layers the original first, a scale 2 on top, then a scale 5 and then 10. All stacked on a focus point. Leaving this info here because maybe one day someone else will be scaling images up to a massive degree and then tweening out like I do.

I figured images just are not meant to be scaled that much.

Anyway i found a hack solution in the form of a “class” where I generate a display group and pass it the focusX,focusY position. Doing some quick zooms, screen captures and layering this group with the original image + a kind of pyramid of captures all perfectly lined up I have stopped any wobble. i.e the top image at focus may be a screen capture of the original image at scale 5. So in reality it is a representation of scale 5 but corona sees it as scale 1. 

I will share this class file once I make it more user friendly. Plan is to allow user to pass an array of scale values. eg. passing it {2,5,10} will layers the original first, a scale 2 on top, then a scale 5 and then 10. All stacked on a focus point. Leaving this info here because maybe one day someone else will be scaling images up to a massive degree and then tweening out like I do.