Interpolation

mcaden

04-10-2008 18:50:08

I hate to beat a dead horse but has anybody run into the problem of having jitter, and interpolation is no different whether using RM_Interpolate or RM_Absolute?

The mesh seems to bounce back and forth from one frame to the next - forward, backward, forward, backward, etc...

The higher the velocity, the more the bounce. RM_Absolute, RM_Custom, RM_Interpolate...all have the exact same effect.

betajaen

04-10-2008 19:34:26

Your using the accumulator as a SceneController?

mcaden

04-10-2008 19:41:22


mWorld = new World("use-log: yes, time-controller: ogre");
mScene = mWorld->createScene("NxScene", "renderer: ogre, controller: accumulator, gravity: yes, floor: no");
mScene->setGravity( Vector3(0, -98, 0) );
mScene->createActorGroup("player");
mScene->createActorGroup("terrain");
mScene->createActorGroup("enemy");



That's my world/scene.

Doesn't make any difference whether I set RM_Interpolate/RM_Absolute through the params class or by calling the setRenderMode function.

betajaen

04-10-2008 20:02:59

That seems to be okay.

When you mean bounce back and forth from one frame to another; Is the distances great? Can we see screenshots or movies?

Luis did design the interpolation system, but there may be some cases where the distances between frames are two great for any smoothing.

mcaden

04-10-2008 20:10:49

I'll have to DL fraps later.

He's only in one position in any given frame so far as I can tell (it's not trying to render the mesh twice) so a screenshot won't show the problem.

Right now I'm off to bed...I'll post a movie tomorrow.

mcaden

04-10-2008 20:26:05

Decided to go ahead and do it...

Oddly enough - when I start recording video - the jitter goes down to pretty much nothing (might have something to do with it reducing my FPS? previously 60 - with recording it goes down to between 20-30)

http://mcaden.katalyststudios.com/projects/jitter.WMV

This video does NOT do it justice...It looks good on the video in comparison to what I'm seeing.

EDIT: Video shows character moving at about twice the speed it actually is...a bad capture but I think you get the point.

betajaen

04-10-2008 20:42:56

That is quite bad.

Are you using a CharacterController or a normal actor to move your mesh? How are you moving it? Forces or setting the velocity?

mcaden

05-10-2008 05:00:31

Normal actor.


void Character::translate( Real rtrans )
{
Vector3 trans = getGlobalOrientationAsOgreQuaternion() * Vector3(0, 0, rtrans);
setLinearVelocity( trans );
}


That's my movement code - rtrans simply being what I've set as my movement speed. I think I took this from the SmartCamera example. The jitter isn't the actor being forced into the ground - it happens even while jumping or if I turn gravity off completely.

Like I said the video doesn't really do it justice...it's very rapid. It's like every other frame is behind by a full second.

betajaen

05-10-2008 09:55:23

I think it's because your using setLinearVelocity like that. Have you tried just adding a force?

mcaden

05-10-2008 11:20:04

No change if I use addForce other than framerate starts affecting the velocity (how many times/second the force is added).

If I turn on the debugRenderer I can see the actor's cube trying to be in 2 places at the same time back and forth, back and forth.

Incidentally my jump code:


setPlayerState( PS_MOVING );
addForce(NxVec3(0, 15000, 0), NX_FORCE);
mIsInAir = true;

Is a simple addForce and I also get the problem during a jump - whether jumping forward or backward, or jumping straight up and having gravity bring me down. I can visibly see the actor's shape jittering.