Texture tearing and stuttering of rotations

Ive been working a lot with rotations and I think ive found another bug, maybe a serious one. (Beta 2 tested)

Run this file on an actual iPhone (both 3GS and 3G act the same), its a simple enough app, just a rotating disk, timed based rather than frame based rotation.

Anyway, watch the disk rotate every 45 degrees or so their is a noticeable stutter. On the simulator the stutter isnt the same but appears as a glitch / tear in the image.

Ive stripped away the whole game just leaving enough to show the bug, I cant see any issues with my code.

File Expired [import]uid: 5354 topic_id: 909 reply_id: 300909[/import]

Hi Mike

Does that mean you are seeing it too?

Matt [import]uid: 5354 topic_id: 909 reply_id: 2105[/import]

… [import]uid: 5712 topic_id: 909 reply_id: 2103[/import]

ok, I can’t see anything that should slow it down. Maybe somehow the garbage collector kicks in.
Also the rotation angle isn’t caped at 360. I noticed these hickups in my game too and would love to know why it happens.

No, I can’t test it at my job but will in a few hours. I have a IPod 2.Gen and will let you know. [import]uid: 5712 topic_id: 909 reply_id: 2106[/import]

In the game the rotation is capped at 360, that doesn’t help fix the issue.

Its an odd one, hopefully fixable, im looking to submit soon and its not something I would want in the final game as it makes the app look buggy. [import]uid: 5354 topic_id: 909 reply_id: 2107[/import]

While I’ve not experienced what you’re referring to (I’ll be able to run it later), I can tell you I’ve had some very strange behavior with modification to the rotation of graphics.

The value in the rotation property is quite… odd. It really flips all over the place in terms of sometimes being from 0 to 360 and sometimes operating from 0 to 180 then -180 to 0. It was causing all kinds of problems for me when I was trying to determine when my original 0 rotation was pointing into a specific area… so I wrote a “fixRotation” function which clamped everything to be from 0 to 360 every time I “use” the rotation value. It may not be pretty, but it served my purposes:

if (\_spin.rotation \< 0) then \_spin.rotation = 360 + \_spin.rotation; end if (\_spin.rotation \> 360) then \_spin.rotation = \_spin.rotation - (360 \* math.floor(\_spin.rotation / 360)); end

This insures that rotation is always 0-360 (and has no side-effects of flipping things about since it’s simply applying the correct rotation in a 0-360 range… nothing changes on screen because of this). My point? Well, perhaps there’s some oddity building up with your value of rotation because you never clamp it?

In my case, when my mouse was doing the rotation of my object, the value of rotation was very erratic once I “went negative” (it would start out as -1, -2, -3 and suddenly become 356, 355, 354… but if I rotated back it would change to -3 again) or once I crossed from 180 to more than 180… just really weird numbers like it was trying to do some conversion but half the time it did it one way and half the time another.

At any rate, just thought I’d toss this out there in case it made a difference.

Scott [import]uid: 5659 topic_id: 909 reply_id: 2108[/import]

Thanks Scott

I wrote a similar function to cap the rotation, that fixes the unpredictability in using rotations but not the rendering bug [import]uid: 5354 topic_id: 909 reply_id: 2109[/import]

Matthew, it is not a rendering bug. But sometimes the framerate is jumping. I am surprised to see this with such a small project even on my desktop. Just do a

print ("rotation: “…radarGroup.rotation…” rot: "…newRotation)

to the terminal. Usually I get a newRotation value of 1.98. That is the normal value of a delta of 33 which reassembles 30 FPS. Sometimes I get a newRotation value of 3.96, which is just 15 FPS.

Like I said, I am surprised to see this drop. Now I am curious what the marketing guys of ANSCA will say. [import]uid: 5712 topic_id: 909 reply_id: 2115[/import]

Thanks for that mike, I had written a frame rate calculator and didn’t see a noticeable difference but I was averaging that over 1 second.

Its hard to tell if it is just on rotation as other animations don’t seem to jump. But the issues does seem to repeat and so is predictable so they should be able to find whats causing it.

Heres hoping [import]uid: 5354 topic_id: 909 reply_id: 2116[/import]

It’s not only on rotation. When the framerate jumps, every animation is influenced. [import]uid: 5712 topic_id: 909 reply_id: 2118[/import]

Bug entered, # 156

Marketing guy says “no bug its a feature !”

LOL

Carlos [import]uid: 24 topic_id: 909 reply_id: 2125[/import]

Hey Carlos

Have you guys seen this / know whats happening. Im looking at launching mid may and this is sort of a deal breaker?

Matt [import]uid: 5354 topic_id: 909 reply_id: 2194[/import]

The bug status reads “Active” which means one of the devs is mostly looking at it. As soon as i know something, I will follow up with you.

Carlos [import]uid: 24 topic_id: 909 reply_id: 2236[/import]

Thanks Carlos [import]uid: 5354 topic_id: 909 reply_id: 2245[/import]

I don’t see anything in the simulator – rock solid 33 when I print out timeDelta. On the desktop, any stuttering you would see might be because of some other process. Anything look weird in Activity Monitor?

On my 1G, I do see something, but it’s really subtle. Maybe 1x per second. Investigating more.

[import]uid: 54 topic_id: 909 reply_id: 2256[/import]

(copied from another related thread: http://developer.anscamobile.com/forum/2010/05/09/corona-cant-keep-smooth-30fps-animation-useless)

Hi all, we believe we have identified the culprit. It’s a little arcane but has to do with the the fact that the internal timer gets periodically out of sync with the screen refresh rate. This can cause observable problems on the simulator as well as on device. It can be responsible for stuttering hiccup like behavior as well as visual tearing, since updates are happening during the middle of a screen refresh.

We have a fix (on the device) that makes the problem go away, but it requires the end-user’s phone to be iPhone OS 3.1 or later. Unfortunately, Apple did not address this issue in OS 3.0 so we are unable to address it for end users who have not upgraded their OS.

cheers,
Walter [import]uid: 26 topic_id: 909 reply_id: 2290[/import]

Same behaviour in beta 3 on the simulator. [import]uid: 5712 topic_id: 909 reply_id: 2446[/import]

Does your device have iPhone OS 3.1 installed?

Which iPhone are you viewing this on?

Can you be more specific about the behavior? Is it tearing or stuttering?

(Note that you may still continue to see this on the simulator)
[import]uid: 26 topic_id: 909 reply_id: 2455[/import]

Ive tested on the simulator and on OS4 beta 1 iPhone 3GS and the simulator it seems to be fixed.

My game is running a lot smoother but the game itself is in pieces as the moment as im trying to get a final build together so testing is problematic at the moment.

The beta doesnt not seem to have broken anything else either.

I only need device model in app and im set to launch I think [import]uid: 5354 topic_id: 909 reply_id: 2458[/import]

Note that the fix on the device involved locking the animation speed to the screen refresh, which is 60 Hz on iPhone. This limits us to fps values that divide evenly into 60, so currently we’re locking at 30 fps.

On the Mac, we can’t lock the animation to the screen refresh in the same way, since that’s dependent on the monitor hardware (it could be 60Hz, 70Hz, etc.) So results in the simulator may vary depending on the monitor hardware. [import]uid: 3007 topic_id: 909 reply_id: 2540[/import]