jerking of smooth moving objects

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: jerking of smooth moving objects

Post by Jabberwocky »

capton wrote:Jabberwocky, are your glitches the same as in the video/stub?
It's tough to tell if it was the same problem or not. My game is part space-sim, and the most noticeable jerking was when you were turning the space ship, such that the camera was scrolling across the skybox. Before I made these changes, the camera motion wasn't smooth, and the skybox would sometimes jerk forwards at different speeds.

It may be worth running some of the ogre demos, or modifying them to include a slowly moving object, to see if it's some other part of your application that is causing the problem.
Image
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: jerking of smooth moving objects

Post by xadhoom »

I realise some kind of periodic jerkiness in the new deferred shading demo (trunk) while moving the camera. Best visible if AO is activated because it drops my framerate significantly (but should be still not lagging periodically).

xad
capton
Gnoblar
Posts: 16
Joined: Tue Oct 27, 2009 12:16 pm

Re: jerking of smooth moving objects

Post by capton »

thanks, i will have a look at the demo.

hmm... it's hard to tell where the problem is. we have numerous options. i will try to list them, maybe someone can add more?

- application behaviour (is it blocked by some other app on the system?)
- gfx buffer output lag/frame drop (hard to check, though)
- timer issues (movement is not based on fixed frames but on a equiation that says pos.x += Ogre::Timer::deltaTime * speed)

i think what we can wipe out:

- driver issues (happens on both, nVidia and ATI hardware)
- ogre problem (it happens with other renderers aswell)

We should also think about a combination of multiple issues.

i see this as a common problem now, as many people have reported such issues. let's work together on it. feels like a cool House, MD episode :)

thomas
capton
Gnoblar
Posts: 16
Joined: Tue Oct 27, 2009 12:16 pm

Re: jerking of smooth moving objects

Post by capton »

hey,

i'm back on track. it looks better now, you guys were totally right. it is just a combination of several problems.

i enable VSynch
i enable gpuFlushCommandBuffer

when i'm going now with 1/60 delta time values (60 FPS clamped) i get almost smooth movement. everything looks fine. I just need to find a scalable solution (smooth times when going to 30, 15 and fallback). any hints? do you think it is fine when i'm just checking for avg FPS to detect the current framerate (clamped via vsynch) and use fixed timing values?

I'm just not sure if this will make my game run out of synch....

Thanks
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: jerking of smooth moving objects

Post by Jabberwocky »

capton wrote:do you think it is fine when i'm just checking for avg FPS to detect the current framerate (clamped via vsynch) and use fixed timing values?
You definitely want to measure the time delta since last frame, instead of using a fixed time value.

Check out the thread I linked to earlier about using Ogre::Timer to measure frame time.
Image
capton
Gnoblar
Posts: 16
Joined: Tue Oct 27, 2009 12:16 pm

Re: jerking of smooth moving objects

Post by capton »

Yeah, i tried that. It looks very smooth now :) Unfortunately, as soon as the framerate drops below 60 Hz, it seems to stutter again (periodically).

What i did so far:

SW-VSynch
Smoothing my frame times via smooth_delta += (raw_delta - smooth_delta) * (1.0 / 60.0) * tune; // tune is dynamically adapted
Buffer Flushes with OccQueries and the GetPixel() trick mentioned somewhere in the linked thread.

Interesting: When smoothing the frame times, the delta position between my cars is almost equal, without it looks like a total mess (this may explain the jerking. but hey, maybe i'm just hiding the problem again??)

I just don't know why i'm getting this jerking now below 60 Hz. Any pointers?

Jabberwocky, i will re-read the thread, maybe i have overlooked sth.

thanks man
capton
Gnoblar
Posts: 16
Joined: Tue Oct 27, 2009 12:16 pm

Re: jerking of smooth moving objects

Post by capton »

hey, sorry for pushing this. i have now a almost good looking and working solution.

so what i did (maybe this will help others in the future):

- Vertical Synch is now clamped at 30Hz (this is suitable for my type of application)
- Smooth Time Deltas (formula: smooth_delta = (raw_delta - smooth_delta) * tune; // where tune is currently set to 1.0 / 60.0. where tune [0.00001 .... 1.0], controls the approximation to raw_delta
- Flush GPU Buffer


All the jumps, etc are gone now. So, thanks for your help :)

One word regarding the 30Hz: It is very likely that my app will drop to 60s, so that's why i have clamped it there. You surely can have this adaptive.

I just got a slight problem now, fast moving entities are looking like they are "doubled" somehow. Like having a shadow. I need to find a solution for this and will concatenate.

If someone else has experienced this, feel free to post.

Thanks again, you're awesome :)
capton
Gnoblar
Posts: 16
Joined: Tue Oct 27, 2009 12:16 pm

Re: jerking of smooth moving objects

Post by capton »

So maybe it's just the nature of 30 FPS movement? In this case i need to clamp at 60 and provide 30 for fallbacks. right?
User avatar
Tiblanc
Gnoblar
Posts: 17
Joined: Sat Apr 18, 2009 9:26 pm
Location: Quebec, Canada

Re: jerking of smooth moving objects

Post by Tiblanc »

capton wrote: I just got a slight problem now, fast moving entities are looking like they are "doubled" somehow. Like having a shadow. I need to find a solution for this and will concatenate.
Do you have an LCD screen? This sounds like ghosting and it's part of the drawbacks of the technology. Try with a CRT monitor if you have one.
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: jerking of smooth moving objects

Post by Jabberwocky »

capton wrote: - Smooth Time Deltas (formula: smooth_delta = (raw_delta - smooth_delta) * tune; // where tune is currently set to 1.0 / 60.0. where tune [0.00001 .... 1.0], controls the approximation to raw_delta
I'm not quite sure what you're doing with this smooth time delta. You should be able to simply multiply your movement by the the length of time of the most recent frame, and get proper results.
Image
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: jerking of smooth moving objects

Post by syedhs »

Capton,

Perhaps you can try this simple fix: move the code currently in frameEnded to frameRenderingQueued (in your stub download). I didn't try to compile your stub code because my Ogre source SVN keeps on changing (but I didn't always build it).
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
User avatar
fantasian
Halfling
Posts: 81
Joined: Fri May 29, 2009 8:47 am
Location: Selanic, Greece
x 2
Contact:

Re: jerking of smooth moving objects

Post by fantasian »

For anyone wondering about stuttering frame rate (although it might be locked at 60fps!), here is the updated link to FlushGPUBuffer. Works a treat and solved my issues just a couple of weeks before release :-)
http://www.ogre3d.org/tikiwiki/FlushGPU ... e=Cookbook
Post Reply